api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

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

func Fail

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

func List

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

func OK

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

func Register

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

func RegisterAdmin added in v0.0.4

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

func RegisterUnAuthorized added in v0.0.2

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

func Startup added in v0.0.3

func Startup() error

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