v1.0.8 Latest Latest

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 9 Imported by: 0




View Source
const BasicDateFormat = "2006-01-02"

BasicDateFormat for time format layout

View Source
const BasicDatetimeFormat = "2006-01-02 15:04:05"

BasicDatetimeFormat for time format layout

View Source
const DefaultPage = 1

DefaultPage value

View Source
const DefaultPageSize = 10

DefaultPageSize value

View Source
const MaxPage = 100

MaxPage limit

View Source
const MaxPageSize = 1000

MaxPageSize limit

View Source
const StatusActive = 1

StatusActive for data status active

View Source
const StatusDelete = 0

StatusDelete for data status delete

View Source
const StatusDisable = 4

StatusDisable for data status disabled

View Source
const StatusInitialize = 0

StatusInitialize for data status init


View Source
var MySQL *xorm.Engine

MySQL client in global

View Source
var Redis *redis.Pool

Redis client in global


func Delete

func Delete(sqlOrArgs ...interface{}) (int64, error)

func ExecuteSQL

func ExecuteSQL(sqlOrArgs ...interface{}) (int64, error)

ExecuteSQL TL;DR return affected count

func GetMySQLClient

func GetMySQLClient(c conf.MySQLConfig) *xorm.Engine

GetMySQLClient init connection once

func GetRedisClient

func GetRedisClient(c conf.RedisConfig) *redis.Pool

GetRedisClient of redis pool

func InitClient

func InitClient()

InitClient db connections call this func after conf.Config loaded after InitClient success, db.Redis / db.MySQL can use in global context

func Insert

func Insert(sqlOrArgs ...interface{}) (int64, error)

func Update

func Update(sqlOrArgs ...interface{}) (int64, error)


This section is empty.

Jump to

Keyboard shortcuts

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