Documentation ¶
Index ¶
- Constants
- func ShouldBindJSON(c *gin.Context, i interface{}) error
- func ShouldBindQuery(c *gin.Context, i interface{}) error
- type BaseApp
- func (app *BaseApp) E(statusCode int, reason string, description interface{}) *Err
- func (app *BaseApp) HandleError(c *gin.Context, err error)
- func (app *BaseApp) HandlerHealthz(c *gin.Context)
- func (app *BaseApp) HandlerIndex(c *gin.Context)
- func (app *BaseApp) HandlerSend(c *gin.Context)
- func (app *BaseApp) MustBindJSON(c *gin.Context, i interface{}) bool
- func (app *BaseApp) MustBindQuery(c *gin.Context, i interface{}) bool
- func (app *BaseApp) Send(to tb.Recipient, what interface{}, options ...interface{})
- func (app *BaseApp) Serve() error
- type BaseOptions
- type Detail
- type Err
Constants ¶
View Source
const ( ReasonServerError = "ServerError" ReasonInvalidRequest = "InvalidRequest" )
Variables ¶
This section is empty.
Functions ¶
func ShouldBindJSON ¶
func ShouldBindQuery ¶
Types ¶
type BaseApp ¶
type BaseApp struct { Version string Addr string Name string TelegramAdminChatID string Bot *tb.Bot Router *gin.Engine }
func SetupBaseApp ¶
func SetupBaseApp(options BaseOptions) BaseApp
func (*BaseApp) HandleError ¶
HandleError handlers errors in a general way
func (*BaseApp) HandlerHealthz ¶
HandlerHealthz is the health check handler
func (*BaseApp) HandlerIndex ¶
HandlerIndex is the default handler
func (*BaseApp) HandlerSend ¶
HandlerSend sends a message to a single chat
func (*BaseApp) MustBindJSON ¶
MustBindJSON used to bind query data to structure, returns false when failed, and response is written automatically
func (*BaseApp) MustBindQuery ¶
MustBindQuery used to bind query data to structure, returns false when failed, and response is written automatically
type BaseOptions ¶
Click to show internal directories.
Click to hide internal directories.