request

package
v0.12.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignRequestParamsToDomainObject

func AssignRequestParamsToDomainObject(params Params, domainObject domain.Object) error

AssignRequestParamsToDomainObject 基于assign tag将请求参数赋值到领域对象 参数: - params: 请求参数 - domainObject: 领域对象 返回值: - 错误

func BindFormBody

func BindFormBody(c *api.Context, params Params) error

BindFormBody 绑定form body到请求参数接口 参数: - c: 上下文 - params: 请求参数接口 返回值: - 错误

func BindJsonBody

func BindJsonBody(c *api.Context, params Params) error

BindJsonBody 绑定Json类型的Body请求到请求参数接口 参数: - c: 上下文 - params: 请求参数接口 返回值: - 错误

func BindMultipartForm

func BindMultipartForm(c *api.Context, params Params) error

BindMultipartForm 绑定multipart body到请求参数接口 参数: - c: 上下文 - params: 请求参数接口 返回值: - 错误

func BindPathParams

func BindPathParams(c *api.Context, params Params) error

BindPathParams 绑定路径参数到请求参数接口 参数: - c: 上下文 - params: 请求参数接口 返回值: - 错误

func BindQueryParams

func BindQueryParams(c *api.Context, params Params) error

BindQueryParams 绑定查询参数到请求参数接口 参数: - c: 上下文 - params: 请求参数接口 返回值: - 错误

func BindXMLBody

func BindXMLBody(c *api.Context, params Params) error

BindXMLBody 绑定xml body到请求参数接口 参数: - c: 上下文 - params: 请求参数接口 返回值: - 错误

func Field

func Field[T any](params Params, fieldName string) (T, error)

Field 获取请求对象中的字段值 泛型参数: - T: 请求对象中的字段值的类型 参数: - params: 请求参数 - fieldName: 字段名 返回值: - 请求对象中的字段值 - 错误

func ToConcrete

func ToConcrete[T Params](params Params) (T, error)

ToConcrete 将请求参数转换为具体的请求参数结构类型 泛型参数: - T: 具体的请求参数结构类型 参数: - params: 请求参数 返回值: - 具体的请求参数结构 - 错误

Types

type BaseQueryParams

type BaseQueryParams struct {
	PageNo   int `form:"pageNo" assign:"-"`
	PageSize int `form:"pageSize" assign:"-"`
}

BaseQueryParams 包含查询请求需要字段的查询参数基础实现

func (*BaseQueryParams) GetPageNo

func (q *BaseQueryParams) GetPageNo() int

func (*BaseQueryParams) GetPageSize

func (q *BaseQueryParams) GetPageSize() int

type BaseQueryWithIDParams

type BaseQueryWithIDParams struct {
	IDQueryParam
	BaseQueryParams
}

BaseQueryWithIDParams 包含查通过ID查询需要字段的查询参数基础实现

type BindRequestParamsFunc

type BindRequestParamsFunc func(c *api.Context, params Params) error

BindRequestParamsFunc 请求绑定函数

type CreateUserIDJsonBody

type CreateUserIDJsonBody struct {
	CreateUserID string `json:"createUserId" binding:"required" assign:"toField:CreateUserID"`
}

CreateUserIDJsonBody JsonBody中包含创建用户ID字段的定义结构

type DeleteUserIDQueryParams

type DeleteUserIDQueryParams struct {
	DeleteUserID string `form:"deleteUserId" binding:"required" assign:"toField:LastUpdateUserID"`
}

DeleteUserIDQueryParams JsonBody中包含删除用户ID字段的定义结构

type IDJsonBody

type IDJsonBody struct {
	ID string `json:"id" binding:"required" assign:"toField:ID"`
}

IDJsonBody JsonBody中包含ID字段的定义结构

func (*IDJsonBody) GetID

func (id *IDJsonBody) GetID() string

func (*IDJsonBody) GetTenantID

func (id *IDJsonBody) GetTenantID() string

type IDPathParam

type IDPathParam struct {
	ID string `uri:"id" binding:"required" assign:"toField:ID"`
}

IDPathParam 路径参数中包含ID字段的定义结构

func (*IDPathParam) GetID

func (id *IDPathParam) GetID() string

func (*IDPathParam) GetTenantID

func (id *IDPathParam) GetTenantID() string

type IDQueryParam

type IDQueryParam struct {
	ID string `form:"id" binding:"required" assign:"toField:ID"`
}

IDQueryParam 查询参数中包含ID字段的定义结构

func (*IDQueryParam) GetID

func (id *IDQueryParam) GetID() string

func (*IDQueryParam) GetTenantID

func (id *IDQueryParam) GetTenantID() string

type IDRequestParam

type IDRequestParam interface {
	Params
	GetID() string
}

IDRequestParam 包含ID字段的请求参数接口

type Params

type Params interface{}

Params 请求参数接口(抽象类)

type QueryRequestParams

type QueryRequestParams interface {
	Params
	GetPageNo() int
	GetPageSize() int
}

QueryRequestParams 包含查询请求需要字段的查询参数接口

type QueryWithIDRequestParams

type QueryWithIDRequestParams interface {
	IDRequestParam
	QueryRequestParams
}

QueryWithIDRequestParams 包含查通过ID查询需要字段的查询参数接口

type TenantIDJsonBody

type TenantIDJsonBody struct {
	TenantID string `json:"tenantId" binding:"required" assign:"toField:TenantID"`
}

TenantIDJsonBody JsonBody中包含租户ID字段的定义结构

type TenantIDPathParam

type TenantIDPathParam struct {
	TenantID string `uri:"tenantId" binding:"required" assign:"toField:TenantID"`
}

TenantIDPathParam 路径参数中包含租户ID字段的定义结构

type TenantIDQueryParam

type TenantIDQueryParam struct {
	TenantID string `form:"tenantId" binding:"required" assign:"toField:TenantID"`
}

TenantIDQueryParam 查询参数中包含租户ID字段的定义结构

type TenantIDRequestParam

type TenantIDRequestParam interface {
	Params
	GetTenantID() string
}

TenantIDRequestParam 包含租户ID字段的请求参数接口

type UpdateUserIDJsonBody

type UpdateUserIDJsonBody struct {
	UpdateUserID string `json:"updateUserId" binding:"required" assign:"toField:LastUpdateUserID"`
}

UpdateUserIDJsonBody JsonBody中包含最近更新用户ID字段的定义结构

Jump to

Keyboard shortcuts

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