curd

package
v3.4.25 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: GPL-3.0 Imports: 13 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiClear added in v3.2.8

func ApiClear[T any]() gin.HandlerFunc

func ApiCount added in v3.0.1

func ApiCount[T any]() gin.HandlerFunc

func ApiCreate

func ApiCreate[T any]() gin.HandlerFunc

func ApiCreateHook added in v3.0.10

func ApiCreateHook[T any](before, after func(m *T) error) gin.HandlerFunc

func ApiDelete

func ApiDelete[T any]() gin.HandlerFunc

func ApiDeleteHook added in v3.0.10

func ApiDeleteHook[T any](before, after func(id any) error) gin.HandlerFunc

func ApiDisable

func ApiDisable[T any](disable bool) gin.HandlerFunc

func ApiDisableHook added in v3.0.10

func ApiDisableHook[T any](disable bool, before, after func(id any) error) gin.HandlerFunc

func ApiExport added in v3.0.3

func ApiExport(table, filename string) gin.HandlerFunc

func ApiGet

func ApiGet[T any](fields ...string) gin.HandlerFunc

func ApiGetHook added in v3.0.10

func ApiGetHook[T any](after func(m *T) error, fields ...string) gin.HandlerFunc

func ApiGetMapHook added in v3.0.10

func ApiGetMapHook[T any](after func(m map[string]any) error, fields ...string) gin.HandlerFunc

func ApiImport added in v3.0.3

func ApiImport(table string) gin.HandlerFunc

func ApiList

func ApiList[T any](fields ...string) gin.HandlerFunc

func ApiListHook added in v3.0.10

func ApiListHook[T any](after func(datum []*T) error, fields ...string) gin.HandlerFunc

func ApiListMapHook added in v3.0.10

func ApiListMapHook[T any](after func(datum []map[string]any) error, fields ...string) gin.HandlerFunc

func ApiListWithId

func ApiListWithId[T any](field string, fields ...string) gin.HandlerFunc

func ApiSearch

func ApiSearch[T any](fields ...string) gin.HandlerFunc

func ApiSearchHook added in v3.0.10

func ApiSearchHook[T any](after func(datum []*T) error, fields ...string) gin.HandlerFunc

func ApiSearchMapHook added in v3.0.10

func ApiSearchMapHook[T any](after func(datum []map[string]any) error, fields ...string) gin.HandlerFunc

func ApiSearchWith added in v3.0.10

func ApiSearchWith[T any](join []*Join, fields ...string) gin.HandlerFunc

func ApiSearchWithHook added in v3.0.10

func ApiSearchWithHook[T any](join []*Join, after func(datum []*T) error, fields ...string) gin.HandlerFunc

func ApiUpdate added in v3.0.10

func ApiUpdate[T any](fields ...string) gin.HandlerFunc

func ApiUpdateHook added in v3.0.10

func ApiUpdateHook[T any](before, after func(m *T) error, fields ...string) gin.HandlerFunc

func Error

func Error(ctx *gin.Context, err error)

func Fail

func Fail(ctx *gin.Context, err string)

func GenerateRandomId added in v3.0.2

func GenerateRandomId[T any](l int) func(data *T) error

func GenerateRandomKey

func GenerateRandomKey(l int) func(value interface{}) error

func GenerateUuidKey

func GenerateUuidKey(data interface{}) error

func List

func List(ctx *gin.Context, data interface{}, total int64)

func Noop

func Noop(ctx *gin.Context)

func OK

func OK(ctx *gin.Context, data interface{})

func ParseParamId

func ParseParamId(ctx *gin.Context)

func ParseParamStringId

func ParseParamStringId(ctx *gin.Context)

Types

type Join added in v3.0.10

type Join struct {
	Table        string
	LocaleField  string
	ForeignField string
	Field        string
	As           string
}

type ParamId

type ParamId struct {
	Id int64 `uri:"id"`
}

type ParamList

type ParamList struct {
	Skip  int `form:"skip" json:"skip"`
	Limit int `form:"limit" json:"limit"`
}

func (*ParamList) ToQuery

func (body *ParamList) ToQuery() *xorm.Session

type ParamSearch

type ParamSearch struct {
	Skip     int                    `form:"skip" json:"skip"`
	Limit    int                    `form:"limit" json:"limit"`
	Sort     map[string]int         `form:"sort" json:"sort"`
	Filters  map[string]interface{} `form:"filter" json:"filter"`
	Keywords map[string]string      `form:"keyword" json:"keyword"`
}

func (*ParamSearch) ToJoinQuery added in v3.0.10

func (body *ParamSearch) ToJoinQuery(table string) *xorm.Session

func (*ParamSearch) ToQuery

func (body *ParamSearch) ToQuery() *xorm.Session

type ParamStringId

type ParamStringId struct {
	Id string `uri:"id"`
}

type ReplyData

type ReplyData[T any] struct {
	Data  T      `json:"data"`
	Error string `json:"error,omitempty"`
}

type ReplyList

type ReplyList[T any] struct {
	Data  []T    `json:"data"`
	Total int64  `json:"total"`
	Error string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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