postgres

package
v0.0.0-...-ab52134 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

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) GetUser

func (s *PostgresStore) GetUser() ([]models.User, error)

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

func (s *PostgresStore) UpdateTodo(id int, todoUpdate *models.Todo) (*models.Todo, error)

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
}

Jump to

Keyboard shortcuts

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