servicex

package
v0.0.0-...-62a34bc Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDup

func CheckDup(db *gorm.DB, model any, msg string) error

func Get

func Get(db *gorm.DB, id uint, model any, msg string) error

func GetEx

func GetEx(db *gorm.DB, model any, msg string) error

Types

type Criteria

type Criteria[T ITableNamerModel] struct {
	Db *gorm.DB
	// contains filtered or unexported fields
}

func NewCriteria

func NewCriteria[T ITableNamerModel](db *gorm.DB, model T) *Criteria[T]

func (*Criteria[T]) Compile

func (c *Criteria[T]) Compile(limit, offset int) (*gorm.DB, *gorm.DB)

func (*Criteria[T]) WhereDate

func (c *Criteria[T]) WhereDate(key string, date *time.Time)

func (*Criteria[T]) WhereId

func (c *Criteria[T]) WhereId(key string, id uint)

func (*Criteria[T]) WhereIds

func (c *Criteria[T]) WhereIds(key string, ids []uint)

func (*Criteria[T]) WhereM2MId

func (c *Criteria[T]) WhereM2MId(joint T, jointKey, jointAssoKey string, jointAssoId uint)

func (*Criteria[T]) WhereNonIds

func (c *Criteria[T]) WhereNonIds(key string, ids []uint)

func (*Criteria[T]) WhereString

func (c *Criteria[T]) WhereString(key, s string)

func (*Criteria[T]) WhereStringFrag

func (c *Criteria[T]) WhereStringFrag(key, s string)

type IResponserModel

type IResponserModel interface {
	Resp() map[string]any
}

type ITableNamerModel

type ITableNamerModel interface {
	TableName() string
}

type ListResp

type ListResp struct {
	List  []map[string]any `json:"list"`
	Total int64            `json:"total"`
}

func List

func List[T IResponserModel](models *[]T, dbList, dbTotal *gorm.DB) (*ListResp, error)

Jump to

Keyboard shortcuts

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