query

package
v1.2.19 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Or  = `OR`
	And = `AND`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition interface {
	Opt() (opt string)
	Sql(args *[]interface{}) (sql string)
}

Condition 条件

func AndCondition

func AndCondition(fields FieldMap) Condition

AndCondition And条件

func OrCondition

func OrCondition(fields FieldMap) Condition

OrCondition Or条件

type FieldMap

type FieldMap map[string][]interface{}

FieldMap 列条件

type Query

type Query interface {
	// Select Select表达式
	Select(columns ...string) Query
	// From From表达式
	From(table string) Query
	// Where Where表达式
	Where(where Where) Query
	// And 附加And where
	And(condition Condition) Query
	// Or 附加Or where
	Or(condition Condition) Query
	// Group Group表达式
	Group(fields ...string) Query
	// Having Having表达式
	Having(having string) Query
	// Order Order表达式
	Order(orders ...string) Query
	// Offset Offset表达式
	Offset(offset int64) Query
	// Limit Limit表达式
	Limit(limit int64) Query
	// Sql 生成sql
	Sql(arguments *[]interface{}) (sql string)
	// Close 释放Query
	Close()
}

Query Query对象

func Acquire4Mysql

func Acquire4Mysql() Query

Acquire4Mysql 获取mysqlQuery对象

type Where

type Where interface {
	HasWhere() bool
	And(condition Condition) Where
	Or(condition Condition) Where
	Sql(args *[]interface{}) (sql string)
	Reset()
}

Where Where对象

func AndWhere

func AndWhere(fm FieldMap) Where

AndWhere 实例化And条件Where

func NewWhere

func NewWhere(condition Condition) Where

NewWhere 实例化Where

func OrWhere

func OrWhere(fm FieldMap) Where

OrWhere 实例化Or条件Where

Jump to

Keyboard shortcuts

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