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: "zgin-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 ¶ added in v1.5.0
type App struct { Name string Mode string Version *Version Logger *Logger Server *Server Sign *Sign Session *Session }
func (*App) GetSession ¶ added in v1.5.0
func (*App) GetVersion ¶ added in v1.5.0
type Controller ¶ added in v1.4.2
func (*Controller) DumpRequest ¶ added in v1.4.2
func (c *Controller) DumpRequest() string
func (*Controller) GetLoggedUserId ¶ added in v1.4.2
func (c *Controller) GetLoggedUserId() int
GetLoggedUserId 获取已登陆用户的ID
func (*Controller) GetQueryByMethod ¶ added in v1.4.2
func (c *Controller) GetQueryByMethod(key, defaultValue string) string
GetQueryByMethod 根据ctx.httpMethod获取GET或POST参数
func (*Controller) GetQueryPostForm ¶ added in v1.4.2
func (c *Controller) GetQueryPostForm(keys ...string) string
从Get和Post里获取Key的值
func (*Controller) Json ¶ added in v1.4.2
func (c *Controller) Json(args ...interface{})
Json 输出方法 args 三个参数: 第一个是code,第二个是msg,第三个是data
func (*Controller) PostForm ¶ added in v1.5.4
func (c *Controller) PostForm(keys ...string) string
PostForm 从Post里获取Key的值
func (*Controller) Query ¶ added in v1.5.4
func (c *Controller) Query(keys ...string) string
Query 从Get里获取Key的值
func (*Controller) QueryPostNumber ¶ added in v1.5.4
func (c *Controller) QueryPostNumber(key string, defaultValue ...int) int
QueryPostNumber 从Query或PostForm中获取数字类型key值
func (*Controller) SetContext ¶ added in v1.4.2
func (c *Controller) SetContext(ctx *gin.Context)
type IController ¶ added in v1.4.2
type RestHandler ¶ added in v1.4.2
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 ¶ added in v1.4.2
func (h *RestHandler) CallMethod(ctx *gin.Context)
func (*RestHandler) GetHttps ¶ added in v1.4.2
func (h *RestHandler) GetHttps() map[string]byte
type RestHandlers ¶ added in v1.4.2
type RestHandlers []RestHandler
func (RestHandlers) Len ¶ added in v1.4.2
func (rh RestHandlers) Len() int
func (RestHandlers) Less ¶ added in v1.4.2
func (rh RestHandlers) Less(i, j int) bool
func (RestHandlers) Swap ¶ added in v1.4.2
func (rh RestHandlers) Swap(i, j int)
type Restful ¶ added in v1.4.2
type Restful map[string]RestHandlers
Source Files
¶
Click to show internal directories.
Click to hide internal directories.