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: 0

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