Documentation
¶
Index ¶
- func ColumnExists(db *sql.DB, tableName string, columnName string) bool
- func NewDatabaseHandler(sqlBackend SqlBackend, opts ...handler.Option) handler.Handler
- func NewHandler(dbType DatabaseType, opts ...handler.Option) (handler.Handler, error)
- func NewMySQLHandler(opts ...handler.Option) handler.Handler
- func NewPostgresHandler(opts ...handler.Option) handler.Handler
- func NewSQLiteHandler(opts ...handler.Option) handler.Handler
- type DatabaseType
- type MysqlBackend
- type PostgresBackend
- type SqlBackend
- type SqliteBackend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabaseHandler ¶
func NewDatabaseHandler(sqlBackend SqlBackend, opts ...handler.Option) handler.Handler
func NewHandler ¶
NewHandler creates a new database handler based on the database type
Types ¶
type DatabaseType ¶
type DatabaseType string
DatabaseType represents the type of database to use
const ( SQLite DatabaseType = "sqlite" MySQL DatabaseType = "mysql" PostgreSQL DatabaseType = "postgres" )
func DetectDatabaseType ¶
func DetectDatabaseType(connectionString string) (DatabaseType, error)
DetectDatabaseType attempts to detect the database type from a connection string
type MysqlBackend ¶
type MysqlBackend struct {
}
func (MysqlBackend) CreateSchema ¶
func (b MysqlBackend) CreateSchema(db *sql.DB)
Create db/schema if necessary
func (MysqlBackend) GetDriverName ¶
func (b MysqlBackend) GetDriverName() string
func (MysqlBackend) GetPrepareSymbol ¶
func (b MysqlBackend) GetPrepareSymbol() string
func (MysqlBackend) MigrateSchema ¶
Migrate schema if necessary
type PostgresBackend ¶
type PostgresBackend struct {
}
func (PostgresBackend) CreateSchema ¶
func (b PostgresBackend) CreateSchema(db *sql.DB)
Create db/schema if necessary
func (PostgresBackend) GetDriverName ¶
func (b PostgresBackend) GetDriverName() string
func (PostgresBackend) GetPrepareSymbol ¶
func (b PostgresBackend) GetPrepareSymbol() string
func (PostgresBackend) MigrateSchema ¶
Migrate schema if necessary
type SqlBackend ¶
type SqliteBackend ¶
type SqliteBackend struct {
}
func (SqliteBackend) CreateSchema ¶
func (b SqliteBackend) CreateSchema(db *sql.DB)
Create db/schema if necessary
func (SqliteBackend) GetDriverName ¶
func (b SqliteBackend) GetDriverName() string
func (SqliteBackend) GetPrepareSymbol ¶
func (b SqliteBackend) GetPrepareSymbol() string
func (SqliteBackend) MigrateSchema ¶
Migrate schema if necessary
Click to show internal directories.
Click to hide internal directories.