gormh

package
v0.0.0-...-ce5851c Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFilters

func ApplyFilters(queryBuilder interface{}, db *gorm.DB) *gorm.DB

apply query builder inner filters that implement GORMFilter

func UpdateModels

func UpdateModels(db *gorm.DB, updateModel interface{}, updateModels []interface{}, allowFields ...string) error

UpdateModels update models with update data mapping

Types

type DataModel

type DataModel interface {
	DeleteById(id uint) error
	UpdateById(id uint, values map[string]interface{}) (interface{}, error)
}

type DefaultPageFilter

type DefaultPageFilter struct {
	Page     int
	PageSize int
}

func (*DefaultPageFilter) GetLimit

func (b *DefaultPageFilter) GetLimit() int

func (*DefaultPageFilter) GetOffset

func (b *DefaultPageFilter) GetOffset() int

func (*DefaultPageFilter) SetPageFilter

func (b *DefaultPageFilter) SetPageFilter(page int, pageSize int)

type GORMFilter

type GORMFilter interface {
	ApplyQuery(db *gorm.DB) *gorm.DB
}

type IdQueryFilter

type IdQueryFilter struct {
	Ids []interface{}
}

Ids filter

func (IdQueryFilter) ApplyQuery

func (f IdQueryFilter) ApplyQuery(db *gorm.DB) *gorm.DB

func (*IdQueryFilter) InId

func (f *IdQueryFilter) InId(ids ...interface{})

type ModelsReader

type ModelsReader interface {
	ReadModels() (int64, interface{}, error)
}

read models from database

type OrderQueryFilter

type OrderQueryFilter struct {
	Order string
}

order filter

func (OrderQueryFilter) ApplyQuery

func (f OrderQueryFilter) ApplyQuery(db *gorm.DB) *gorm.DB

func (*OrderQueryFilter) SetOrderFilter

func (f *OrderQueryFilter) SetOrderFilter(order string)

type PageFilter

type PageFilter interface {
	SetPageFilter(page int, pageSize int)
	GetOffset() int
	GetLimit() int
}

Jump to

Keyboard shortcuts

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