redisrepo

package
v0.0.0-...-3c0f6d4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRedis

type AuthRedis interface {
	GetByIDCtx(ctx context.Context, key string) (*entity.User, error)
	SetUserCtx(ctx context.Context, key string, seconds int, user *entity.User) error
	DeleteUserCtx(ctx context.Context, key string) error
}

Auth StorageRedis interface

type AuthStorage

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

Auth Storage

func NewAuthStorage

func NewAuthStorage(redis *redis.Client) *AuthStorage

Auth Storage constructor

func (*AuthStorage) DeleteUserCtx

func (s *AuthStorage) DeleteUserCtx(ctx context.Context, key string) error

Delete user by key

func (*AuthStorage) GetByIDCtx

func (s *AuthStorage) GetByIDCtx(ctx context.Context, key string) (*entity.User, error)

Get user by id

func (*AuthStorage) SetUserCtx

func (s *AuthStorage) SetUserCtx(ctx context.Context, key string, seconds int, user *entity.User) error

Cache user with duration in seconds

type NewsRedis

type NewsRedis interface {
	GetNewsByIDCtx(ctx context.Context, key string) (*entity.NewsBase, error)
	SetNewsCtx(ctx context.Context, key string, seconds int, news *entity.NewsBase) error
	DeleteNewsCtx(ctx context.Context, key string) error
}

News StorageRedis interface

type NewsStorage

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

News storage

func NewNewsStorage

func NewNewsStorage(redis *redis.Client) *NewsStorage

News storage constructor

func (*NewsStorage) DeleteNewsCtx

func (n *NewsStorage) DeleteNewsCtx(ctx context.Context, key string) error

Delete news

func (*NewsStorage) GetNewsByIDCtx

func (n *NewsStorage) GetNewsByIDCtx(ctx context.Context, key string) (*entity.NewsBase, error)

Get news by id

func (*NewsStorage) SetNewsCtx

func (n *NewsStorage) SetNewsCtx(ctx context.Context, key string, seconds int, news *entity.NewsBase) error

Cache news item

type SessionStorage

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

Session storage

func NewSessionStorage

func NewSessionStorage(redis *redis.Client, config *config.Config) *SessionStorage

Session storage constructor

func (*SessionStorage) CreateSession

func (s *SessionStorage) CreateSession(ctx context.Context, session *entity.Session, expire int) (string, error)

Create session in redis

func (*SessionStorage) DeleteSessionByID

func (s *SessionStorage) DeleteSessionByID(ctx context.Context, sessionID string) error

Delete session by id

func (*SessionStorage) GetSessionByID

func (s *SessionStorage) GetSessionByID(ctx context.Context, sessionID string) (*entity.Session, error)

Update session in redis

type Sessionredis

type Sessionredis interface {
	CreateSession(ctx context.Context, session *entity.Session, expire int) (string, error)
	GetSessionByID(ctx context.Context, sessionID string) (*entity.Session, error)
	DeleteSessionByID(ctx context.Context, sessionID string) error
}

Session redis storage interface

type Storage

type Storage struct {
	Auth    *AuthStorage
	News    *NewsStorage
	Session *SessionStorage
}

func NewStorage

func NewStorage(redis *redis.Client, config *config.Config) *Storage

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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