model

package
v0.0.0-...-3dda883 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqContentTypeJson     RouteReqContentType = "json"
	ReqContentTypeXml      RouteReqContentType = "xml"
	ReqContentTypeProtoBuf RouteReqContentType = "protobuf"
	ReqContentTypeFile     RouteReqContentType = "file"

	RespContentTypeJson     RouteRespContentType = "json"
	RespContentTypeText     RouteRespContentType = "text"
	RespContentTypeXml      RouteRespContentType = "xml"
	RespContentTypeProtoBuf RouteRespContentType = "protobuf"
	RespContentTypeFile     RouteRespContentType = "file"
	RespContentTypeHtml     RouteRespContentType = "html"
	RespContentTypeRedirect RouteRespContentType = "redirect"
	RespContentTypeImage    RouteRespContentType = "image"
	RespContentTypeVideo    RouteRespContentType = "video"
	RespContentTypeAudio    RouteRespContentType = "audio"
)

Variables

This section is empty.

Functions

func GetNewContext

func GetNewContext() context.Context

GetNewContext 获取一个新的ctx

Types

type HandlerFuncInOut

type HandlerFuncInOut struct {
	ControllerName string         `json:"controllerName"`
	Name           string         `json:"name"`
	RouteMethods   []RouteMethod  `json:"routeMethods"`
	Ins            []InParamsType `json:"ins"`
	InCount        int            `json:"inCount"`
	Outs           []ParamsType   `json:"outs"`
	OutCount       int            `json:"outCount"`
	Func           interface{}    `json:"-"`
}

HandlerFuncInOut handler方法输入输出参数定义

type HandlerFuncRoute

type HandlerFuncRoute struct {
	PreUrl            string             `json:"preUrl"`
	HandlerFuncInOuts []HandlerFuncInOut `json:"handlerFuncInOuts"`
}

HandlerFuncRoute 路由策略

type HttpContext

type HttpContext struct {
	Request       *http.Request
	Url           string
	Method        string
	StartTime     int64
	EndTime       int64
	TraceId       string
	SpanId        string
	Ip            string
	Status        int
	PartnerCode   string
	App           string
	Body          string
	AuthToken     string
	ClientVersion string
	Platform      string
	Channel       string
	Lang          string
	DeviceId      string
}

func GetHttpContext

func GetHttpContext(ctx context.Context) *HttpContext

type HttpParamsAssignType

type HttpParamsAssignType int
const (
	UnAssign   HttpParamsAssignType = 0
	PathAssign HttpParamsAssignType = iota
	QueryAssign
	PostFormAssign
	BodyAssign
	HeaderAssign
)

func (HttpParamsAssignType) String

func (h HttpParamsAssignType) String() string

type InParamsType

type InParamsType struct {
	Name       string               `json:"name"`
	AssignType HttpParamsAssignType `json:"assignType"`
	ParamsType
}

InParamsType 输入参数类型定义

type ParamsType

type ParamsType struct {
	IsPointer  bool         `json:"isPointer"`
	DefaultVal string       `json:"defaultVal"`
	IsNeed     bool         `json:"isNeed"`
	Type       reflect.Type `json:"type"`
	Kind       reflect.Kind `json:"kind"`
}

ParamsType 输出参数类型定义

type RouteMethod

type RouteMethod struct {
	PreUrl          string               `json:"preUrl"`
	Route           string               `json:"route"`
	Methods         []string             `json:"methods"`
	ReqContentType  RouteReqContentType  `json:"reqContentType"`
	RespContentType RouteRespContentType `json:"respContentType"`
}

type RouteReqContentType

type RouteReqContentType string

type RouteRespContentType

type RouteRespContentType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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