Documentation ¶
Index ¶
- type Basesql
- func (bs *Basesql) Begin() error
- func (bs *Basesql) Close()
- func (bs *Basesql) Commit() error
- func (bs *Basesql) Delete(table string, where []database.Where) (sql.Result, error)
- func (bs *Basesql) Excute(stmt *sql.Stmt, fields []database.Feild) (sql.Result, error)
- func (bs *Basesql) GetInitSQLs() (qt, qi []string)
- func (bs *Basesql) Init(dbname string, cfg *config.Config, logger *zap.Logger) error
- func (bs *Basesql) Insert(table string, fields []database.Feild) (sql.Result, error)
- func (bs *Basesql) Prepare(table string, fields []database.Feild) (*sql.Stmt, error)
- func (bs *Basesql) PrepareTables(ctsqls, cisqls []string) error
- func (bs *Basesql) Rollback() error
- func (bs *Basesql) SelectRawSQL(table string, sqlStr string, values []interface{}, result interface{}) 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) SelectRowsUnion(table string, wheres [][]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) GetInitSQLs ¶
GetInitSQLs get database initialize sqls
qt sqls to create query tables qi sqls to create query table-indexs
func (*Basesql) PrepareTables ¶
PrepareTables create tables if not exists
func (*Basesql) SelectRawSQL ¶
func (bs *Basesql) SelectRawSQL(table string, sqlStr string, values []interface{}, result interface{}) error
SelectRawSQL query useing raw sql
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
func (*Basesql) SelectRowsOffset ¶
func (bs *Basesql) SelectRowsOffset(table string, where []database.Where, order *database.Order, offset, limit uint64, result interface{}) error
SelectRowsOffset select rows to struct slice
func (*Basesql) SelectRowsUnion ¶
Click to show internal directories.
Click to hide internal directories.