Documentation ¶
Index ¶
- Constants
- func Get[T any](ctx *Context, key string) T
- func IsBinary(t string) bool
- func IsForm(t string) bool
- func IsJson(t string) bool
- func IsXml(t string) bool
- type ActionInterface
- type Context
- func (c *Context) Binary(status int, data []byte) error
- func (c *Context) ClientIp() string
- func (c *Context) Data(status int, contentType string, data []byte) error
- func (c *Context) Get(key string) (any, bool)
- func (c *Context) GetBool(key string) bool
- func (c *Context) GetHeader(key string) string
- func (c *Context) GetInt(key string) int
- func (c *Context) GetInt32(key string) int32
- func (c *Context) GetInt64(key string) int64
- func (c *Context) GetStatus() int
- func (c *Context) GetString(key string) string
- func (c *Context) Header(key, val string)
- func (c *Context) Html(status int, data Data) error
- func (c *Context) IsTimeout() bool
- func (c *Context) Json(status int, data any) error
- func (c *Context) MiddlerwareStart()
- func (c *Context) Middleware(middlewares ...MiddlewareInterface)
- func (c *Context) Next()
- func (c *Context) ParseJson(data rule.ParamInterface) error
- func (c *Context) ParseXml(data rule.ParamInterface) error
- func (c *Context) Raw() ([]byte, error)
- func (c *Context) Reset()
- func (c *Context) Set(key string, val any)
- func (c *Context) SetAction(ac ActionInterface)
- func (c *Context) SetParams(ps Params)
- func (c *Context) Status(status int)
- func (c *Context) WithTimeout(timeout time.Duration) context.CancelFunc
- func (c *Context) Writer() http.ResponseWriter
- func (c *Context) Xml(status int, data any) error
- type Data
- type MiddlewareInterface
- type Params
- type Rpcs
- func (r Rpcs) Add(serviceName krpc.ServiceName, group string, conn grpc.ClientConnInterface)
- func (r Rpcs) AddDefualt(serviceName krpc.ServiceName, conn grpc.ClientConnInterface)
- func (r Rpcs) Default(serviceName krpc.ServiceName) grpc.ClientConnInterface
- func (r Rpcs) Get(serviceName krpc.ServiceName, group string) grpc.ClientConnInterface
- type SafeMap
Constants ¶
View Source
const ( Content_Type_Key = "Content-Type" Content_Type_Json = "application/json" Content_Type_Xml = "text/xml" Content_Type_Html = "text/html" Content_Type_Form = "application/x-www-form-urlencoded" Content_Type_Binary = "application/octet-stream" Header_X_Real_Ip = "X-Real-IP" Header_X_Forwarded_For = "X-Forwarded-For" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActionInterface ¶
type ActionInterface interface { Action(c *Context) error View() view.ViewInterface Services() []krpc.ServiceName Group() string }
type Context ¶
type Context struct { *object.ObjNoCtx *pool.Context Request *http.Request Params Params Rpcs Rpcs // contains filtered or unexported fields }
func NewContext ¶
func (*Context) MiddlerwareStart ¶
func (c *Context) MiddlerwareStart()
func (*Context) Middleware ¶ added in v0.0.8
func (c *Context) Middleware(middlewares ...MiddlewareInterface)
func (*Context) SetAction ¶
func (c *Context) SetAction(ac ActionInterface)
func (*Context) WithTimeout ¶
func (c *Context) WithTimeout(timeout time.Duration) context.CancelFunc
func (*Context) Writer ¶
func (c *Context) Writer() http.ResponseWriter
type MiddlewareInterface ¶
type MiddlewareInterface interface {
Handle(*Context)
}
type Rpcs ¶
type Rpcs map[string]grpc.ClientConnInterface
func (Rpcs) Add ¶
func (r Rpcs) Add(serviceName krpc.ServiceName, group string, conn grpc.ClientConnInterface)
func (Rpcs) AddDefualt ¶
func (r Rpcs) AddDefualt(serviceName krpc.ServiceName, conn grpc.ClientConnInterface)
func (Rpcs) Default ¶
func (r Rpcs) Default(serviceName krpc.ServiceName) grpc.ClientConnInterface
func (Rpcs) Get ¶
func (r Rpcs) Get(serviceName krpc.ServiceName, group string) grpc.ClientConnInterface
type SafeMap ¶ added in v0.0.7
type SafeMap[K comparable, V any] struct { // contains filtered or unexported fields }
func NewSafeMap ¶ added in v0.0.7
func NewSafeMap[K comparable, V any]() *SafeMap[K, V]
Click to show internal directories.
Click to hide internal directories.