Documentation ¶
Index ¶
- Constants
- type ColumnConverter
- type ComplexValue
- type Db
- type LogFunc
- type Migration
- type Runnable
- type Stmts
- type Suite
- func (s *Suite) Add(m *Migration)
- func (s *Suite) AddSQL(up, down string)
- func (s *Suite) Migrate(db *Db) (int, int, error)
- func (s *Suite) Reset(db *Db) (int, int, error)
- func (s *Suite) Rollback(db *Db) (int, int, error)
- func (s *Suite) Run(db *Db, up bool, maxSteps int) (int, int, error)
- func (s *Suite) Step(db *Db) (int, int, error)
- type Tx
Constants ¶
View Source
const ( TableName string = "migrations" ColumnName string = "version" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColumnConverter ¶
ColumnConverter converts between struct field names and database row names
var SnakeCaseConverter ColumnConverter = &snakeConv{}
SnakeCaseConverter converts column names from snake_case to CamelCase field names.
type ComplexValue ¶
type ComplexValue interface { Encode() interface{} // Decode receives a plain value to decode, never a pointer. Decode(v interface{}) error }
ComplexValue implements methods for en/decoding custom values to a format the driver understands.
type Db ¶
type Db struct { *sql.DB // LogFunc is the log function to use for query logging. // Defaults to nil. LogFunc LogFunc // The column converter to use. // Defaults to SnakeCaseConverter. ColumnConverter ColumnConverter // contains filtered or unexported fields }
func (*Db) SetMaxCachedStatements ¶
SetMaxCachedStatements sets the max number of statements to cache in the LRU. The default is 500.
type LogFunc ¶
type LogFunc func(queryId, query string, args ...interface{})
LogFunc can be set on the Db instance to allow query logging.
type Suite ¶
type Suite struct { Migrations []*Migration Stmts *Stmts // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.