session

package
v0.0.0-...-addaa65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SessionNotFound = conuwa.NewError(conuwa.SessionNotFound)
	SessionGenFail  = conuwa.NewError(conuwa.SessionGenFail)
)

Functions

This section is empty.

Types

type BaseSession

type BaseSession struct {
	Role RoleType `json:"role,omitempty" yaml:"role,omitempty"`
}

func (*BaseSession) BaseSession

func (p *BaseSession) BaseSession() *BaseSession

type RoleType

type RoleType string
const (
	RolePublic  RoleType = "public"
	RoleSystem  RoleType = "system"
	RoleAdmin   RoleType = "admin"
	RoleUser    RoleType = "user"
	RoleVisitor RoleType = "visitor"
)

func (RoleType) String

func (p RoleType) String() string

type Session

type Session[M sessionInterface] struct {
	// contains filtered or unexported fields
}

func NewSession

func NewSession[M sessionInterface](cli *redis.Client, expire time.Duration) *Session[M]

func (*Session[M]) GenSessionId

func (p *Session[M]) GenSessionId() string

func (*Session[M]) Get

func (p *Session[M]) Get(key string) (M, error)

func (*Session[M]) Set

func (p *Session[M]) Set(m M) (string, error)

func (*Session[M]) SetWithExpire

func (p *Session[M]) SetWithExpire(m M, expire time.Duration) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL