Documentation
¶
Index ¶
- Constants
- type MysqlStore
- func (st *MysqlStore) Check(sid string) bool
- func (st *MysqlStore) CreateStore() string
- func (st *MysqlStore) Delete(sid string) error
- func (st *MysqlStore) Get(sid string, key string) (interface{}, error)
- func (st *MysqlStore) Init(tm time.Time) (string, error)
- func (st *MysqlStore) InitStore(db interface{}, tableName string) error
- func (st *MysqlStore) Refresh(sid string) (string, error)
- func (st *MysqlStore) RemoveKey(sid string, key string) error
- func (st *MysqlStore) Set(sid string, key string, value interface{}) error
- type RedisStore
- func (st *RedisStore) Check(sid string) bool
- func (st *RedisStore) CreateStore() string
- func (st *RedisStore) Delete(sid string) error
- func (st *RedisStore) Get(sid string, key string) (interface{}, error)
- func (st *RedisStore) Init(tm time.Time) (string, error)
- func (st *RedisStore) InitStore(client interface{}, prefix string) error
- func (st *RedisStore) Refresh(sid string) (string, error)
- func (st *RedisStore) RemoveKey(sid string, key string) error
- func (st *RedisStore) Set(sid string, key string, value interface{}) error
- type SessionData
- type Store
Constants ¶
View Source
const ( ErrSessionExpired = "session expired" ErrSessionAlreadyExists = "session already exists" ErrSessionNotFound = "session not found" ErrKeyNotFound = "key not found" ErrWhileConnectingMysql = "unable to connect to MySQL" ErrUnableSerializeJson = "unable to serialize in json format" ErrSqlInsertQuery = "error in SQL insert query" ErrSqlSelectQuery = "error in SQL select query" ErrSqlUpdateQuery = "error in SQL update query" ErrSqlDeleteQuery = "error in SQL delete query" ErrParsingExpiresAt = "error while parsing expires_at" ErrUnableUnserializeJson = "unable to unserialize json data" ErrInvTableName = "invalid table name" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MysqlStore ¶
type MysqlStore struct {
// contains filtered or unexported fields
}
func (*MysqlStore) Check ¶
func (st *MysqlStore) Check(sid string) bool
Controlla se una sessione esiste (dato il sid).
func (*MysqlStore) CreateStore ¶
func (st *MysqlStore) CreateStore() string
func (*MysqlStore) Delete ¶
func (st *MysqlStore) Delete(sid string) error
Cancella un'intera sessione (dato il sid).
func (*MysqlStore) Get ¶
func (st *MysqlStore) Get(sid string, key string) (interface{}, error)
Ottiene il valore di una chiave di una sessione (dati sid e key).
func (*MysqlStore) Init ¶
func (st *MysqlStore) Init(tm time.Time) (string, error)
Inizializza una sessione, restituendo il sid.
func (*MysqlStore) InitStore ¶
func (st *MysqlStore) InitStore(db interface{}, tableName string) error
Inizializza lo store.
func (*MysqlStore) Refresh ¶
func (st *MysqlStore) Refresh(sid string) (string, error)
Duplica la sessione con il sid dato (che viene eliminata).
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func (*RedisStore) Check ¶
func (st *RedisStore) Check(sid string) bool
func (*RedisStore) CreateStore ¶
func (st *RedisStore) CreateStore() string
func (*RedisStore) Delete ¶
func (st *RedisStore) Delete(sid string) error
func (*RedisStore) InitStore ¶
func (st *RedisStore) InitStore(client interface{}, prefix string) error
type SessionData ¶
type SessionData map[string]interface{}
type Store ¶
type Store interface {
CreateStore() string
InitStore(interface{}, string) error
Init(time.Time) (string, error)
Check(string) bool
Get(sid string, key string) (interface{}, error)
Set(sid string, key string, value interface{}) error
RemoveKey(sid string, key string) error
Delete(sid string) error
Refresh(sid string) (string, error)
}
Click to show internal directories.
Click to hide internal directories.