ginutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MarshalOptions = protojson.MarshalOptions{
	UseProtoNames:   true,
	EmitUnpopulated: true,
}

Functions

func HandlerFunc

func HandlerFunc(fn func(ctx *Context) error) gin.HandlerFunc

func Translate

func Translate(err error) string

Types

type Context

type Context struct {
	Context *gin.Context
}

func NewContext

func NewContext(ctx *gin.Context) *Context

func (*Context) Ctx

func (c *Context) Ctx() context.Context

func (*Context) Error

func (c *Context) Error(message any) error

func (*Context) InvalidParams

func (c *Context) InvalidParams(message any) error

func (*Context) Success

func (c *Context) Success(data any, message ...string) error

type Response

type Response struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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