query

package
v0.0.0-...-05d1b2a Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func BatchInsertSize

func BatchInsertSize(n int) Option

func Group

func Group(s string) Option

func HardDelete

func HardDelete() Option

func Having

func Having(s string) Option

func Join

func Join(s string) Option

func Limit

func Limit(n int) Option

func Offset

func Offset(n int) Option

func Order

func Order(s string) Option

func Select

func Select(s string) Option

func Table

func Table(t schema.Tabler) Option

func Where

func Where(condition string, value ...any) Option

type Options

type Options struct {
	Table           schema.Tabler
	BatchInsertSize int
	Select          string
	Where           [][]any
	Group           string
	Order           string
	Join            string
	Having          string
	Offset          int
	Limit           int
	HardDelete      bool
}

type Query

type Query interface {
	GetDB() *gorm.DB
	SetDB(db *gorm.DB)
	Transaction(func(tx *gorm.DB) error) error
	Save(row schema.Tabler) error
	Create(newRow schema.Tabler) error
	BatchInsert(table schema.Tabler, newRows any, opts ...Option) error
	FindOneByWhere(rows any, opts ...Option) error
	FindByWhere(rows any, opts ...Option) error
	ScanByWhere(table schema.Tabler, row any, opts ...Option) error // 用于自定义结构体
	DeleteByWhere(table schema.Tabler, opts ...Option) error
	UpdateByWhere(newRow any, opts ...Option) error
	CountByWhere(table schema.Tabler, count *int64, opts ...Option) error
	SearchAll(table schema.Tabler, total *int64, list any, page, limit int, opt ...Option) error
}

func New

func New(db *gorm.DB) Query

Jump to

Keyboard shortcuts

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