db

package
v0.0.0-...-b1f09d4 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter(where []*QueryCondition) *xorm.Session

func FilterWhereAnd

func FilterWhereAnd(db *Db, i int, key string, value ...interface{})

func SqlMapFile

func SqlMapFile(directory, extension string) *xorm.XmlSqlMap

sql map XML文件

Types

type Db

type Db struct {
	Engine        *xorm.Engine
	FilterSession *xorm.Session
}

结构体

func DB

func DB() *Db

快捷调研

type Paginator

type Paginator struct {
	Page        int   //当前页		`json:"page"`
	Pages       []int //页码数组		`json:"pages"`
	PageSize    int   //每页条数
	TotalPage   int   //总页码
	TotalCount  int   //总条数
	FirstPage   int   //上一页
	FirstPageIs bool
	LastPageIs  bool          //
	LastPage    int           //尾页
	NextPageIs  bool          //
	NextPage    int           //下一页
	Data        []interface{} `json:"data"`
	OtherData   map[string]interface{}
	Offset      int
}

分页

func Pagination

func Pagination(count int, page int, pageSize int) *Paginator

分页 总数,当前页,每页条数

type QueryCondition

type QueryCondition struct {
	Field     string      //字段
	Operation string      //操作 =,!=,>,<,>=,<=,in,not in
	Condition interface{} //具体值
}

查询条件

func AddQueryCondition

func AddQueryCondition(field, operation string, condition interface{}) *QueryCondition

添加条件

func NewMakeQueryCondition

func NewMakeQueryCondition() []*QueryCondition

type QuerySession

type QuerySession struct {
	Session *xorm.Session
}
var Query *QuerySession

Jump to

Keyboard shortcuts

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