fdgin

package
v0.0.0-...-3ce3758 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevMode  = "dev"
	TestMode = "test"
	BetaMode = "beta"
	ProdMode = "prod"
)
View Source
const (
	CODE  = "X-Code"
	Token = "X-Token"
)

Variables

View Source
var SessionSpace = "default"
View Source
var SessionTimeout = 7200

Functions

func DeleteSessionFromRedis

func DeleteSessionFromRedis(c *gin.Context) error

*

  • 从redis中删除session

func GetSession

func GetSession(c *gin.Context, key string) (value string)

*

  • 从cookie中获取session

func GetSessionByRedis

func GetSessionByRedis(c *gin.Context) (value string, err error)

*

  • 从redis中获取session

func SetSession

func SetSession(c *gin.Context, key string, value string, duration time.Duration)

*

  • 保存session到cookie

func SetSessionByRedis

func SetSessionByRedis(key string, value string) error

*

  • 保存session到redis

Types

type BaseResource

type BaseResource struct {
}

func (*BaseResource) GetPaging

func (r *BaseResource) GetPaging(c *gin.Context) *fdmodel.Paging

*

  • 获取分页数据

func (*BaseResource) GetQueryInt

func (r *BaseResource) GetQueryInt(c *gin.Context, key, errorMsg string) int

*

  • 获取query字段(int)

func (*BaseResource) GetQueryIntWithDefault

func (r *BaseResource) GetQueryIntWithDefault(c *gin.Context, key string, defalut int, errorMsg string) int

func (*BaseResource) GetQueryString

func (r *BaseResource) GetQueryString(c *gin.Context, key, errorMsg string) string

*

  • 获取query字段(string)

func (*BaseResource) GetSessionByRedis

func (r *BaseResource) GetSessionByRedis(c *gin.Context, object interface{}) error

*

  • 获取session

func (*BaseResource) JsonParam

func (r *BaseResource) JsonParam(c *gin.Context, obj interface{}) error

*

  • 获取请求对象

func (*BaseResource) JsonWithError

func (r *BaseResource) JsonWithError(c *gin.Context, err error)

func (*BaseResource) JsonWithList

func (r *BaseResource) JsonWithList(c *gin.Context, record interface{})

func (*BaseResource) JsonWithRecord

func (r *BaseResource) JsonWithRecord(c *gin.Context, record interface{})

func (*BaseResource) JsonWithRecordSet

func (r *BaseResource) JsonWithRecordSet(c *gin.Context, list interface{}, paging *fdmodel.Paging)

func (*BaseResource) PostForm

func (r *BaseResource) PostForm(c *gin.Context, key, errorMsg string) (value string)

*

  • 获取表单字段

func (*BaseResource) PostFormInt

func (r *BaseResource) PostFormInt(c *gin.Context, key, errorMsg string) int

*

  • 获取表单字段

func (*BaseResource) StaticFile

func (r *BaseResource) StaticFile(c *gin.Context, path string, filename string)

type Engine

type Engine struct {
	*gin.Engine
	Config *fdconfig.IniConfig
}

func Default

func Default(conf interface{}) *Engine

func (*Engine) Run

func (e *Engine) Run()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL