db

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Name = "db"

Functions

func Delete added in v0.0.21

func Delete(name string)

func Get

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

func GetCallback added in v0.1.3

func GetCallback(cb func(*xorm.Engine), names ...string)

func Insert

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

func InsertOne

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

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 Update added in v0.0.21

func Update(name string, cfg Cfg) (err error)

func UpdateById

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

Types

type Cfg

type Cfg struct {
	Debug       bool          `json:"debug" yaml:"debug"`
	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

func (Cfg) Build

func (cfg Cfg) Build() (_ *xorm.Engine, err error)

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) Get added in v0.1.2

func (c *Client) Get() *xorm.Engine

type JsonTime

type JsonTime struct {
	time.Time
}

func (JsonTime) MarshalJSON

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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