sqlc

package
v1.0.67 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: Apache-2.0 Imports: 1 Imported by: 8

Documentation

Index

Constants

View Source
const (
	EQ_ = iota
	NOT_EQ_
	LT_
	LTE_
	GT_
	GTE_
	IS_NULL_
	IS_NOT_NULL_
	BETWEEN_
	NOT_BETWEEN_
	IN_
	NOT_IN_
	LIKE_
	NO_TLIKE_
	OR_
	ORDER_BY_
	ASC_
	DESC_
	LEFT_
	RIGHT_
	INNER_
	SUM_
	AVG_
	MIN_
	MAX_
	CNT_
)

数据库操作类型枚举

Variables

View Source
var (
	Id     = "Id"
	Ignore = "ignore"
	Bson   = "bson"
	Json   = "json"
	Mg     = "mg"
	True   = "true"
	BsonId = "id"
	Date   = "date"
)

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	Open   bool
	Prefix string
	Key    string
	Expire int
}

缓存结果集参数

type Cnd

type Cnd struct {
	Conditions  []Condition
	AnyFields   []string
	Distincts   []string
	Groupbys    []string
	Orderbys    []Condition
	Summaries   map[string]int
	UpdateKV    map[string]interface{}
	Model       interface{}
	Pagination  dialect.Dialect
	FromCond    FromCond
	JoinCond    []JoinCond
	CacheConfig CacheConfig
	Aggregates  []Condition
}

数据库操作汇总逻辑条件对象

func M

func M(model interface{}) *Cnd

args[0]=对象类型 args[1]=数据表别名

func (*Cnd) Agg added in v1.0.58

func (self *Cnd) Agg(logic int, key string, alias ...string) *Cnd

聚合函数

func (*Cnd) Between

func (self *Cnd) Between(key string, value1 interface{}, value2 interface{}) *Cnd

between

func (*Cnd) Cache

func (self *Cnd) Cache(config CacheConfig) *Cnd

缓存指定结果集

func (*Cnd) Distinct

func (self *Cnd) Distinct(keys ...string) *Cnd

筛选字段去重

func (*Cnd) Eq

func (self *Cnd) Eq(key string, value interface{}) *Cnd

=

func (*Cnd) Fields

func (self *Cnd) Fields(keys ...string) *Cnd

筛选指定字段查询

func (*Cnd) From

func (self *Cnd) From(fromTable string) *Cnd

复杂查询设定首个from table as

func (*Cnd) Groupby

func (self *Cnd) Groupby(keys ...string) *Cnd

按字段分组

func (*Cnd) Gt

func (self *Cnd) Gt(key string, value interface{}) *Cnd

>

func (*Cnd) Gte

func (self *Cnd) Gte(key string, value interface{}) *Cnd

>=

func (*Cnd) In

func (self *Cnd) In(key string, values ...interface{}) *Cnd

in

func (*Cnd) IsNotNull

func (self *Cnd) IsNotNull(key string) *Cnd

is not null

func (*Cnd) IsNull

func (self *Cnd) IsNull(key string) *Cnd

is null

func (*Cnd) Join

func (self *Cnd) Join(join int, table string, on string) *Cnd

left join

func (*Cnd) Like

func (self *Cnd) Like(key string, value interface{}) *Cnd

like

func (*Cnd) Limit

func (self *Cnd) Limit(pageNo int64, pageSize int64) *Cnd

limit,以页数跨度查询

func (*Cnd) Lt

func (self *Cnd) Lt(key string, value interface{}) *Cnd

<

func (*Cnd) Lte

func (self *Cnd) Lte(key string, value interface{}) *Cnd

<=

func (*Cnd) NotBetween

func (self *Cnd) NotBetween(key string, value1 interface{}, value2 interface{}) *Cnd

not between

func (*Cnd) NotEq

func (self *Cnd) NotEq(key string, value interface{}) *Cnd

<>

func (*Cnd) NotIn

func (self *Cnd) NotIn(key string, values ...interface{}) *Cnd

not in

func (*Cnd) NotLike

func (self *Cnd) NotLike(key string, value interface{}) *Cnd

not like

func (*Cnd) Offset

func (self *Cnd) Offset(offset int64, limit int64) *Cnd

offset,以下标跨度查询

func (*Cnd) Or

func (self *Cnd) Or(cnds ...interface{}) *Cnd

or

func (*Cnd) Orderby

func (self *Cnd) Orderby(key string, sortby int) *Cnd

按字段排序

func (*Cnd) Summary added in v1.0.30

func (self *Cnd) Summary(logic int, key string) *Cnd

summary

func (*Cnd) UpdateKeyValue

func (self *Cnd) UpdateKeyValue(keys []string, values ...interface{}) *Cnd

指定更新字段

type Condition

type Condition struct {
	Logic  int
	Key    string
	Value  interface{}
	Values []interface{}
	Alias  string
}

数据库操作逻辑条件对象

type FromCond

type FromCond struct {
	Table string
	Alias string
}

主表条件对象

type JoinCond

type JoinCond struct {
	Type  int
	Table string
	Alias string
	On    string
}

连接表条件对象

Jump to

Keyboard shortcuts

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