Documentation
¶
Index ¶
- Constants
- Variables
- type Session
- func (s *Session) Clear() error
- func (s *Session) Delete(key string) error
- func (s *Session) Destroy() error
- func (s *Session) Get(key string) (any, bool)
- func (s *Session) GetBool(key string) bool
- func (s *Session) GetInt(key string) int
- func (s *Session) GetInt64(key string) int64
- func (s *Session) GetString(key string) string
- func (s *Session) Has(key string) bool
- func (s *Session) IsEmpty() bool
- func (s *Session) Keys() []string
- func (s *Session) Set(key string, value any) error
- func (s *Session) Size() int
Constants ¶
View Source
const (
SessionKeyPrefix = "session:" // Storage key prefix | 存储键前缀
)
Constants for session keys | Session键常量
Variables ¶
View Source
var ( ErrSessionNotFound = fmt.Errorf("session not found") ErrInvalidSessionData = fmt.Errorf("invalid session data") )
Error variables | 错误变量
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
ID string `json:"id"` // Session ID | Session标识
CreateTime int64 `json:"createTime"` // Creation time | 创建时间
Data map[string]any `json:"data"` // Session data | 数据
// contains filtered or unexported fields
}
Session Session object for storing user data | 会话对象,用于存储用户数据
func NewSession ¶
NewSession Creates a new session | 创建新的Session
Click to show internal directories.
Click to hide internal directories.