Documentation ¶
Index ¶
- type Basesql
- func (bs *Basesql) Begin() error
- func (bs *Basesql) Close()
- func (bs *Basesql) Commit() error
- func (bs *Basesql) Count(table string, where []database.Where) (int, error)
- func (bs *Basesql) Delete(table string, where []database.Where) (sql.Result, error)
- func (bs *Basesql) Init(dbname string, cfg *viper.Viper, logger *zap.Logger) error
- func (bs *Basesql) InitTables(tables, indexs []string) error
- func (bs *Basesql) Insert(table string, feilds []database.Feild) (sql.Result, error)
- func (bs *Basesql) Replace(table string, feilds []database.Feild) (sql.Result, error)
- func (bs *Basesql) Rollback() error
- func (bs *Basesql) SelectRows(table string, where []database.Where, order *database.Order, ...) error
- func (bs *Basesql) SelectRowsOffset(table string, where []database.Where, order *database.Order, ...) error
- func (bs *Basesql) Update(table string, toupdate []database.Feild, where []database.Where) (sql.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Basesql ¶
type Basesql struct {
// contains filtered or unexported fields
}
Basesql sql-like database
is not goroutine-safe
func (*Basesql) InitTables ¶
InitTables create tables and indexs if not exists
func (*Basesql) SelectRows ¶
func (bs *Basesql) SelectRows(table string, where []database.Where, order *database.Order, paging *database.Paging, result interface{}) error
SelectRows select rows to struct slice, using "xxx > xxx" as paging method
Click to show internal directories.
Click to hide internal directories.