session

package
v0.0.0-...-50c9e83 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package session implements user sessions

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("session service: not found")
	ErrEmptySessionID = errors.New("session service: empty session id. set X-API-Session")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr       string
	Expiration time.Duration
	Username   string
	Password   string
	DBNum      int
}

func (*Config) Flags

func (c *Config) Flags(prefix string) *pflag.FlagSet

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(cfg Config) *Service

func (*Service) Create

func (s *Service) Create(uid int64) (string, error)

func (*Service) Get

func (s *Service) Get(uid int64) (*User, error)

func (*Service) Save

func (s *Service) Save(u *User) error

type User

type User struct {
	Sid string
	UID int64
}

Jump to

Keyboard shortcuts

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