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

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