curd

package
v3.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 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 ApiCount added in v3.0.1

func ApiCount[T any]() gin.HandlerFunc

func ApiCreate

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

func ApiDelete

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

func ApiDisable

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

func ApiExport added in v3.0.3

func ApiExport[T any](filename string) gin.HandlerFunc

func ApiGet

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

func ApiImport added in v3.0.3

func ApiImport[T any]() gin.HandlerFunc

func ApiList

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

func ApiListWithId

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

func ApiModify

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

func ApiSearch

func ApiSearch[T any](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 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 Hook

type Hook func(value interface{}) error

func GenerateRandomKey

func GenerateRandomKey(l int) Hook

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) 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