Documentation ¶
Index ¶
- Variables
- type Query
- type Storage
- func (p *Storage) BatchInsert(baseSql string, valueFmt string, batchSize int, values [][]interface{}) error
- func (p *Storage) Close()
- func (p *Storage) Delete(dbType interface{}, params map[string]string) (rowsAffected int64, err error)
- func (p *Storage) GetLastID(table string, primaryName string) (uint, error)
- func (p *Storage) RawScan(baseSql string, conditionAndLimitPart string, scan func(rows *sql.Rows) error, ...) error
- func (p *Storage) SaveOrCreate(params map[string]string, data interface{}) error
- func (p *Storage) Search(dbType interface{}, params map[string]string, needCount bool, ...) (int, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Storage ¶
func NewStorage ¶
func (*Storage) BatchInsert ¶ added in v0.0.5
func (*Storage) GetLastID ¶ added in v0.0.5
GetLastID: get table last primary id by table and primaryName
func (*Storage) RawScan ¶ added in v0.0.4
func (p *Storage) RawScan(baseSql string, conditionAndLimitPart string, scan func(rows *sql.Rows) error, values ...interface{}) error
RawScan this method can execute raw sql and use the scan function to scan rows this can package many are easy to overlook operations, like close. baseSql: the main sql body, provide query logic. conditionAndLimitPart: the sql condition body and limit part. scan: this revoke function to scan result rows. values: the values to replace sql placeholders
func (*Storage) SaveOrCreate ¶
Click to show internal directories.
Click to hide internal directories.