dsn

package module
v0.0.0-...-c0277b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2015 License: MIT Imports: 6 Imported by: 0

README

dsn Build Status

A data source name adapter for sql.Open in golang.

Usage

name, dsn, _ := dsn.FromRailsConfig("myapp/config/database.yml", "production")
fmt.Printf("[%s] %s", name, dsn)
// => [mysql] username:password@tcp(localhost:3306)/dbname

Features

  • Data Source Name from Rails database.yml.
  • Support MySQL, PostgreSql, Sqlite.

Installation

$ go get github.com/monochromegane/dsn

TODO

  • Data Source Name from flags.
  • Data Source Name from Env.

Contribution

  1. Fork it
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create new Pull Request

License

MIT

Author

monochromegane

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromRailsConfig

func FromRailsConfig(file, env string) (string, string, error)

Types

type RailsDbConfig

type RailsDbConfig struct {
	Adapter  string
	Host     string
	Port     string
	Database string
	Username string
	Password string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL