dao

package
v0.0.0-...-0c396f5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Db *mysql.DB
View Source
var RC *cache.RC

Functions

func Begin

func Begin() (*mysql.Tx, error)

func ClearCache

func ClearCache(tablename string, id interface{})

func ClearCacheByIDs

func ClearCacheByIDs(tableName string, ids ...interface{})

func ClearListCache

func ClearListCache(tablename string)

func ClearOneCache

func ClearOneCache(tablename string, id interface{})

func Count

func Count(table string, q *qs.QuerySet) (num int)

func CountCache

func CountCache(tablename string, q *qs.QuerySet) int

CountCache 将count存入缓存

func Countsql

func Countsql(sql string, q *qs.QuerySet) (num int)

func CountsqlC

func CountsqlC(sql string, params ...interface{}) (num int)

func Exec

func Exec(sql string, params ...interface{}) (sql.Result, error)

func Find

func Find(q *qs.QuerySet, obj interface{}) (err error)

func FindByID

func FindByID(id interface{}, obj interface{}) (err error)

func FindByIDCache

func FindByIDCache(id interface{}, obj interface{}) (err error)

func FindByKey

func FindByKey(key string, value interface{}, obj interface{}) (err error)

func FindCustom

func FindCustom(sql string, q *qs.QuerySet, obj interface{}) (err error)

func Finds

func Finds(q *qs.QuerySet, obj interface{}) (err error)

func FindsByTableName

func FindsByTableName(q *qs.QuerySet, obj interface{}, tableName string) (err error)

func FindsCache

func FindsCache(q *qs.QuerySet, obj interface{}) (err error)

func FindsCacheByTableName

func FindsCacheByTableName(q *qs.QuerySet, obj interface{}, tableName string) (err error)

func FindsCacheCustom

func FindsCacheCustom(sql string, q *qs.QuerySet, obj interface{}) (err error)

func GetCacheKey

func GetCacheKey(table, suffix string, id interface{}) string

func GetTableName

func GetTableName(t reflect.Type) string

func Init

func Init()

Init load DB

func Insert

func Insert(res interface{}) (int64, error)

func InsertOrUpdate

func InsertOrUpdate(res interface{}) (int64, error)

func Query

func Query(sql string, params ...interface{}) (*sql.Rows, error)

func QueryByQs

func QueryByQs(sql string, q *qs.QuerySet, data interface{}) error

func StatusChange

func StatusChange(table string, id, version interface{}, key, status string) error

func StatusChangeShop

func StatusChangeShop(table string, id, version, shopid interface{}, key, status string) error

func Sum

func Sum(table, key string, q *qs.QuerySet) (sumnum float64)

func SumSql

func SumSql(sql string, q *qs.QuerySet) (sumnum float64)

func SumSqlC

func SumSqlC(sql string, params ...interface{}) (sumnum float64)

func Update

func Update(res interface{}) (int64, error)

Types

type Time

type Time struct{}

func (*Time) Decode

func (wt *Time) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator)

func (*Time) Encode

func (wt *Time) Encode(ptr unsafe.Pointer, stream *jsoniter.Stream)

func (*Time) IsEmpty

func (wt *Time) IsEmpty(ptr unsafe.Pointer) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL