db

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var MySQL *xorm.Engine

MySQL client in global

View Source
var Redis *redis.Pool

Redis client in global

Functions

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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