sqlcmd

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SqlNullString

func SqlNullString(value string) sql.NullString

Types

type Cnd

type Cnd struct {
	SelectCols []string     // 要查询的字段,如果为空,表示查询所有字段
	Params     []ParamPair  // 参数
	Orders     []OrderByCol // 排序
	Paging     *Paging      // 分页
}

func NewCnd

func NewCnd() *Cnd

func (*Cnd) Asc

func (s *Cnd) Asc(column string) *Cnd

func (*Cnd) Build

func (s *Cnd) Build(db *gorm.DB) *gorm.DB

func (*Cnd) Cols

func (s *Cnd) Cols(selectCols ...string) *Cnd

func (*Cnd) Count

func (s *Cnd) Count(db *gorm.DB, model interface{}) int64

func (*Cnd) Desc

func (s *Cnd) Desc(column string) *Cnd

func (*Cnd) Ending

func (s *Cnd) Ending(column string, str string) *Cnd

func (*Cnd) Eq

func (s *Cnd) Eq(column string, args ...interface{}) *Cnd

func (*Cnd) Find

func (s *Cnd) Find(db *gorm.DB, out interface{})

func (*Cnd) FindOne

func (s *Cnd) FindOne(db *gorm.DB, out interface{}) error

func (*Cnd) Gt

func (s *Cnd) Gt(column string, args ...interface{}) *Cnd

func (*Cnd) Gte

func (s *Cnd) Gte(column string, args ...interface{}) *Cnd

func (*Cnd) In

func (s *Cnd) In(column string, params interface{}) *Cnd

func (*Cnd) Like

func (s *Cnd) Like(column string, str string) *Cnd

func (*Cnd) Limit

func (s *Cnd) Limit(limit int) *Cnd

func (*Cnd) Lt

func (s *Cnd) Lt(column string, args ...interface{}) *Cnd

func (*Cnd) Lte

func (s *Cnd) Lte(column string, args ...interface{}) *Cnd

func (*Cnd) NotEq

func (s *Cnd) NotEq(column string, args ...interface{}) *Cnd

func (*Cnd) NotIn

func (s *Cnd) NotIn(column string, params interface{}) *Cnd

func (*Cnd) Page

func (s *Cnd) Page(page, limit int) *Cnd

func (*Cnd) Starting

func (s *Cnd) Starting(column string, str string) *Cnd

func (*Cnd) Where

func (s *Cnd) Where(query string, args ...interface{}) *Cnd

type CursorResult

type CursorResult struct {
	Results interface{} `json:"results"` // 数据
	Cursor  string      `json:"cursor"`  // 下一页
	HasMore bool        `json:"hasMore"` // 是否还有数据
}

CursorResult Cursor分页返回数据

type OrderByCol

type OrderByCol struct {
	Column string // 排序字段
	Asc    bool   // 是否正序
}

OrderByCol 排序信息

type PageResult

type PageResult struct {
	Page    *Paging     `json:"page"`    // 分页信息
	Results interface{} `json:"results"` // 数据
}

PageResult 分页返回数据

type Paging

type Paging struct {
	Page  int   `json:"page"`  // 页码
	Limit int   `json:"limit"` // 每页条数
	Total int64 `json:"total"` // 总数据条数
}

Paging 分页请求数据

func (*Paging) Offset

func (p *Paging) Offset() int

func (*Paging) TotalPage

func (p *Paging) TotalPage() int

type ParamPair

type ParamPair struct {
	Query string        // 查询
	Args  []interface{} // 参数
}

Jump to

Keyboard shortcuts

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