requests

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const MaxMultipartMemory = 2 << 20

Variables

View Source
var AllowHeaders = []string{
	commons.TraceId,
	commons.Platform,
	commons.Token,
	commons.ShareToken,

	"device-id",
	"hardware",
	"os",
	"os-version",
	"resolution",
	"app-key",
	"app-version",
	"app_vsn",
	"X-Forwarded-For",
	"X-Forwarded-Proto",
	"Authorization",
}
View Source
var AllowOrigins = []string{
	"*",
}
View Source
var ApiUserInfoCheckFunc = func(ctx *commons.BaseContext, token string, urlPath string, info *commons.QuickInfo) error {
	panic("请设置ApiUserInfoCheckFunc")
}
View Source
var (
	NotLoginError = errors.New("not login")
)
View Source
var PrivateUserInfoCheckFunc = func(ctx *commons.BaseContext, uid int64, info *commons.QuickInfo) error {
	return nil
}
View Source
var ShareCheckFunc = func(ctx *commons.BaseContext, req any, urlPath string, info *commons.QuickInfo) error {
	panic("请设置ShareCheckFunc")
}

Functions

func Get

func Get[T, V any](gg *gin.RouterGroup, rd *RequestDesc[T, V])

func NewEngine

func NewEngine() *gin.Engine

func Post

func Post[T, V any](gg *gin.RouterGroup, rd *RequestDesc[T, V])

Types

type BizFunc

type BizFunc[T any, V any] func(ctx *commons.BaseContext, req *T) V

type LogLevel

type LogLevel int
const (
	LOG_LEVEL_NONE   LogLevel = 0
	LOG_LEVEL_PARAM  LogLevel = 1
	LOG_LEVEL_RETURN LogLevel = 2
	LOG_LEVEL_ALL    LogLevel = 3
)

type RequestDesc

type RequestDesc[T, V any] struct {
	RelativePath  string
	AllowRoles    []string
	AllowProducts []int
	BizCoreFunc   BizFunc[T, V]
	LogLevel      LogLevel
	NotLogSQL     bool
}

Jump to

Keyboard shortcuts

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