repository

package
v0.0.0-...-8b1ddc7 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 5 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 todo.User) (int, error)

func (*AuthPostgres) GetUser

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

type Authorization

type Authorization interface {
	CreateUser(user todo.User) (int, error)
	GetUser(username, password string) (todo.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 todo.TodoItem) (int, error)
	GetAll(userId, listId int) ([]todo.TodoItem, error)
	GetById(userId, itemId int) (todo.TodoItem, error)
	Delete(userId, itemId int) error
	Update(userId, itemId int, input todo.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 todo.TodoItem) (int, error)

func (*TodoItemPostgres) Delete

func (r *TodoItemPostgres) Delete(userId, itemId int) error

func (*TodoItemPostgres) GetAll

func (r *TodoItemPostgres) GetAll(userId, listId int) ([]todo.TodoItem, error)

func (*TodoItemPostgres) GetById

func (r *TodoItemPostgres) GetById(userId, itemId int) (todo.TodoItem, error)

func (*TodoItemPostgres) Update

func (r *TodoItemPostgres) Update(userId, itemId int, input todo.UpdateItemInput) error

type TodoList

type TodoList interface {
	Create(userId int, list todo.TodoList) (int, error)
	GetAll(userId int) ([]todo.TodoList, error)
	GetById(userId, listId int) (todo.TodoList, error)
	Delete(userId, listId int) error
	Update(userId, listId int, input todo.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 todo.TodoList) (int, error)

func (*TodoListPostgres) Delete

func (r *TodoListPostgres) Delete(userId, listId int) error

func (*TodoListPostgres) GetAll

func (r *TodoListPostgres) GetAll(userId int) ([]todo.TodoList, error)

func (*TodoListPostgres) GetById

func (r *TodoListPostgres) GetById(userId, listId int) (todo.TodoList, error)

func (*TodoListPostgres) Update

func (r *TodoListPostgres) Update(userId, listId int, input todo.UpdateListInput) error

Jump to

Keyboard shortcuts

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