dao

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidTransactionError = errors.New("invalid transaction, it is already committed or roll backed")

Functions

func GetProject

func GetProject(tx *TX, options ...Option) (*model.ErdaProject, bool, error)

func Init

func Init(db *gorm.DB)

func NotSoftDeleted

func NotSoftDeleted(db *gorm.DB) *gorm.DB

func Value

func Value(value interface{}) whereValue

Types

type Column

type Column interface {
	WhereColumn
	OrderColumn
	SetColumn
}

func Col

func Col(col string) Column

type Option

type Option func(db *gorm.DB) *gorm.DB

func OrderBy

func OrderBy(col string, order Order) Option

func Paging

func Paging(size, no int) Option

func Where

func Where(format string, args ...interface{}) Option

func Wheres

func Wheres(m interface{}) Option

type Order

type Order string
var (
	DESC Order = "DESC"
	ASC  Order = "ASC"
)

type OrderColumn

type OrderColumn interface {
	DESC() Option
	ASC() Option
}

type SetColumn

type SetColumn interface {
	Set(value interface{}) Option
}

type TX

type TX struct {
	Error error
	// contains filtered or unexported fields
}

func Begin

func Begin() *TX

func Q

func Q() *TX

func (*TX) CommitOrRollback

func (tx *TX) CommitOrRollback()

func (*TX) Create

func (tx *TX) Create(i interface{}) error

func (*TX) CreateInBatches

func (tx *TX) CreateInBatches(i interface{}, size int) error

func (*TX) DB

func (tx *TX) DB() *gorm.DB

func (*TX) Delete

func (tx *TX) Delete(i interface{}, options ...Option) error

func (*TX) Get

func (tx *TX) Get(i interface{}, options ...Option) (bool, error)

func (*TX) List

func (tx *TX) List(i interface{}, options ...Option) (int64, error)

func (*TX) UpdateColumns

func (tx *TX) UpdateColumns(i interface{}, options ...Option) error

func (*TX) Updates

func (tx *TX) Updates(i, v interface{}, options ...Option) error

type WhereColumn

type WhereColumn interface {
	Is(value interface{}) Option
	In(values ...interface{}) Option
	InMap(values map[interface{}]struct{}) Option
	Like(value interface{}) Option
	GreaterThan(value interface{}) Option
	EqGreaterThan(value interface{}) Option
	LessThan(value interface{}) Option
	EqLessThan(value interface{}) Option
}

type WhereValue

type WhereValue interface {
	In(cols ...string) Option
}

Jump to

Keyboard shortcuts

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