Documentation ¶
Index ¶
- Constants
- Variables
- func ExampleGodrorQueryParams() map[string][]string
- func ExampleOracleQueryParams() map[string][]string
- func SSLModeParse(s string) (string, error)
- func SSLModeParseOrDefault(s, d string) string
- type DataSource
- func (ds DataSource) Host() string
- func (ds DataSource) HostDatabase(sep string) string
- func (ds DataSource) HostDatabaseQuery(sep string) string
- func (ds DataSource) HostnameOrDefault() string
- func (ds *DataSource) Name() (string, error)
- func (ds DataSource) Open() (*sql.DB, error)
- func (ds DataSource) PortOrDefault() uint16
- func (ds DataSource) UserPassHostDatabase() string
- func (ds DataSource) UserPassHostDatabaseQuery() string
- func (ds DataSource) UserPassword() string
- type DataSourceSet
Constants ¶
View Source
const ( DriverBigQuery = "bigquery" DriverGodror = "godror" DriverMySQL = "mysql" DriverOracle = "oracle" DriverPostgres = "postgres" DriverSQLite3 = "sqlite3" SchemePostgres = "postgres" DefaultPortMySQL uint16 = 3306 DefaultPortPostgres uint16 = 5432 )
View Source
const ( OracleParamConnectTimeout = "connect_timeout" PgSSLModeParam = "sslmode" SSLModeAllow = "allow" SSLModeDisable = "disable" SSLModePrefer = "prefer" SSLModeRequire = "require" SSLModeVerifyCA = "verify-ca" SSLModeVerifyFull = "verify-full" SSLModeDefault = SSLModeDisable )
Variables ¶
View Source
var ( ErrDriverNameEmpty = errors.New("driver name cannot be empty") ErrDriverNotSupported = errors.New("driver not supported") )
View Source
var ErrSSLModeNotSUpported = errors.New("sslmode not supported")
Functions ¶
func ExampleGodrorQueryParams ¶ added in v0.47.0
func ExampleOracleQueryParams ¶ added in v0.47.0
func SSLModeParse ¶
SSLModeParse parses Postgres sslmode query param
func SSLModeParseOrDefault ¶
SSLModeParseOrDefault manages Postgres sslmode query param
Types ¶
type DataSource ¶
type DataSource struct { Driver string `json:"driver"` DSN string `json:"dsn"` Hostname string `json:"hostname"` // does not include port Port uint16 `json:"port"` // 0-65535 User string `json:"user,omitempty"` Password string `json:"password,omitempty"` Database string `json:"database,omitempty"` Query map[string][]string `json:"query,omitempty"` }
func (DataSource) Host ¶
func (ds DataSource) Host() string
func (DataSource) HostDatabase ¶ added in v0.47.0
func (ds DataSource) HostDatabase(sep string) string
func (DataSource) HostDatabaseQuery ¶ added in v0.47.0
func (ds DataSource) HostDatabaseQuery(sep string) string
HostDatabaseQuery can be used when there's no need to validate query params
func (DataSource) HostnameOrDefault ¶ added in v0.46.0
func (ds DataSource) HostnameOrDefault() string
func (*DataSource) Name ¶ added in v0.46.0
func (ds *DataSource) Name() (string, error)
Name produces a URI DSN connection string
func (DataSource) PortOrDefault ¶
func (ds DataSource) PortOrDefault() uint16
func (DataSource) UserPassHostDatabase ¶ added in v0.47.0
func (ds DataSource) UserPassHostDatabase() string
func (DataSource) UserPassHostDatabaseQuery ¶ added in v0.47.0
func (ds DataSource) UserPassHostDatabaseQuery() string
UserPassHostDatabaseQuery can be used when there's no need to validate query params
func (DataSource) UserPassword ¶
func (ds DataSource) UserPassword() string
type DataSourceSet ¶ added in v0.58.0
type DataSourceSet struct {
Data map[string]DataSource
}
func (DataSourceSet) GetDataSource ¶ added in v0.58.0
func (dss DataSourceSet) GetDataSource(key string) (DataSource, error)
func (DataSourceSet) Keys ¶ added in v0.58.0
func (dss DataSourceSet) Keys() []string
Click to show internal directories.
Click to hide internal directories.