Documentation ¶
Index ¶
- func NewZapLogger(logger *zap.Logger) *zapadapter.Logger
- type Config
- type Repository
- func (repo *Repository) CreatePublication(ctx context.Context, p *entity.Publication) error
- func (repo *Repository) CreatePublisher(ctx context.Context, p *entity.Publisher) error
- func (repo *Repository) DeletePublication(ctx context.Context, uuid uuid.UUID) error
- func (repo *Repository) DeletePublisher(ctx context.Context, uuid uuid.UUID) error
- func (repo *Repository) GetPublication(ctx context.Context, uuid uuid.UUID) (*entity.Publication, error)
- func (repo *Repository) GetPublications(ctx context.Context) ([]*entity.Publication, error)
- func (repo *Repository) GetPublicationsByPublisher(ctx context.Context, publisherUUID uuid.UUID) ([]*entity.Publication, error)
- func (repo *Repository) GetPublisher(ctx context.Context, uuid uuid.UUID) (*entity.Publisher, error)
- func (repo *Repository) GetPublishers(ctx context.Context) ([]*entity.Publisher, error)
- func (repo *Repository) Healthcheck(ctx context.Context) error
- func (repo *Repository) UpdatePublication(ctx context.Context, p *entity.Publication) error
- func (repo *Repository) UpdatePublisher(ctx context.Context, p *entity.Publisher) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewZapLogger ¶
func NewZapLogger(logger *zap.Logger) *zapadapter.Logger
Types ¶
type Config ¶
type Config struct { Name string `mapstructure:"name"` Hostname string `mapstructure:"hostname"` Port string `mapstructure:"port"` Username string `mapstructure:"username"` Password string `mapstructure:"password"` SSLMode string `mapstructure:"sslmode"` LogLevel string `mapstructure:"log_level"` MinConnections int32 `mapstructure:"min_connections"` MaxConnections int32 `mapstructure:"max_connections"` }
Config defines database configuration, usable for Viper
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is repository implementation based on pgxpool
func New ¶
func New(databaseConfig *Config, logger pgx.Logger) (*Repository, error)
New creates pgx pool from configuration
func (*Repository) CreatePublication ¶
func (repo *Repository) CreatePublication(ctx context.Context, p *entity.Publication) error
CreatePublication inserts new publisher into db
func (*Repository) CreatePublisher ¶
CreatePublisher inserts new publisher into db
func (*Repository) DeletePublication ¶
DeletePublication removes Publications from db
func (*Repository) DeletePublisher ¶
DeletePublisher removes Publishers from db
func (*Repository) GetPublication ¶
func (repo *Repository) GetPublication(ctx context.Context, uuid uuid.UUID) (*entity.Publication, error)
GetPublication returns Publication from db
func (*Repository) GetPublications ¶
func (repo *Repository) GetPublications(ctx context.Context) ([]*entity.Publication, error)
GetPublications returns list of Publication from db
func (*Repository) GetPublicationsByPublisher ¶
func (repo *Repository) GetPublicationsByPublisher(ctx context.Context, publisherUUID uuid.UUID) ([]*entity.Publication, error)
GetPublicationsByPublisher returns list of Publication filterered by publisher uuid
func (*Repository) GetPublisher ¶
func (repo *Repository) GetPublisher(ctx context.Context, uuid uuid.UUID) (*entity.Publisher, error)
GetPublisher returns Publisher from db
func (*Repository) GetPublishers ¶
GetPublishers returns list of Publisher from db
func (*Repository) Healthcheck ¶
func (repo *Repository) Healthcheck(ctx context.Context) error
Healthcheck is needed for application healtchecks
func (*Repository) UpdatePublication ¶
func (repo *Repository) UpdatePublication(ctx context.Context, p *entity.Publication) error
UpdatePublication updates Publication in db
func (*Repository) UpdatePublisher ¶
UpdatePublisher updates Publisher in db