Documentation ¶
Index ¶
- Constants
- Variables
- func ExportHandlerMaps() (getMap map[string]*gin.HandlerFunc, postMap map[string]*gin.HandlerFunc)
- func ImportToGinEngine(router *gin.Engine, urlPath string)
- func RegisterApiEndpoint(method uint, relativePath string, handler *gin.HandlerFunc) error
- func RegisterApiEndpointJSON(method uint, relativePath string, handler HandlerFuncJSON) error
- type HandlerFuncJSON
- type LessContext
Constants ¶
View Source
const ( HTTP_METHOD_GET uint = iota HTTP_METHOD_POST )
Variables ¶
View Source
var ( ErrNotAllowDirectFuncReg error = errors.New("api.RegisterApiEndpoint(): no direct handler func registration is allowed") ErrBadMethod error = errors.New("api.RegisterApiEndpoint(): bad method") ErrRepeatGetPath error = errors.New("api.RegisterApiEndpoint(): repeated path for GET method") ErrRepeatPostPath error = errors.New("api.RegisterApiEndpoint(): repeated path for POST method") )
Functions ¶
func ExportHandlerMaps ¶
func ExportHandlerMaps() (getMap map[string]*gin.HandlerFunc, postMap map[string]*gin.HandlerFunc)
func ImportToGinEngine ¶
func RegisterApiEndpoint ¶
func RegisterApiEndpoint(method uint, relativePath string, handler *gin.HandlerFunc) error
RegisterNewAPIEndpoint() allows only one single handler function, unlike with direct Gin.Router access. note: this is overpowered and makes the system vulnerable to malicious code. in this version, I made it callable ONLY from main package.
func RegisterApiEndpointJSON ¶
func RegisterApiEndpointJSON(method uint, relativePath string, handler HandlerFuncJSON) error
This function should wrap the JSON and StatCode returned from handler, register it
Types ¶
type HandlerFuncJSON ¶
type HandlerFuncJSON func(*LessContext) (status int, json gin.H)
type LessContext ¶
TODO: Add more safe-to-expose access
Click to show internal directories.
Click to hide internal directories.