bgin

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	*gin.Context
	Filters  *Filters
	Sessions *Sessions
	Headers  *Headers
}

func NewContext

func NewContext(c *gin.Context) *Context

func (*Context) Bind

func (pkg *Context) Bind(obj any) error

func (*Context) ResponseData

func (pkg *Context) ResponseData(status int, data interface{})

func (*Context) ResponseDataList

func (pkg *Context) ResponseDataList(status int, data interface{}, total int64)

func (*Context) ResponseError

func (pkg *Context) ResponseError(status int, err error)

func (*Context) ResponseErrors

func (pkg *Context) ResponseErrors(status int, errors []ErrorResponse)

func (*Context) ResponseMessage

func (pkg *Context) ResponseMessage(status int)

type ErrorResponse

type ErrorResponse struct {
	Field   interface{} `json:"field"`
	Message string      `json:"message"`
}

type Filters

type Filters struct {
	Limit      int               `json:"limit"`
	Offset     int               `json:"offset"`
	Search     string            `json:"search"`
	Conditions map[string]string `json:"conditions"`
	StatusIds  []int64           `json:"status_ids"`
	SortBy     string            `json:"sort_by"`
}

func GetFilters

func GetFilters(c *gin.Context) *Filters

type Headers

type Headers struct {
	Ip             string
	Company        int64
	Theme          string
	Language       string
	DateFormat     string
	NumberDigit    string
	CurrencyFormat string
	Timezone       string
}

func GetHeaders

func GetHeaders(c *gin.Context) *Headers

type Response

type Response struct {
	Status      int             `json:"status"`
	Message     string          `json:"message"`
	Data        interface{}     `json:"data,omitempty"`
	Total       int64           `json:"total,omitempty"`
	PerPage     int64           `json:"per_page,omitempty"`
	CurrentPage int64           `json:"current_page,omitempty"`
	LastPage    int64           `json:"last_page,omitempty"`
	Errors      []ErrorResponse `json:"errors,omitempty"`
	Error       string          `json:"error,omitempty"`
}

type Sessions

type Sessions struct {
	UserId int64 `json:"user_id"`
}

func GetSessions

func GetSessions(c *gin.Context) *Sessions

Jump to

Keyboard shortcuts

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