model

package
v1.2.2-0...-4b8647b Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	// ID is the session ID
	ID         string       `json:"id"`
	UserID     string       `json:"user_id"`
	RemoteAddr string       `json:"remote_addr"`
	Time       *SessionTime `json:"time"`
}

func NewSession

func NewSession(ctx context.Context, db redis.UniversalClient, userID, RemoteAddr string, time *SessionTime) (*Session, error)

func (*Session) Delete

func (s *Session) Delete(ctx context.Context, db redis.UniversalClient) error

func (Session) Expiration

func (s Session) Expiration() time.Duration

func (Session) Key

func (s Session) Key() string

func (*Session) Load

func (s *Session) Load(ctx context.Context, db redis.UniversalClient) error

func (*Session) Update

func (s *Session) Update(ctx context.Context, db redis.UniversalClient) error

type SessionTime

type SessionTime struct {
	// MaxTime is the time when the session will expire and won't be able to be renewed
	MaxTime time.Time `json:"max_time"`
	//  MaxRenewTime is the time when the session won't be able to be renewed
	MaxRenewTime time.Time `json:"max_renew_time"`
	// ExpirationTime is the time when the session will expire if it's not renewed
	ExpirationTime time.Time `json:"expiration_time"`
}

SessionTime contains all the information related with the lifespan of the session

type User

type User struct {
	ID        string `json:"id"`
	SessionID string `json:"session_id"`
	// contains filtered or unexported fields
}

func NewUser

func NewUser(ctx context.Context, db redis.UniversalClient, id string, sessID string, expiration time.Time) (*User, error)

func (*User) Delete

func (u *User) Delete(ctx context.Context, db redis.UniversalClient) error

func (User) Expiration

func (u User) Expiration() time.Duration

func (User) Key

func (u User) Key() string

func (*User) Load

func (u *User) Load(ctx context.Context, db redis.UniversalClient) error

func (*User) Update

func (u *User) Update(ctx context.Context, db redis.UniversalClient) error

Jump to

Keyboard shortcuts

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