Documentation
¶
Index ¶
- Constants
- Variables
- func CGET(category uint8, relativePath string, handler *gin.HandlerFunc) error
- func CPOST(category uint8, relativePath string, handler *gin.HandlerFunc) error
- func FinalizeGinEngine(router *gin.Engine, pathPrefix string)
- func GET(relativePath string, handler *gin.HandlerFunc) error
- func POST(relativePath string, handler *gin.HandlerFunc) error
Constants ¶
View Source
const ( Payment uint8 = iota PaymentCallback Server )
API categories. Any package (no matter official or third party) except for main package must choose a category to register the API endpoints.
Variables ¶
View Source
var ( ErrBadMethod error = errors.New("api.RegisterApiEndpoint(): bad method") ErrInvalidCategory error = errors.New("api: invalid category is selected") ErrNotAllowDirectFuncReg error = errors.New("api.RegisterApiEndpoint(): no direct handler func registration is allowed") ErrRepeatGetPath error = errors.New("api.RegisterApiEndpoint(): repeated path for GET method") ErrRepeatPostPath error = errors.New("api.RegisterApiEndpoint(): repeated path for POST method") )
Functions ¶
func CGET ¶ added in v0.0.6
func CGET(category uint8, relativePath string, handler *gin.HandlerFunc) error
CGET() stands for Categorized GET CGET(Payment, "dummy/test", f) will register f() as example.com/api/payment/dummy/test for GET method
func CPOST ¶ added in v0.0.6
func CPOST(category uint8, relativePath string, handler *gin.HandlerFunc) error
CPOST() stands for Categorized POST CPOST(Payment, "dummy/test", f) will register f() as example.com/api/payment/dummy/test for POST method
func FinalizeGinEngine ¶ added in v0.0.3
FinalizeGinEngine() binds all registered handlers to a gin.Engine. - pathPrefix should be in the format of aaa[/bbb[/ccc[/ddd]]] where [] encloses an optional portion
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.