<commit_before># railsdbconfig

Golang package to read the Rails database.yml file<commit_msg>Added some explaining in the Readme with an example<commit_after># railsdbconfig

Golang package to read the Rails database.yml file


Example
-------

In the config.json the path to the rails directory needs to be defined

```Javascript
{
  "rails-dir": "/Users/dovadi/rails/blog/"
}
```

(The config.json should be in the root path of golang program)

```Go
package main

import (
  "fmt"

  "github.com/dovadi/railsdbconfig"
)

func main() {
  dbSettings, err := railsdbconfig.Settings()
  if err != nil {
    panic(err)
  }

  fmt.Println(dbSettings.Development.Database)
}
```

The most common settings are defined:

```Go
type DbSettings struct {
  Development DbParameters
  Test        DbParameters
  Production  DbParameters
  Staging     DbParameters
}

type DbParameters struct {
  Adapter             string
  Encoding            string
  Database            string
  Username            string
  Password            string
  Allow_concurrency   bool
  Timeout             int
  Pool                int
  Host                string
  Socket              string
  Prepared_statements bool
  Statement_limit     int
}

```
{'fraction_non_alphanumeric': 0.07096247960848287, 'fraction_numerical': 0.0, 'mean_word_length': 2.4759206798866855, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3243200', 'n_tokens_mistral': 380, 'n_tokens_neox': 340, 'n_words': 116}