Documentation
¶
Overview ¶
Package postgres handles all requests down to database.
Index ¶
- Variables
- func Connect(dsn string) (*pgxpool.Pool, error)
- func FormatAnd(column string, value string) string
- func FormatAndInt(column string, value int) string
- func FormatLimitOffset(limit int, offset int) string
- func FormatSort(column string) string
- func NewCartStore(db *pgxpool.Pool) cartStore
- func NewCategoryStore(db *pgxpool.Pool) categoryStore
- func NewProductStore(db *pgxpool.Pool) productStore
- func NewSearchStore(db *pgxpool.Pool) searchStore
- func NewTokenStore(db *pgxpool.Pool) tokenStore
- func NewUserStore(db *pgxpool.Pool) userStore
- type Postgres
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrBeginTransaction returned when transaction fails from beginning. ErrBeginTransaction = errors.New("failed to begin transaction") // ErrCommitTransaction returned when commit transaction fails. ErrCommitTransaction = errors.New("failed to commit transaction") )
Functions ¶
func FormatAndInt ¶
FormatAndInt returns a SQL string for a giving column and integer value.
func FormatLimitOffset ¶
FormatLimitOffset returns a SQL string for a given limit & offset.
func FormatSort ¶
FormatSort returns a SQL string for a giving column.
func NewCartStore ¶
NewCartStore returns a new instance of CartStore.
func NewCategoryStore ¶
NewCategoryStore returns a new instance of CategoriesStore.
func NewProductStore ¶
NewProductStore returns a new instance of ProductStore.
func NewSearchStore ¶
NewSearchStore returns a new instance of SearchStore.
func NewTokenStore ¶
NewTokenStore returns a new instance of TokenStore
func NewUserStore ¶
NewUserStore returns a new instance of UsersStore.
Types ¶
Click to show internal directories.
Click to hide internal directories.