repository

package
v0.0.0-...-c70ca53 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDB

func NewPostgresDB(cfg Config) (*sqlx.DB, error)

Types

type AuthPostgres

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

func NewAuthPostgres

func NewAuthPostgres(db *sqlx.DB) *AuthPostgres

func (*AuthPostgres) CreateUser

func (r *AuthPostgres) CreateUser(user models.User) (int, error)

func (*AuthPostgres) GetUser

func (r *AuthPostgres) GetUser(username, password string) (models.User, error)

type Authorization

type Authorization interface {
	CreateUser(user models.User) (int, error)
	GetUser(username, password string) (models.User, error)
}

type Config

type Config struct {
	Host     string
	Port     string
	Username string
	Password string
	DBname   string
	SSLmode  string
}

type Repository

type Repository struct {
	Authorization
	TodoList
	TodoItem
}

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

type TodoItem

type TodoItem interface {
	Create(listId int, item models.TodoItem) (int, error)
	GetAll(userId, listId int) ([]models.TodoItem, error)
	GetById(userId, itemId int) (models.TodoItem, error)
	Delete(userId, itemId int) error
	Update(userId, itemId int, input models.UpdateItemInput) error
}

type TodoItemPostgres

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

func NewTodoItemPostgres

func NewTodoItemPostgres(db *sqlx.DB) *TodoItemPostgres

func (*TodoItemPostgres) Create

func (r *TodoItemPostgres) Create(listId int, item models.TodoItem) (int, error)

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 models.UpdateItemInput) error

type TodoList

type TodoList interface {
	Create(userId int, list models.TodoList) (int, error)
	GetAll(userId int) ([]models.TodoList, error)
	GetById(userId, listId int) (models.TodoList, error)
	Delete(userId, listId int) error
	Update(userId int, listId int, input models.UpdateListInput) error
}

type TodolistPostgres

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

func NewTodoListPostgres

func NewTodoListPostgres(db *sqlx.DB) *TodolistPostgres

func (*TodolistPostgres) Create

func (r *TodolistPostgres) Create(userId int, list models.TodoList) (int, error)

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 int, listId int, input models.UpdateListInput) error

Jump to

Keyboard shortcuts

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