Documentation
¶
Index ¶
- type AuthRedis
- type AuthStorage
- type NewsRedis
- type NewsStorage
- type SessionStorage
- func (s *SessionStorage) CreateSession(ctx context.Context, session *entity.Session, expire int) (string, error)
- func (s *SessionStorage) DeleteSessionByID(ctx context.Context, sessionID string) error
- func (s *SessionStorage) GetSessionByID(ctx context.Context, sessionID string) (*entity.Session, error)
- type Sessionredis
- type Storage
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 ¶
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 ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.