repos

package
v1.10.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IN        = "IN"
	NotIN     = "NOT IN"
	BETWEEN   = "BETWEEN"
	LIKE      = "LIKE"
	IsNULL    = "IS NULL"
	IsNotNULL = "IS NOT NULL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Delete added in v1.9.5

type Delete struct {
	Model  interface{}
	Wheres Wheres
}

type IBasicRepository

type IBasicRepository interface {
	IRepository
	ITxRepository
}

IBasicRepository 基础查询与事务

type IRepository

type IRepository interface {
	Get(*Query) error
	Find(*Query) error
	Create(interface{}) error
	CreateInTx(context.Context, interface{}) error
	Update(*Update) error
	UpdateInTx(context.Context, *Update) error
	UpdateColumn(*Update) error
	UpdateColumnInTx(context.Context, *Update) error
	Delete(*Delete) error
	DeleteInTx(context.Context, *Delete) error
}

IRepository 基础查询

type ITxRepository

type ITxRepository interface {
	Tx(context.Context, func(context.Context) error) error
	GetTx(context.Context) (interface{}, error)
}

ITxRepository 事务

type Query added in v1.9.5

type Query struct {
	Model          interface{} // 查询的模型
	Wheres         Wheres      // 查询条件
	Recipient      interface{} // 查询结果保存的对象
	OrderBy        string      // 排序条件
	IgnoreNotFound bool        // 是否过滤未找到数据的错误
	Num, Size      int         // 分页页码, 单页大小
	Total          *int64      // 总数
}

type TxKey

type TxKey struct{}

type Update added in v1.9.5

type Update struct {
	Model   interface{}            // 修改对应的模型
	Wheres  Wheres                 // 修改的过滤条件
	Update  interface{}            // 修改的结构体值, 修改整体值时使用
	Fields  map[string]interface{} // 修改的map值, 用于修改单个或多个字段时使用
	SaveNil bool                   // 是否保存空值, 默认不会更新类似 0,false,"" 等值
	Omits   []string               // 修改时指定不更新的字段
}

type Where added in v1.9.5

type Where struct {
	Column    string
	Condition string
	V1        interface{}
	V2        interface{}
	Or        bool
}

func Between added in v1.9.5

func Between(column string, v1, v2 interface{}) *Where

func Eq added in v1.9.5

func Eq(column string, value interface{}) *Where

func Gt added in v1.9.5

func Gt(column string, value interface{}) *Where

func Gte added in v1.9.5

func Gte(column string, value interface{}) *Where

func In added in v1.9.5

func In(column string, value interface{}) *Where

func IsNotNull added in v1.9.5

func IsNotNull(column string) *Where

func IsNull added in v1.9.5

func IsNull(column string) *Where

func Like added in v1.9.5

func Like(column string, value interface{}) *Where

func Lt added in v1.9.5

func Lt(column string, value interface{}) *Where

func Lte added in v1.9.5

func Lte(column string, value interface{}) *Where

func Ne added in v1.9.5

func Ne(column string, value interface{}) *Where

func NotIn added in v1.9.5

func NotIn(column string, value interface{}) *Where

func (*Where) Build added in v1.9.5

func (w *Where) Build() (string, []interface{})

type Wheres added in v1.9.5

type Wheres []*Where

func NewWheres added in v1.9.5

func NewWheres() Wheres

func (Wheres) And added in v1.9.5

func (w Wheres) And(wheres ...*Where) Wheres

func (Wheres) Or added in v1.9.5

func (w Wheres) Or(wheres ...*Where) Wheres

Jump to

Keyboard shortcuts

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