request

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0 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

View Source
const ContextLoginUserKey = "__login_user__"
View Source
const ContextPublicRequestKey = "__public_request__"
View Source
const ContextRoleUserIdKey = "__role_user_id__"
View Source
const ContextRoleUserTypeKey = "__role_user_type__"

Variables

This section is empty.

Functions

func JWTLoginUserId

func JWTLoginUserId(ctx *gin.Context) int

获取 JWT 中存储的用户信息

func RoleUserId deprecated

func RoleUserId(ctx *gin.Context) int

Deprecated: 身份与ID可能被客户端篡改,不安全 身份用户ID

func RoleUserType deprecated

func RoleUserType(ctx *gin.Context) string

Deprecated: 身份与ID可能被客户端篡改,不安全 身份用类型

Types

type CRUDCondition

type CRUDCondition struct {
	Column string `json:"c"`
	Type   uint8  `json:"t"` // TODO 是否只在后台定义搜索类型,前端不需要这个字段?
	Value  string `json:"v"`
}

type CRUDRequest

type CRUDRequest struct {
	Query    []CRUDCondition `json:"query,omitempty"`
	Sort     string          `json:"sort,omitempty"`
	Page     int64           `json:"page,omitempty"`
	PageSize int64           `json:"page_size,omitempty"`
	Id       string          `json:"id,omitempty"`
	Ids      []string        `json:"ids,omitempty"`
}

func PublicRequestCrud

func PublicRequestCrud(ctx *gin.Context) CRUDRequest

type PageInfo

type PageInfo struct {
	Page     int64 `json:"page,omitempty"`
	PageSize int64 `json:"page_size,omitempty"`
	Total    int64 `json:"total,omitempty"`
}

type PageQuery

type PageQuery[T any] struct {
	Query    T        `json:"query"`
	PageInfo PageInfo `json:"page_info"`
}

func PageRequest

func PageRequest[T any](ctx *gin.Context, query T) (PageQuery[T], error)

type PublicPageRequest

type PublicPageRequest struct {
	Query    map[string]interface{} `json:"query,omitempty"`
	Sort     []string               `json:"sort,omitempty"`
	Id       string                 `json:"id,omitempty"`
	Ids      []any                  `json:"ids,omitempty"`
	PageInfo `json:"page_info,omitempty"`
}

func PublicRequest

func PublicRequest(ctx *gin.Context) PublicPageRequest

Jump to

Keyboard shortcuts

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