golug_db

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Name = "db"

Functions

func Get

func Get(names ...string) *xorm.Engine

func GetCfg

func GetCfg() (cfg map[string]Cfg)

func Insert

func Insert(db *xorm.Session, beans ...interface{}) (err error)

func InsertOne

func InsertOne(db *xorm.Session, task interface{}) (err error)

func List

func List() (dt map[string]*xorm.Engine)

func NextPage

func NextPage(page, perPage, total int64) (int64, int64)

func Random

func Random(db *xorm.Session, data interface{}, n int, table string) (err error)

func Range

func Range(db *xorm.Session, data interface{}, page, perPage int, where string, a ...interface{}) (_ int64, err error)

func UpdateById

func UpdateById(db *xorm.Session, task map[string]interface{}, names ...string) error

Types

type Cfg

type Cfg struct {
	Driver      string        `json:"driver" yaml:"driver"`
	Source      string        `json:"source" yaml:"source"`
	MaxConnTime time.Duration `json:"max_conn_time" yaml:"max_conn_time"`
	MaxConnIdle int           `json:"max_conn_idle" yaml:"max_conn_idle"`
	MaxConnOpen int           `json:"max_conn_open" yaml:"max_conn_open"`
	Mapper      names.Mapper  `json:"-" yaml:"-"`
}

func GetDefaultCfg

func GetDefaultCfg() Cfg

type JsonTime

type JsonTime struct {
	time.Time
}

func (JsonTime) MarshalJSON

func (j JsonTime) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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