repository

package
v0.0.0-...-7408042 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDB

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

Types

type Advert interface {
	GetByOrder(params common.AdvertSortOrderParams, advertCount int) ([]common.AdvertsListItem, error)
	GetById() error
	Create(common.AdvertWithPhoto) (int, error)
	Get(advertId int, params common.AdvertFieldParams) (common.AdvertWithPhoto, error)
	Update() error
	Delete() error
}

type AdvertPostgres

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

func NewAdvertPostgres

func NewAdvertPostgres(db *sqlx.DB) *AdvertPostgres

func (*AdvertPostgres) Create

func (a *AdvertPostgres) Create(advert common.AdvertWithPhoto) (int, error)

func (*AdvertPostgres) Delete

func (a *AdvertPostgres) Delete() error

func (*AdvertPostgres) Get

func (*AdvertPostgres) GetById

func (a *AdvertPostgres) GetById() error

func (*AdvertPostgres) GetByOrder

func (a *AdvertPostgres) GetByOrder(params common.AdvertSortOrderParams, advertCount int) ([]common.AdvertsListItem, error)

func (*AdvertPostgres) Update

func (a *AdvertPostgres) Update() error

type Config

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

type Repository

type Repository struct {
	Advert
}

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

Jump to

Keyboard shortcuts

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