Documentation ¶
Index ¶
- Variables
- type Database
- type FieldInfo
- type NullInt
- type NullString
- type NullTime
- type RowMapper
- type Trx
- func (trx *Trx) Commit() error
- func (trx *Trx) Count(command string, args ...interface{}) (int, error)
- func (trx *Trx) Execute(command string, args ...interface{}) (int64, error)
- func (trx *Trx) Exists(command string, args ...interface{}) (bool, error)
- func (trx *Trx) Get(data interface{}, command string, args ...interface{}) error
- func (trx *Trx) NoLogs()
- func (trx *Trx) QueryIntArray(command string, args ...interface{}) ([]int, error)
- func (trx *Trx) ResumeLogs()
- func (trx *Trx) Rollback() error
- func (trx *Trx) Scalar(data interface{}, command string, args ...interface{}) error
- func (trx *Trx) Select(data interface{}, command string, args ...interface{}) error
- func (trx *Trx) SetLogger(logger log.Logger)
- type TypeMapper
Constants ¶
This section is empty.
Variables ¶
var ErrNoChanges = stdErrors.New("nothing to migrate.")
ErrNoChanges means that the migration process didn't change execute any file
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database represents a connection to a SQL database
func NewWithLogger ¶
NewWithLogger creates a new Database instance with logging or panic
func (*Database) Connection ¶ added in v0.16.0
Connection returns current database connection
type NullInt ¶
NullInt representa a nullable integer
func (NullInt) MarshalJSON ¶
MarshalJSON interface redefinition
type NullString ¶
type NullString struct {
sql.NullString
}
NullString representa a nullable string
func (NullString) MarshalJSON ¶
func (r NullString) MarshalJSON() ([]byte, error)
MarshalJSON interface redefinition
type NullTime ¶
NullTime representa a nullable time.Time
func (NullTime) MarshalJSON ¶
MarshalJSON interface redefinition
type RowMapper ¶ added in v0.9.0
RowMapper is responsible for mapping a sql.Rows into a Struct (model)
func NewRowMapper ¶ added in v0.9.0
func NewRowMapper() *RowMapper
NewRowMapper creates a new instance of RowMapper
type Trx ¶
type Trx struct {
// contains filtered or unexported fields
}
Trx represents a Database transaction
func (*Trx) NoLogs ¶ added in v0.14.0
func (trx *Trx) NoLogs()
NoLogs disable logs for this transaction
func (*Trx) QueryIntArray ¶
QueryIntArray executes given SQL command and return first column as int
func (*Trx) ResumeLogs ¶ added in v0.17.0
func (trx *Trx) ResumeLogs()
ResumeLogs resume logs for this transaction
type TypeMapper ¶ added in v0.9.0
TypeMapper holds information about how to map SQL ResultSet to a Struct
func NewTypeMapper ¶ added in v0.9.0
func NewTypeMapper(t reflect.Type) TypeMapper
NewTypeMapper creates a new instance of TypeMapper for given reflect.Type