engine

package
v0.0.0-...-2f79e39 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextVariablesKeyPager = "_gin_extend_context_variables_key_pager"
)
View Source
const (
	ContextVariablesKeyResponse = "_gin_extend_context_variables_key_response"
)

Variables

This section is empty.

Functions

func ClearSession

func ClearSession(c *gin.Context) (err error)

func GetSession

func GetSession(c *gin.Context) (session sessions.Session, err error)

func ReqGetPager

func ReqGetPager(gc *gin.Context, pageSize int) (pager *utilHttp.Paginator)

func SaveSession

func SaveSession(c *gin.Context) (err error)

Types

type GinEngine

type GinEngine struct {
	*gin.Engine
}

func NewGinEngine

func NewGinEngine() (e *GinEngine)

func (*GinEngine) Debug

func (e *GinEngine) Debug(debug bool) *GinEngine

func (*GinEngine) UseDefault

func (e *GinEngine) UseDefault() *GinEngine

func (*GinEngine) UseMultiTemplate

func (e *GinEngine) UseMultiTemplate(templates []*GinTemplate, templateBasePath string) (err error)

func (*GinEngine) UseSessions

func (e *GinEngine) UseSessions(store sessions.Store, name string, options sessions.Options, regStructs ...any) *GinEngine

type GinTemplate

type GinTemplate = struct {
	Files  string `json:"files"`
	Layout string `json:"layout"`
}

type Response

type Response struct {
	Status     bool
	StatusCode int
	Message    string

	Debugs    []string
	Errors    []string
	Variables map[string]interface{}
	Data      interface{}
	// contains filtered or unexported fields
}

func GetResponse

func GetResponse(gc *gin.Context) (response *Response)

func (*Response) Failed

func (res *Response) Failed(msg string, code ...int) *Response

func (*Response) RenderApiJson

func (res *Response) RenderApiJson(gc *gin.Context)

func (*Response) RenderHtml

func (res *Response) RenderHtml(templateName string, gc *gin.Context)

func (*Response) RenderJson

func (res *Response) RenderJson(gc *gin.Context)

func (*Response) SetData

func (res *Response) SetData(v interface{}) *Response

func (*Response) Success

func (res *Response) Success(msg string, code ...int) *Response

func (*Response) WithDebug

func (res *Response) WithDebug(v string) *Response

func (*Response) WithError

func (res *Response) WithError(v string) *Response

func (*Response) WithVariables

func (res *Response) WithVariables(v interface{}, k string) *Response

Jump to

Keyboard shortcuts

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