mquery

package module
v0.0.0-...-aa5637e Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distinct

func Distinct(col interface{}) string

func Max

func Max(col interface{}) string

func NULL

func NULL() string

func Now

func Now() string

Types

type ConditionOption

type ConditionOption func(c *conditionQuery)

func And

func And(field interface{}, ops Operator, value ...interface{}) ConditionOption

func In

func In(selectIn []interface{}, col ...interface{}) ConditionOption

func Like

func Like(column interface{}, value interface{}) ConditionOption

func Or

func Or(field interface{}, ops Operator, value ...interface{}) ConditionOption

func Pair

func Pair(isAnd bool, field []interface{}, value ...interface{}) ConditionOption

type FromOption

type FromOption func(fo *fromQueryBuild)

func FromAs

func FromAs(query string, as interface{}) FromOption

type FromQuery

type FromQuery interface {
	From(...FromOption) WhereQuery
}

type InsertOption

type InsertOption func(i *insert)

func NotCheckFieldInsert

func NotCheckFieldInsert() InsertOption

func OnDuplicate

func OnDuplicate(listValue map[interface{}]interface{}) InsertOption

func WithField

func WithField(field ...interface{}) InsertOption

func WithIgnore

func WithIgnore() InsertOption

func WithValues

func WithValues(rows int64) InsertOption

type Operator

type Operator string
const (
	EqualOps            Operator = "="
	LessOps             Operator = "<"
	GreaterOps          Operator = ">"
	LessThanEqualOps    Operator = "<="
	GreaterThanEqualOps Operator = ">="
	NotEqualOps         Operator = "<>"
)

type OrderByMode

type OrderByMode string
const (
	ASC  OrderByMode = "ASC"
	DESC OrderByMode = "DESC"
)

type QueryBuild

type QueryBuild interface {
	Insert(opts ...InsertOption) toQuery
	Select(opts ...SelectOption) FromQuery
	Update(opts ...UpdateOption) WhereQuery
	Delete(opts ...WhereOption) toQuery
}

func NewQueryBuilder

func NewQueryBuilder(tableName string, options ...TableOption) QueryBuild

type SelectOption

type SelectOption func(sq *selectQueryBuild)

func Count

func Count() SelectOption

func ForUpdate

func ForUpdate() SelectOption

func NotCheckField

func NotCheckField() SelectOption

func SelectAll

func SelectAll() SelectOption

func SelectAs

func SelectAs(column, as string) SelectOption

func SelectField

func SelectField(list ...interface{}) SelectOption

type TableOption

type TableOption func(q *tableQuery)

func Column

func Column(value ...interface{}) TableOption

func WithLogger

func WithLogger(l *logrus.Entry) TableOption

type UpdateOption

type UpdateOption func(uq *updateQueryBuild)

func NotCheckFieldUpdate

func NotCheckFieldUpdate() UpdateOption

func UpdateField

func UpdateField(colName interface{}, value interface{}) UpdateOption

type WhereOption

type WhereOption func(wb *whereQueryBuild)

func Condition

func Condition(conOpt ...ConditionOption) WhereOption

func GroupBy

func GroupBy(colName string) WhereOption

func Having

func Having(colName string, conOpt ...ConditionOption) WhereOption

func Limit

func Limit(offset, size int64) WhereOption

func OrderBy

func OrderBy(colName string, mode OrderByMode) WhereOption

type WhereQuery

type WhereQuery interface {
	Where(...WhereOption) toQuery
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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