api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 4 Imported by: 8

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 RegisterRoutes

func RegisterRoutes(router *gin.RouterGroup)

func RegisterUnAuthorized added in v0.0.2

func RegisterUnAuthorized(method, path string, handlers ...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