redis

package
v0.0.0-...-4f702ff Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepository

func NewRepository(db redis.IDB) *repository

Types

type Repository

type Repository interface {
	DB() goredis.Cmdable
	Close() error
}

Repository is an interface of repository

type SessionRepository

type SessionRepository struct {
	Repository
	SessionLifeTime time.Duration
}

SessionRepository is a repository for the session entity

func NewSessionRepository

func NewSessionRepository(repository Repository, sessionLifeTimeInHours uint) (*SessionRepository, error)

NewSessionRepository creates a new SessionRepository

func (*SessionRepository) Delete

func (r *SessionRepository) Delete(ctx context.Context, ID string) error

Delete removes the entity with given ID from the storage.

func (*SessionRepository) Get

Get returns the Session with the specified ID.

func (*SessionRepository) Set

func (r *SessionRepository) Set(ctx context.Context, entity *session.Session) error

type TgSessionRepository

type TgSessionRepository struct {
	Repository
	ID string
}

SessionRepository is a repository for the tg session

func NewTgSessionRepository

func NewTgSessionRepository(repository Repository) *TgSessionRepository

NewTgSessionRepository creates a new TgSessionRepository

func (*TgSessionRepository) Delete

func (r *TgSessionRepository) Delete(ctx context.Context, ID string) error

Delete removes the entity with given ID from the storage.

func (*TgSessionRepository) Get

Get returns the TgSession with the specified ID.

func (*TgSessionRepository) Set

func (r *TgSessionRepository) Set(ctx context.Context, entity *tg.Session) error

Jump to

Keyboard shortcuts

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