Documentation ¶
Index ¶
- type Database
- func (db *Database) Acquire(sid string, expires time.Duration) sessions.LifeTime
- func (db *Database) Clear(sid string) error
- func (db *Database) Close() error
- func (db *Database) Decode(sid, key string, outPtr interface{}) error
- func (db *Database) Delete(sid string, key string) bool
- func (db *Database) Get(sid string, key string) interface{}
- func (db *Database) Len(sid string) int
- func (db *Database) OnUpdateExpiration(sid string, newExpires time.Duration) error
- func (db *Database) Release(sid string) error
- func (db *Database) Set(sid string, key string, value interface{}, _ time.Duration, _ bool) error
- func (db *Database) SetLogger(logger *golog.Logger)
- func (db *Database) Visit(sid string, cb func(key string, value interface{})) error
- type GormSession
- type Options
- type SessionData
- func (sd *SessionData) Clear()
- func (sd *SessionData) Delete(key string)
- func (sd *SessionData) Get(key string) (interface{}, error)
- func (sd *SessionData) GormDataType() string
- func (sd *SessionData) Len() int
- func (sd *SessionData) MarshalJSON() ([]byte, error)
- func (sd *SessionData) Scan(value interface{}) error
- func (sd *SessionData) Set(key string, value interface{})
- func (sd *SessionData) UnmarshalJSON(b []byte) error
- func (sd *SessionData) Value() (driver.Value, error)
- func (sd *SessionData) Visit(cb func(key string, value interface{}))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
func (*Database) 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 (*Database) OnUpdateExpiration ¶
OnUpdateExpiration will re-set the database's session's entry ttl.
func (*Database) Release ¶
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.
type GormSession ¶
type GormSession struct { ID int64 `gorm:"column:id;primaryKey"` SessionKey string `gorm:"column:session_key"` SessionData *SessionData `gorm:"column:session_data"` Expires time.Time `gorm:"column:expires"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at"` }
type Options ¶
type Options struct { Host string Port int Username string Password string DataBase string TableName string GormDB *gorm.DB }
func (*Options) GenerateDSN ¶
type SessionData ¶
type SessionData struct {
// contains filtered or unexported fields
}
func (*SessionData) Clear ¶
func (sd *SessionData) Clear()
func (*SessionData) Delete ¶
func (sd *SessionData) Delete(key string)
func (*SessionData) Get ¶
func (sd *SessionData) Get(key string) (interface{}, error)
func (*SessionData) GormDataType ¶
func (sd *SessionData) GormDataType() string
func (*SessionData) Len ¶
func (sd *SessionData) Len() int
func (*SessionData) MarshalJSON ¶
func (sd *SessionData) MarshalJSON() ([]byte, error)
MarshalJSON to output non base64 encoded []byte
func (*SessionData) Scan ¶
func (sd *SessionData) Scan(value interface{}) error
Scan scan value into Jsonb, implements sql.Scanner interface
func (*SessionData) Set ¶
func (sd *SessionData) Set(key string, value interface{})
func (*SessionData) UnmarshalJSON ¶
func (sd *SessionData) UnmarshalJSON(b []byte) error
UnmarshalJSON to deserialize []byte
func (*SessionData) Value ¶
func (sd *SessionData) Value() (driver.Value, error)
Value return json value, implement driver.Valuer interface
func (*SessionData) Visit ¶
func (sd *SessionData) Visit(cb func(key string, value interface{}))
Click to show internal directories.
Click to hide internal directories.