Documentation
¶
Index ¶
- Variables
- type App
- func (a *App) GetSession() (clientFunc func() *redis.Client, key, prefix string, expiration int64)
- func (a *App) GetSign() (secretKey, key, timeKey, dev string, expiration int64)
- func (a *App) GetVersion() (version, key string)
- func (a *App) Run(options ...func(app *App))
- func (a *App) SetMode(mode string) *App
- type Controller
- func (c *Controller) DumpRequest() string
- func (c *Controller) GetLoggedUserId() int
- func (c *Controller) GetQueryByMethod(key, defaultValue string) string
- func (c *Controller) GetQueryPostForm(keys ...string) string
- func (c *Controller) Json(args ...interface{})
- func (c *Controller) PostForm(keys ...string) string
- func (c *Controller) Query(keys ...string) string
- func (c *Controller) QueryPostNumber(key string, defaultValue ...int) int
- func (c *Controller) SetContext(ctx *gin.Context)
- type ICheck
- type IController
- type Logger
- type Model
- type Redis
- type RestHandler
- type RestHandlers
- type Restful
- type Sender
- type Server
- type Session
- type Sign
- type Version
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultApp = &App{ Name: "demo", Mode: consts.DevMode, Version: &Version{ Latest: "1.0.0", Key: "app_version", }, Session: &Session{ Key: "sess_token", KeyPrefix: "ci_session:", Expiration: 6 * 30 * 86400, }, Logger: &Logger{ Dir: "apps/logs/go/demo", LogTimeout: 3 * time.Second, SendTimeout: 5 * time.Second, }, Sign: &Sign{ SecretKey: "1234!@#$", Key: "sess_token", TimeKey: "utime", Dev: "bgin-dev-sign", Expiration: 60, }, Server: &Server{ Addr: "0.0.0.0:9999", ReadTimeout: 10 * time.Second, WriteTimeout: 15 * time.Second, ShutDownTimeout: 15 * time.Second, }, } )
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { Name string Mode string Version *Version Logger *Logger Server *Server Sign *Sign Session *Session }
func (*App) GetSession ¶
func (*App) GetVersion ¶
type Controller ¶
func (*Controller) DumpRequest ¶
func (c *Controller) DumpRequest() string
func (*Controller) GetLoggedUserId ¶
func (c *Controller) GetLoggedUserId() int
GetLoggedUserId 获取已登陆用户的ID
func (*Controller) GetQueryByMethod ¶
func (c *Controller) GetQueryByMethod(key, defaultValue string) string
GetQueryByMethod 根据ctx.httpMethod获取GET或POST参数
func (*Controller) GetQueryPostForm ¶
func (c *Controller) GetQueryPostForm(keys ...string) string
从Get和Post里获取Key的值
func (*Controller) Json ¶
func (c *Controller) Json(args ...interface{})
Json 输出方法 args 三个参数: 第一个是code,第二个是msg,第三个是data
func (*Controller) PostForm ¶
func (c *Controller) PostForm(keys ...string) string
PostForm 从Post里获取Key的值
func (*Controller) QueryPostNumber ¶
func (c *Controller) QueryPostNumber(key string, defaultValue ...int) int
QueryPostNumber 从Query或PostForm中获取数字类型key值
func (*Controller) SetContext ¶
func (c *Controller) SetContext(ctx *gin.Context)
type IController ¶
type RestHandler ¶
type RestHandler struct { Sort int // Sort Signed bool // Signed Logged bool // Logged Path string // Path Version string // Version Http string // Http Method string // Method Handler IController // Handler Https map[string]byte // Https }
func (*RestHandler) CallMethod ¶
func (h *RestHandler) CallMethod(ctx *gin.Context)
func (*RestHandler) GetHttps ¶
func (h *RestHandler) GetHttps() map[string]byte
type RestHandlers ¶
type RestHandlers []RestHandler
func (RestHandlers) Len ¶
func (rh RestHandlers) Len() int
func (RestHandlers) Less ¶
func (rh RestHandlers) Less(i, j int) bool
func (RestHandlers) Swap ¶
func (rh RestHandlers) Swap(i, j int)
type Restful ¶
type Restful map[string]RestHandlers
Source Files
¶
Click to show internal directories.
Click to hide internal directories.