Documentation ¶
Index ¶
- Variables
- func ContextGetSession(c kmgContext.Context) *sessionStore.Session
- func ContextSetSession(c kmgContext.Context, sess *sessionStore.Session)
- func HttpApiDeflateCompressFilter(c *HttpApiContext, fc []HttpApiFilter)
- func RunGoHttpApiServerCmd()
- type ApiFuncArgumentError
- type ApiFuncMeta
- type ApiFuncNotFoundError
- type ApiManagerInterface
- type GoHttpApiServerCommand
- type HttpApiContext
- type HttpApiFilter
- type HttpApiFilterManager
- type HttpHandlerConfig
- type JsonHttpHandler
- type JsonHttpInput
- type JsonHttpOutput
- type RegisterApiManager
- type SessionIdContainer
Constants ¶
This section is empty.
Variables ¶
View Source
var AdditionHttpHandler []HttpHandlerConfig
Functions ¶
func ContextGetSession ¶
func ContextGetSession(c kmgContext.Context) *sessionStore.Session
func ContextSetSession ¶
func ContextSetSession(c kmgContext.Context, sess *sessionStore.Session)
func HttpApiDeflateCompressFilter ¶
func HttpApiDeflateCompressFilter(c *HttpApiContext, fc []HttpApiFilter)
func RunGoHttpApiServerCmd ¶
func RunGoHttpApiServerCmd()
Types ¶
type ApiFuncArgumentError ¶
func (*ApiFuncArgumentError) Error ¶
func (err *ApiFuncArgumentError) Error() string
type ApiFuncMeta ¶
type ApiFuncNotFoundError ¶
func (*ApiFuncNotFoundError) Error ¶
func (err *ApiFuncNotFoundError) Error() string
type ApiManagerInterface ¶
type ApiManagerInterface interface { /* must pass a session object input and output can be *struct{xxx} map[string]interface */ RpcCall(session *sessionStore.Session, name string, caller func(*ApiFuncMeta) error) error }
ApiFunc must be something like(follow golang rpc protocol)(can not reflect parameter name)
1.func Add(apiInput *ReqisterRequest,apiOutput *RegisterResponse)(error){ 2.func Add(apiInput *ReqisterRequest)(error){ 3.func Add()(error) 4.func Add()
type GoHttpApiServerCommand ¶
type GoHttpApiServerCommand struct {
// contains filtered or unexported fields
}
start a golang http api server
type HttpApiContext ¶
type HttpApiContext struct { Request *http.Request ResponseWriter http.ResponseWriter ApiName string }
type HttpApiFilter ¶
type HttpApiFilter func(c *HttpApiContext, fc []HttpApiFilter)
type HttpApiFilterManager ¶
type HttpApiFilterManager struct {
Filters []HttpApiFilter
}
func (*HttpApiFilterManager) ServeHTTP ¶
func (m *HttpApiFilterManager) ServeHTTP(w http.ResponseWriter, req *http.Request)
type HttpHandlerConfig ¶
type JsonHttpHandler ¶
type JsonHttpHandler struct { ApiManager ApiManagerInterface SessionStoreManager *sessionStore.Manager }
func (*JsonHttpHandler) Filter ¶
func (handler *JsonHttpHandler) Filter(c *HttpApiContext, _ []HttpApiFilter)
func (*JsonHttpHandler) ServeHTTP ¶
func (handler *JsonHttpHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)
type JsonHttpInput ¶
type JsonHttpOutput ¶
type RegisterApiManager ¶
type RegisterApiManager map[string]func(c kmgContext.Context) interface{}
api注册方式
var DefaultApiManager RegisterApiManager = NewApiManager()
func NewApiManager ¶
func NewApiManager() RegisterApiManager
container service + method -> api the api name will be "serviceName.methodName"
func (RegisterApiManager) RpcCall ¶
func (manager RegisterApiManager) RpcCall( session *sessionStore.Session, name string, caller func(*ApiFuncMeta) error, ) error
type SessionIdContainer ¶
type SessionIdContainer struct {
SessionId string
}
Click to show internal directories.
Click to hide internal directories.