api

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: GPL-3.0 Imports: 15 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(tab *table.Table) gin.HandlerFunc

func Create

func Create(tab *table.Table, after func(id string) error) gin.HandlerFunc

func Delete

func Delete(tab *table.Table, after func(id string) error) gin.HandlerFunc

func Detail

func Detail(tab *table.Table, after func(id string, doc mongodb.Document) error) gin.HandlerFunc

func Disable

func Disable(tab *table.Table, after func(id string) error) gin.HandlerFunc

func Enable

func Enable(tab *table.Table, after func(id string) error) gin.HandlerFunc

func Error

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

func Export

func Export(tab *table.Table) gin.HandlerFunc

func Fail

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

func Group

func Group(tab *table.Table, after func(doc []mongodb.Document) error) gin.HandlerFunc

func Import

func Import(tab *table.Table, after func(ids []string) error) gin.HandlerFunc

func List

func List(ctx *gin.Context, data any, total int64)

func OK

func OK(ctx *gin.Context, data any)

func Operator

func Operator(hook func(id string) error) gin.HandlerFunc

func Register

func Register(method, path string, handlers ...gin.HandlerFunc)

func RegisterRoutes

func RegisterRoutes(router *gin.RouterGroup)
func Search(tab *table.Table, after func(doc []mongodb.Document) error) gin.HandlerFunc

func Update

func Update(tab *table.Table, after func(id string) error) gin.HandlerFunc

Types

type API

type API struct {
	Method   string
	Path     string
	Handlers []gin.HandlerFunc
}

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