Documentation
¶
Index ¶
Constants ¶
const ( DB_USER_KEY = "USER" DB_PWD_KEY = "PASSWORD" DB_NAME_KEY = "NAME" DB_SSL_MODE_KEY = "SSL_MODE" DB_VERSION = "VERSION" )
Database environment variable keysuffixes
const ( DEFAULT_POSTGRES_PORT = "5432" DEFAULT_POSTGRES_SSL_MODE = "disable" DEFAULT_POSTGRES_DATABASE = "postgres" POSTGRES_PROTOCOL = "tcp" )
PostgreSQL default values
const ( DEFAULT_MYSQL_PORT = "3306" DEFAULT_MYSQL_PROTOCOL = "tcp" )
MySQL default values
const ( PORT = "PORT" HOST = "HOST" PROTOCOL = "PROTOCOL" USER = "USER" DATABASE = "DATABASE" )
ServerAddr environment variable keysuffixes
const ( DEFAULT_SERVER_PROTOCOL = "http" DEFAULT_SERVER_HOST = "localhost" )
ServerAddr default values
const (
DEFAULT_SQLITE_DRIVER = "sqlite3"
)
SQLite default values
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLConfig ¶
type MySQLConfig struct { ServerAddr User string `json:"username"` Password string `json:"password"` Database string `json:"database"` ConnectionParams string `json:"connectionParams"` }
MySQLConfig Configuration info for a MySQL db
func NewMySQLConfig ¶
func NewMySQLConfig(name string) MySQLConfig
NewMySQLConfig Creates a new MySQLConfig from environment variables
func (MySQLConfig) ConnInfo ¶
func (my MySQLConfig) ConnInfo() ConnInfo
ConnInfo Gets the connection information
type PGConfig ¶
type PGConfig struct { ServerAddr User string `json:"username"` Password string `json:"password"` Database string `json:"database"` SSLMode string `json:"sslMode"` }
PGConfig Connection info for a postgres database
func NewPGConfig ¶
NewPGConfig Creates a new PGConfig by reading from environment variables
type SQLiteConfig ¶
SQLiteConfig Configuration info for a SQLite db
func NewSQLiteConfig ¶
func NewSQLiteConfig(name string) SQLiteConfig
NewSQLiteConfig Creates a new SQLconfig by reading from environment variables
func (SQLiteConfig) ConnInfo ¶
func (lite SQLiteConfig) ConnInfo() ConnInfo
ConnInfo Gets the connection information
type ServerAddr ¶
type ServerAddr struct { Host string `json:"host,omitempty"` Port string `json:"port,omitempty"` Protocol string `json:"protocol,omitempty"` }
ServerAddr Connection info for a server
func NewServerAddr ¶
func NewServerAddr(name string) ServerAddr
NewServerAddr Creates a new ServerAddr by checking environment varialbes whose keys are derived from the supplied name
func (ServerAddr) Address ¶
func (server ServerAddr) Address() string
Address Gets the host:port concatentaion of the ServerAddr
func (ServerAddr) Network ¶
func (server ServerAddr) Network() string
Network Gets the ServerAddr protwork based on the protocol
func (ServerAddr) ToURL ¶
func (server ServerAddr) ToURL(route string) string
ToURL Accepts a route as a parameter and turns the route + ServerAddr to a full url