Documentation ¶
Index ¶
- type PostgresStore
- func (s *PostgresStore) CreateTodo(todo *models.Todo) error
- func (s *PostgresStore) CreateUser(acc *models.User) error
- func (s *PostgresStore) DeleteTodo(id int) error
- func (s *PostgresStore) GetTodoByID(id int) (*models.Todo, error)
- func (s *PostgresStore) GetTodos() ([]models.Todo, error)
- func (s *PostgresStore) GetUser() ([]models.User, error)
- func (s *PostgresStore) GetUserByID(id int) (*models.User, error)
- func (s *PostgresStore) GetUserByUserName(user_name string) (*models.User, error)
- func (s *PostgresStore) UpdateTodo(id int, todoUpdate *models.Todo) (*models.Todo, error)
- type Storage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostgresStore ¶
type PostgresStore struct {
// contains filtered or unexported fields
}
func NewPostgres ¶
func NewPostgres() (*PostgresStore, error)
NewPostgres set up the connection to with the db
func (*PostgresStore) CreateTodo ¶
func (s *PostgresStore) CreateTodo(todo *models.Todo) error
CreateTodo is a method that performs a query to create new todo
func (*PostgresStore) CreateUser ¶
func (s *PostgresStore) CreateUser(acc *models.User) error
func (*PostgresStore) DeleteTodo ¶
func (s *PostgresStore) DeleteTodo(id int) error
DeleteTodo is a method that performs a query to delete todos
func (*PostgresStore) GetTodoByID ¶
func (s *PostgresStore) GetTodoByID(id int) (*models.Todo, error)
GetTodoByID is a method that performs a query to get one todo by ID
func (*PostgresStore) GetTodos ¶
func (s *PostgresStore) GetTodos() ([]models.Todo, error)
GetTodos is a method that performs a query to get all the todos
func (*PostgresStore) GetUserByID ¶
func (s *PostgresStore) GetUserByID(id int) (*models.User, error)
func (*PostgresStore) GetUserByUserName ¶
func (s *PostgresStore) GetUserByUserName(user_name string) (*models.User, error)
func (*PostgresStore) UpdateTodo ¶
UpdateTodo is a method that performs a query to update todos
type Storage ¶
type Storage interface { GetTodos() ([]models.Todo, error) GetTodoByID(int) (*models.Todo, error) CreateTodo(*models.Todo) error DeleteTodo(int) error UpdateTodo(int, *models.Todo) (*models.Todo, error) GetUser() ([]models.User, error) GetUserByID(int) (*models.User, error) GetUserByUserName(string) (*models.User, error) CreateUser(*models.User) error }
Click to show internal directories.
Click to hide internal directories.