Documentation ¶
Index ¶
- func NewPostgresDB(cfg PostgresConfig) (*sqlx.DB, error)
- func NewRedisCache(cfg RedisConfig) *redis.Client
- type AuthPostgres
- type Authorization
- type PostgresConfig
- type RedisConfig
- type Repository
- type TodoItem
- type TodoItemPostgres
- func (r *TodoItemPostgres) Create(listId int, item models.TodoItem) (int, error)
- func (r *TodoItemPostgres) Delete(userId, itemId int) error
- func (r *TodoItemPostgres) GetAll(userId, listId int) ([]models.TodoItem, error)
- func (r *TodoItemPostgres) GetById(userId, itemId int) (models.TodoItem, error)
- func (r *TodoItemPostgres) Update(userId, itemId int, input dto.UpdateItem) error
- type TodoList
- type TodoListPostgres
- func (r *TodoListPostgres) Create(userId int, list models.TodoList) (int, error)
- func (r *TodoListPostgres) Delete(userId, listId int) error
- func (r *TodoListPostgres) GetAll(userId int) ([]models.TodoList, error)
- func (r *TodoListPostgres) GetById(userId, listId int) (models.TodoList, error)
- func (r *TodoListPostgres) Update(userId, listId int, input dto.UpdateList) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRedisCache ¶
func NewRedisCache(cfg RedisConfig) *redis.Client
Types ¶
type AuthPostgres ¶
type AuthPostgres struct {
// contains filtered or unexported fields
}
func NewAuthPostgres ¶
func NewAuthPostgres(db *sqlx.DB, cache *redis.Client) *AuthPostgres
func (*AuthPostgres) CreateUser ¶
func (r *AuthPostgres) CreateUser(user models.User) (int, error)
func (*AuthPostgres) GetRefreshToken ¶
func (r *AuthPostgres) GetRefreshToken(userId int) (string, error)
func (*AuthPostgres) GetUserByUsername ¶
func (r *AuthPostgres) GetUserByUsername(username string) (models.User, error)
func (*AuthPostgres) SaveRefreshToken ¶
func (r *AuthPostgres) SaveRefreshToken(userId int, token string) error
type Authorization ¶
type PostgresConfig ¶
type PostgresConfig struct { Host string Port string Username string Password string DBName string SSLMode string }
PostgresConfig for postgres db connection
type RedisConfig ¶
type Repository ¶
type Repository struct { Authorization TodoList TodoItem }
func NewRepository ¶
func NewRepository(db *sqlx.DB, cache *redis.Client) *Repository
NewRepository returns new repository
type TodoItemPostgres ¶
type TodoItemPostgres struct {
// contains filtered or unexported fields
}
func NewTodoItemPostgres ¶
func NewTodoItemPostgres(db *sqlx.DB) *TodoItemPostgres
func (*TodoItemPostgres) Delete ¶
func (r *TodoItemPostgres) Delete(userId, itemId int) error
func (*TodoItemPostgres) GetAll ¶
func (r *TodoItemPostgres) GetAll(userId, listId int) ([]models.TodoItem, error)
func (*TodoItemPostgres) GetById ¶
func (r *TodoItemPostgres) GetById(userId, itemId int) (models.TodoItem, error)
func (*TodoItemPostgres) Update ¶
func (r *TodoItemPostgres) Update(userId, itemId int, input dto.UpdateItem) error
type TodoListPostgres ¶
type TodoListPostgres struct {
// contains filtered or unexported fields
}
func NewTodoListPostgres ¶
func NewTodoListPostgres(db *sqlx.DB) *TodoListPostgres
func (*TodoListPostgres) Delete ¶
func (r *TodoListPostgres) Delete(userId, listId int) error
func (*TodoListPostgres) GetAll ¶
func (r *TodoListPostgres) GetAll(userId int) ([]models.TodoList, error)
func (*TodoListPostgres) GetById ¶
func (r *TodoListPostgres) GetById(userId, listId int) (models.TodoList, error)
func (*TodoListPostgres) Update ¶
func (r *TodoListPostgres) Update(userId, listId int, input dto.UpdateList) error
Click to show internal directories.
Click to hide internal directories.