Documentation ¶
Index ¶
- Variables
- type AfterBind
- type AfterCall
- type BeforeBind
- type BeforeCall
- type Context
- func (c *Context) Apply(ctl interface{}) error
- func (c *Context) DataExit(data interface{})
- func (c *Context) Exit()
- func (c *Context) FailAndExit(data ...interface{})
- func (c *Context) File(fileName string, fileData []byte)
- func (c *Context) GetFormFloat32(key string, def ...float32) float32
- func (c *Context) GetFormFloat64(key string, def ...float64) float64
- func (c *Context) GetFormInt(key string, def ...int) int
- func (c *Context) GetFormInt64(key string, def ...int64) int64
- func (c *Context) GetFormString(key string, def ...string) string
- func (c *Context) GetFormUInt(key string, def ...uint) uint
- func (c *Context) GetPageSize(def ...int) (int, int)
- func (c *Context) GetQueryBool(key string) bool
- func (c *Context) GetQueryInt(key string, def ...int) int
- func (c *Context) GetQueryInt64(key string, def ...int64) int64
- func (c *Context) GetQueryString(key string, def ...string) string
- func (c *Context) GetQueryUInt(key string, def ...uint) uint
- func (c *Context) GetQueryUInt64(key string, def ...uint64) uint64
- func (c *Context) ListExit(count int64, list interface{})
- func (c *Context) Map(i ...interface{}) inject.TypeMapper
- func (c *Context) MapTo(i interface{}, j interface{}) inject.TypeMapper
- func (c *Context) MessageAndDataExit(message string, data interface{})
- func (c *Context) Method() string
- func (c *Context) NoPerm(msg ...string)
- func (c *Context) NoPermissionExit(msg ...string)
- func (c *Context) NotFoundExit(msg ...string)
- func (c *Context) OfFormFile(form string) (string, int64)
- func (c *Context) Provide(i interface{}) error
- func (c *Context) RemoteAddr() string
- func (c *Context) SaveFile(form string, dst string) error
- func (c *Context) Success(data ...interface{})
- func (c *Context) SuccessExit(data ...interface{})
- func (c *Context) UnAuthed(msg ...string)
- func (c *Context) WriteJSON(obj interface{})
- type ContextInvoker
- type DefaultResultBuilder
- func (d DefaultResultBuilder) OnData(msg string, count int64, data any) (statusCode int, result any)
- func (d DefaultResultBuilder) OnError(msg string, err error) (statusCode int, result any)
- func (d DefaultResultBuilder) OnErrorDetail(msg string, err any) (statusCode int, result any)
- func (d DefaultResultBuilder) OnFail(msg string, data any) (statusCode int, result any)
- func (d DefaultResultBuilder) OnNoPermission(msg string) (statusCode int, result any)
- func (d DefaultResultBuilder) OnNotFound(msg string) (statusCode int, result any)
- func (d DefaultResultBuilder) OnSuccess(msg string, data any) (statusCode int, result any)
- func (d DefaultResultBuilder) OnUnAuthed(msg string) (statusCode int, result any)
- type HeaderAuth
- type IResultBuilder
- type Interceptor
- type KApi
- type OnError
- type OnPanic
- type OnUnmarshalError
- type OnValidationError
- type Option
- type RecoverFunc
- type ResultBuilderUnimplemented
- func (r ResultBuilderUnimplemented) OnData(msg string, count int64, data any) (statusCode int, result any)
- func (r ResultBuilderUnimplemented) OnError(msg string, err error) (statusCode int, result any)
- func (r ResultBuilderUnimplemented) OnErrorDetail(msg string, err any) (statusCode int, result any)
- func (r ResultBuilderUnimplemented) OnFail(msg string, data any) (statusCode int, result any)
- func (r ResultBuilderUnimplemented) OnNoPermission(msg string) (statusCode int, result any)
- func (r ResultBuilderUnimplemented) OnNotFound(msg string) (statusCode int, result any)
- func (r ResultBuilderUnimplemented) OnSuccess(msg string, data any) (statusCode int, result any)
- func (r ResultBuilderUnimplemented) OnUnAuthed(msg string) (statusCode int, result any)
- type RouteInfo
- type RouteItem
- type ServerOption
- type StaticDir
Constants ¶
This section is empty.
Variables ¶
var ( VERSION string BUILDTIME string GOVERSION string BUILDOS string BUILDARCH string OS string ARCH string PACKAGENAME string )
编译时植入变量
var KAPIEXIT = "kapiexit"
Functions ¶
This section is empty.
Types ¶
type BeforeBind ¶
type BeforeBind interface {
BeforeBind(c *Context)
}
type BeforeCall ¶
type BeforeCall interface {
BeforeCall(c *Context)
}
type Context ¶
type Context struct { *gin.Context ResultBuilder IResultBuilder `inject:""` // contains filtered or unexported fields }
Context KApi Context
func (*Context) FailAndExit ¶
func (c *Context) FailAndExit(data ...interface{})
func (*Context) GetFormFloat32 ¶
GetFormFloat32 return the float32 value of query param
@param key @param def @return string
func (*Context) GetFormFloat64 ¶
GetFormFloat64 return the float64 value of form param
@param key @param def @return string
func (*Context) GetFormInt ¶
GetFormInt return the int value of form param
@param key @return string
func (*Context) GetFormInt64 ¶
GetFormInt64 return the int64 value of form param
@param key @return string
func (*Context) GetFormString ¶
GetFormString return the string value of form param
@param key @return string
func (*Context) GetFormUInt ¶
GetFormUInt return the uint value of form param
@param key @return string
func (*Context) GetPageSize ¶
GetPageSize return the values of "page"-1 and "size" query params
@param def def[0] can be the default value of "page" param and def[1] can be the default value of "size" param @return int page-1 @return int size
func (*Context) GetQueryBool ¶
GetQueryBool return the boolean value of query param
@param key @return bool
func (*Context) GetQueryInt ¶
GetQueryInt return the int value of query param
@param key @param def @return int
func (*Context) GetQueryInt64 ¶
GetQueryInt64 return the int64 value of query param
@param key @param def @return int64
func (*Context) GetQueryString ¶
GetQueryString return the string value of query param
@param key @return string
func (*Context) GetQueryUInt ¶
GetQueryUInt return the uint value of query param
@param key @param def @return uint
func (*Context) GetQueryUInt64 ¶
GetQueryUInt64 return the uint64 value of query param
@param key @param def @return uint64
func (*Context) Map ¶
func (c *Context) Map(i ...interface{}) inject.TypeMapper
Map an instance
@param i @return inject.TypeMapper
func (*Context) MapTo ¶
func (c *Context) MapTo(i interface{}, j interface{}) inject.TypeMapper
MapTo map instance to interface
@param i 要注入的值(指针) @param j 接口类型(指针) @return inject.TypeMapper
func (*Context) MessageAndDataExit ¶
func (*Context) NoPermissionExit ¶
func (*Context) NotFoundExit ¶
func (*Context) RemoteAddr ¶
RemoteAddr returns more real IP address.
func (*Context) SaveFile ¶
SaveFile save form file to destination
@param form name of form file @param dst destination file name @return error
func (*Context) SuccessExit ¶
func (c *Context) SuccessExit(data ...interface{})
type ContextInvoker ¶
type ContextInvoker func(ctx *Context)
ContextInvoker method like this will be FastInvoke by inject package(not use reflect)
type DefaultResultBuilder ¶
type DefaultResultBuilder struct { }
func (DefaultResultBuilder) OnError ¶
func (d DefaultResultBuilder) OnError(msg string, err error) (statusCode int, result any)
func (DefaultResultBuilder) OnErrorDetail ¶
func (d DefaultResultBuilder) OnErrorDetail(msg string, err any) (statusCode int, result any)
func (DefaultResultBuilder) OnFail ¶
func (d DefaultResultBuilder) OnFail(msg string, data any) (statusCode int, result any)
func (DefaultResultBuilder) OnNoPermission ¶
func (d DefaultResultBuilder) OnNoPermission(msg string) (statusCode int, result any)
func (DefaultResultBuilder) OnNotFound ¶
func (d DefaultResultBuilder) OnNotFound(msg string) (statusCode int, result any)
func (DefaultResultBuilder) OnSuccess ¶
func (d DefaultResultBuilder) OnSuccess(msg string, data any) (statusCode int, result any)
func (DefaultResultBuilder) OnUnAuthed ¶
func (d DefaultResultBuilder) OnUnAuthed(msg string) (statusCode int, result any)
type HeaderAuth ¶
type HeaderAuth interface {
HeaderAuth(c *Context)
}
type IResultBuilder ¶
type IResultBuilder interface { OnSuccess(msg string, data any) (statusCode int, result any) OnData(msg string, count int64, data any) (statusCode int, result any) OnFail(msg string, data any) (statusCode int, result any) OnError(msg string, err error) (statusCode int, result any) OnErrorDetail(msg string, err any) (statusCode int, result any) OnUnAuthed(msg string) (statusCode int, result any) OnNoPermission(msg string) (statusCode int, result any) OnNotFound(msg string) (statusCode int, result any) }
type Interceptor ¶
Interceptor implement this to intercept controller method
type KApi ¶
func (*KApi) AddControllers ¶ added in v0.6.0
func (*KApi) RegisterResultBuilder ¶
func (b *KApi) RegisterResultBuilder(builder IResultBuilder)
RegisterResultBuilder 注册返回body的builder处理类
@param builder 实现 IResultBuilder 接口
func (*KApi) RegisterRouter ¶
type OnUnmarshalError ¶
type OnValidationError ¶
type Option ¶
type Option struct { Server ServerOption // contains filtered or unexported fields }
func (*Option) SetGinLoggerFormatter ¶
func (o *Option) SetGinLoggerFormatter(formatter gin.LogFormatter) *Option
func (*Option) SetIntranetIP ¶
func (*Option) SetRecoverFunc ¶
type ResultBuilderUnimplemented ¶
type ResultBuilderUnimplemented struct{}
func (ResultBuilderUnimplemented) OnError ¶
func (r ResultBuilderUnimplemented) OnError(msg string, err error) (statusCode int, result any)
func (ResultBuilderUnimplemented) OnErrorDetail ¶
func (r ResultBuilderUnimplemented) OnErrorDetail(msg string, err any) (statusCode int, result any)
func (ResultBuilderUnimplemented) OnFail ¶
func (r ResultBuilderUnimplemented) OnFail(msg string, data any) (statusCode int, result any)
func (ResultBuilderUnimplemented) OnNoPermission ¶
func (r ResultBuilderUnimplemented) OnNoPermission(msg string) (statusCode int, result any)
func (ResultBuilderUnimplemented) OnNotFound ¶
func (r ResultBuilderUnimplemented) OnNotFound(msg string) (statusCode int, result any)
func (ResultBuilderUnimplemented) OnSuccess ¶
func (r ResultBuilderUnimplemented) OnSuccess(msg string, data any) (statusCode int, result any)
func (ResultBuilderUnimplemented) OnUnAuthed ¶
func (r ResultBuilderUnimplemented) OnUnAuthed(msg string) (statusCode int, result any)
type RouteInfo ¶
type RouteInfo struct {
// contains filtered or unexported fields
}
func NewRouteInfo ¶ added in v0.6.0
func NewRouteInfo() *RouteInfo
func (*RouteInfo) GetGenInfo ¶ added in v0.6.0
func (ri *RouteInfo) GetGenInfo() *genInfo
func (*RouteInfo) GetRouteItems ¶ added in v0.6.0
GetRouteItems get router info of method comments
@return map[string][]RouteItem
type RouteItem ¶ added in v0.6.0
type RouteItem struct { Key string //may be [controller name] + / + [method name]. unique RouterPath string Summary string Description string Method string //HTTP METHOD }
RouteItem store the comment from controller's method. fields should be exported for gob encoding and decoding
type ServerOption ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
k
Module
|
|
example
module
|
|
ast_parser
Package ast_parser get type information from a package using go/ast
|
Package ast_parser get type information from a package using go/ast |