Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultPostgresDB = "postgres" DefaultMysqlDB = "mysql" )
View Source
const ( DialectSQLite = "sqlite" DialectMySQL = "mysql" DialectPostgres = "postgres" )
Variables ¶
View Source
var ( ErrUnknownDriver = errors.New("unknown driver") ErrNoSuchDatabase = errors.New("no such database exists") ErrCannotConnectToDefaultDB = errors.New("cannot connect to default db") )
View Source
var (
ErrUnsupportedDialect = errors.New("unsupported dialect")
)
Functions ¶
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(dbc *Config) *Connection
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) IsOpen ¶
func (c *Connection) IsOpen() bool
func (*Connection) Open ¶
func (c *Connection) Open() (*DB, error)
func (*Connection) WithDatabase ¶
func (c *Connection) WithDatabase(database string) *Connection
func (*Connection) WithForceCreateDb ¶
func (c *Connection) WithForceCreateDb() *Connection
type DataSource ¶
type DataSource struct { Dialect string Host string Port string Username string Password string Name string Params string }
DataSource holds the necessary fields for a DSN (data source name)
func (*DataSource) String ¶
func (ds *DataSource) String() (string, error)
String returns the string representation of the data source
Click to show internal directories.
Click to hide internal directories.