Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type OptionFunc ¶
type OptionFunc func(*Option)
func WithExpire ¶
func WithExpire(expire time.Duration) OptionFunc
type SQLiteSessionManager ¶
type SQLiteSessionManager struct {
// contains filtered or unexported fields
}
func (*SQLiteSessionManager) Load ¶
func (s *SQLiteSessionManager) Load(sessionID string, opts ...OptionFunc) (Session, error)
func (*SQLiteSessionManager) New ¶
func (s *SQLiteSessionManager) New(sessionID string, opts ...OptionFunc) (Session, error)
type Session ¶
type Session interface { // Set - store value of this session Set(value interface{}, opt Option) error // Get - get persistent value of this session set before Get() (value interface{}, err error) // Close - close the session Close() error }
Session - maintain the session about a user or group
type SessionManager ¶
type SessionManager interface { // New - create a new session // it will start a new session // if the session is created before, it will overwrite it New(sessionID string, opts ...OptionFunc) (Session, error) // Load - get the session // if the session is created before, it will load the existing session // else return error Load(sessionID string, opts ...OptionFunc) (Session, error) }
func NewSQLLiteSessionManager ¶
func NewSQLLiteSessionManager(dsn string) (SessionManager, error)
type SessionModel ¶
type SessionModel struct { CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` ID string `json:"session_id" gorm:"column:session_id;primaryKey"` Value string `json:"session_value" gorm:"column:session_value"` Expire int64 `json:"session_expire" gorm:"column:session_expire"` }
func (*SessionModel) TableName ¶
func (s *SessionModel) TableName() string
type SqliteSession ¶
type SqliteSession struct { SessionID string // contains filtered or unexported fields }
func (*SqliteSession) Close ¶
func (s *SqliteSession) Close() error
func (*SqliteSession) Get ¶
func (s *SqliteSession) Get() (interface{}, error)
func (*SqliteSession) Set ¶
func (s *SqliteSession) Set(value interface{}, opt Option) (err error)
Click to show internal directories.
Click to hide internal directories.