Documentation ¶
Index ¶
- Variables
- func DownloadController(ctx iris.Context)
- func GetSession() *sessions.Sessions
- func HTMLController(ctx iris.Context)
- func MainController(ctx iris.Context)
- func NewDatabase() sessions.Database
- func RegistTemplateParam(key string, param interface{}) error
- func UploadController(ctx iris.Context)
- type BaseController
- func (this *BaseController) Delete(ctx iris.Context)
- func (this *BaseController) Find(ctx iris.Context)
- func (this *BaseController) Get(ctx iris.Context)
- func (this *BaseController) Insert(ctx iris.Context)
- func (this *BaseController) ReadJSON(ctx iris.Context) ([]interface{}, error)
- func (this *BaseController) Save(ctx iris.Context)
- func (this *BaseController) Update(ctx iris.Context)
- func (this *BaseController) Upsert(ctx iris.Context)
- type PageParam
- type QueryParas
- type UploadParam
- type XORMDatabase
- func (db *XORMDatabase) Acquire(sid string, expires time.Duration) sessions.LifeTime
- func (db *XORMDatabase) Clear(sid string) error
- func (db *XORMDatabase) Close() error
- func (db *XORMDatabase) Decode(sid string, key string, outPtr interface{}) error
- func (db *XORMDatabase) Delete(sid string, key string) (deleted bool)
- func (db *XORMDatabase) Get(sid string, key string) (value interface{})
- func (db *XORMDatabase) Len(sid string) (n int)
- func (db *XORMDatabase) OnUpdateExpiration(sid string, newExpires time.Duration) error
- func (db *XORMDatabase) Release(sid string) error
- func (db *XORMDatabase) Set(sid string, key string, value interface{}, ttl time.Duration, immutable bool) error
- func (db *XORMDatabase) SetLogger(logger *golog.Logger)
- func (db *XORMDatabase) Visit(sid string, cb func(key string, value interface{})) error
Constants ¶
This section is empty.
Variables ¶
var TemplateParams = make(map[string]interface{})
Functions ¶
func DownloadController ¶
func DownloadController(ctx iris.Context)
func GetSession ¶
func HTMLController ¶
func HTMLController(ctx iris.Context)
func MainController ¶
func MainController(ctx iris.Context)
func NewDatabase ¶
func RegistTemplateParam ¶
func UploadController ¶
func UploadController(ctx iris.Context)
Types ¶
type BaseController ¶
type BaseController struct { BaseService service.BaseService ParseJSON func(json []byte) (interface{}, error) }
func GetBaseController ¶
func GetBaseController() *BaseController
func (*BaseController) Delete ¶
func (this *BaseController) Delete(ctx iris.Context)
delete model in database Delete records, bean's non-empty fields are conditions
func (*BaseController) Find ¶
func (this *BaseController) Find(ctx iris.Context)
Find retrieve records from table, condiBeans's non-empty fields are conditions. beans could be []Struct, []*Struct, map[int64]Struct map[int64]*Struct everyone := make([]Userinfo, 0) err := engine.Find(&everyone)
func (*BaseController) Get ¶
func (this *BaseController) Get(ctx iris.Context)
Get retrieve one record from database, bean's non-empty fields will be as conditions
func (*BaseController) Insert ¶
func (this *BaseController) Insert(ctx iris.Context)
insert model data to database
func (*BaseController) ReadJSON ¶
func (this *BaseController) ReadJSON(ctx iris.Context) ([]interface{}, error)
* 返回读取json数据转换成相应的输入数据,1.实体数组;2.实体;3.分页参数,含有条件实体;4.映射 后面三项返回的参数放入数组中
func (*BaseController) Save ¶
func (this *BaseController) Save(ctx iris.Context)
func (*BaseController) Update ¶
func (this *BaseController) Update(ctx iris.Context)
update model to database. cols set the columns those want to update.
func (*BaseController) Upsert ¶
func (this *BaseController) Upsert(ctx iris.Context)
type QueryParas ¶
type QueryParas struct { CondiBean interface{} Data []interface{} Conditions []interface{} Columns []string }
type UploadParam ¶
type UploadParam struct {
ServiceName string
}
type XORMDatabase ¶
type XORMDatabase struct {
// contains filtered or unexported fields
}
* 会话数据的数据库集中存储XORM,适用于集群环境的集中会话管理,有另外的两个实现 分别是redis和badger,都是实现了sessions.Database接口,并设置session使用这个接口的实现
func (*XORMDatabase) Acquire ¶
* 没有实现完毕,没有测试
Acquire receives a session's lifetime from the database, if the return value is LifeTime{} then the session manager sets the life time based on the expiration duration lives in configuration.
func (*XORMDatabase) Clear ¶
func (db *XORMDatabase) Clear(sid string) error
Clear removes all session key values but it keeps the session entry.
func (*XORMDatabase) Close ¶
func (db *XORMDatabase) Close() error
Close terminates the redis connection.
func (*XORMDatabase) Decode ¶
func (db *XORMDatabase) Decode(sid string, key string, outPtr interface{}) error
func (*XORMDatabase) Delete ¶
func (db *XORMDatabase) Delete(sid string, key string) (deleted bool)
Delete removes a session key value based on its key.
func (*XORMDatabase) Get ¶
func (db *XORMDatabase) Get(sid string, key string) (value interface{})
Get retrieves a session value based on the key.
func (*XORMDatabase) Len ¶
func (db *XORMDatabase) Len(sid string) (n int)
Len returns the length of the session's entries (keys).
func (*XORMDatabase) OnUpdateExpiration ¶
func (db *XORMDatabase) OnUpdateExpiration(sid string, newExpires time.Duration) error
OnUpdateExpiration will re-set the database's session's entry ttl. https://redis.io/commands/expire#refreshing-expires
func (*XORMDatabase) Release ¶
func (db *XORMDatabase) Release(sid string) error
Release destroys the session, it clears and removes the session entry, session manager will create a new session ID on the next request after this call.
func (*XORMDatabase) Set ¶
func (db *XORMDatabase) Set(sid string, key string, value interface{}, ttl time.Duration, immutable bool) error
Set sets a key value of a specific session. Ignore the "immutable".
func (*XORMDatabase) SetLogger ¶
func (db *XORMDatabase) SetLogger(logger *golog.Logger)
SetLogger sets the logger once before server ran. By default the Iris one is injected.