postgres

package
v0.0.0-...-736631f Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NumElementsInPage = 10
)

Variables

This section is empty.

Functions

func NewPostgresDB

func NewPostgresDB(cfg Config) (*sqlx.DB, error)

Types

type AdvertPg

type AdvertPg struct {
	// contains filtered or unexported fields
}

func NewAdvertPg

func NewAdvertPg(db *sqlx.DB) *AdvertPg

func (*AdvertPg) Create

func (r *AdvertPg) Create(advert *model.DetailedAdvert) (int, error)

func (*AdvertPg) GetAll

func (r *AdvertPg) GetAll(page int, sortField, order string) ([]*model.Advert, error)

func (*AdvertPg) GetById

func (r *AdvertPg) GetById(advertId int, fields bool) (*model.DetailedAdvert, error)

type Config

type Config struct {
	Host     string
	Port     string
	Username string
	Password string
	DBName   string
	SSLMode  string
}

Jump to

Keyboard shortcuts

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