Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoDB set to Options ErrNoDB = fmt.Errorf("no db") // ErrNoLogger set to Options ErrNoLogger = fmt.Errorf("no logger") // ErrDirNotExists when migration path not exists ErrDirNotExists = fmt.Errorf("migrations dir not exists") // ErrBothMigrateTypes when up or down migration file not found ErrBothMigrateTypes = errors.New("migration must have up and down files") // ErrPositiveSteps when steps < 0 ErrPositiveSteps = errors.New("steps must be a positive number") )
Functions ¶
Types ¶
type DB ¶
type DB interface {
RunInTransaction(fn func(*pg.Tx) error) error
Exec(query interface{}, params ...interface{}) (orm.Result, error)
ExecOne(query interface{}, params ...interface{}) (orm.Result, error)
Query(model, query interface{}, params ...interface{}) (orm.Result, error)
QueryOne(model, query interface{}, params ...interface{}) (orm.Result, error)
}
DB interface
type Migration ¶
type Migration struct {
Version int64
Name string
CreatedAt time.Time
Up func(DB) error
Down func(DB) error
}
Migration item
Click to show internal directories.
Click to hide internal directories.