postgres

package
v0.0.0-...-46354e0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host, Port, User, Password, Database string
}

Config holds the configuration used for instantiating a new DataStore.

type DataStore

type DataStore struct {
	Db *sql.DB
	// contains filtered or unexported fields
}

func New

func New(cfg Config) (DataStore, error)

New returns a DataStore instance with the sql.DB set with the postgres

type ProductStore

type ProductStore struct {
	Store DataStore
}

ProductStore provides persistence logic for "products" table

func (ProductStore) Create

func (productStore ProductStore) Create(product domain.Product) (domain.Product, error)

ToDO: Write CRUD operations here Create creates a new Product

type UserStore

type UserStore struct {
	Store DataStore
}

UserStore provides persistence logic for "users" table

func (UserStore) Create

func (userStore UserStore) Create(user domain.User, password string) (domain.User, error)

Create creates a new User

func (UserStore) Login

func (userStore UserStore) Login(email, password string) (domain.User, error)

Login authenticates the User

Jump to

Keyboard shortcuts

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