Documentation ¶
Index ¶
- type DB
- func (d *DB) Close() error
- func (d *DB) CreateTableIfNotExists(i interface{}, name string)
- func (d *DB) CreateTableIndex(table, idx string, unique bool, columns ...string)
- func (d *DB) DeleteByPK(table string, pk M) (int64, error)
- func (d *DB) DeleteByPKWithTran(tran *gorp.Transaction, table string, pk M) (int64, error)
- func (d *DB) DeleteSQL(table string, pk M) (string, []interface{})
- func (d *DB) In(query string, args ...interface{}) (string, []interface{}, error)
- func (d *DB) InsertM(table string, info M) (int64, error)
- func (d *DB) InsertMWithTran(tran *gorp.Transaction, table string, info M) (int64, error)
- func (d *DB) InsertSQL(table string, info M) (string, []interface{})
- func (d *DB) UpdateByPK(table string, pk, info M) (int64, error)
- func (d *DB) UpdateByPKWithTran(tran *gorp.Transaction, table string, pk, info M) (int64, error)
- func (d *DB) UpdateSQL(table string, pk, info M) (string, []interface{})
- type Logger
- type M
- type Option
- func SetDSN(dsn string) Option
- func SetEncoding(encoding string) Option
- func SetEngine(engine string) Option
- func SetLogger(logger Logger) Option
- func SetMaxIdleConns(maxIdleConns int) Option
- func SetMaxLifetime(maxLifetime time.Duration) Option
- func SetMaxOpenConns(maxOpenConns int) Option
- func SetTrace(t bool) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { *gorp.DbMap // contains filtered or unexported fields }
DB 数据库管理
func (*DB) CreateTableIfNotExists ¶
CreateTableIfNotExists 创建表
func (*DB) CreateTableIndex ¶
CreateTableIndex 创建索引
func (*DB) DeleteByPKWithTran ¶
DeleteByPKWithTran 基于事物删除表数据
func (*DB) InsertMWithTran ¶
InsertMWithTran 基于事物插入数据
func (*DB) UpdateByPK ¶
UpdateByPK 更新数据
func (*DB) UpdateByPKWithTran ¶
UpdateByPKWithTran 基于事物更新数据
type Option ¶
type Option func(*options)
Option 配置项
func SetMaxLifetime ¶
SetMaxLifetime 设置连接可以被重新使用的最大时间量
func SetMaxOpenConns ¶
SetMaxOpenConns 设置打开连接到数据库的最大数量
Click to show internal directories.
Click to hide internal directories.