db

package
v0.129.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host     string `envconfig:"POSTGRES_HOST"`
	Port     string `envconfig:"POSTGRES_PORT"`
	User     string `envconfig:"POSTGRES_USER"`
	Password string `envconfig:"POSTGRES_PASSWORD"`
	Database string `envconfig:"POSTGRES_DATABASE"`
}

type DbClient

type DbClient struct {
	PgxPool *pgxpool.Pool
	// contains filtered or unexported fields
}

func NewDbClientFromEnvironment

func NewDbClientFromEnvironment(lg *zap.Logger) (*DbClient, error)

func (*DbClient) AutoMigrate

func (d *DbClient) AutoMigrate(ctx context.Context) error

func (*DbClient) CreateOrUpdateIncidents

func (d *DbClient) CreateOrUpdateIncidents(ctx context.Context, incidents []api.Incident) error

func (*DbClient) DeleteStatusPage added in v0.121.0

func (d *DbClient) DeleteStatusPage(background context.Context, url string) error

func (*DbClient) GetAllStatusPages

func (d *DbClient) GetAllStatusPages(ctx context.Context) ([]api.StatusPage, error)

func (*DbClient) GetCurrentIncidents added in v0.11.0

func (d *DbClient) GetCurrentIncidents(ctx context.Context, statusPageUrl string) ([]api.Incident, error)

Current incidents are incidents that have not ended and have a start time in the last two weeks The two week cutiff is not ideal but some incidents don't have a specified end time

func (*DbClient) GetIncidents

func (d *DbClient) GetIncidents(ctx context.Context, statusPageUrl string) ([]api.Incident, error)

func (*DbClient) GetIncidentsWithoutJobsStarted added in v0.92.0

func (d *DbClient) GetIncidentsWithoutJobsStarted(ctx context.Context, limit int) ([]api.Incident, error)

func (*DbClient) GetStatusPage

func (d *DbClient) GetStatusPage(ctx context.Context, url string) (*api.StatusPage, error)

func (*DbClient) InsertStatusPage

func (d *DbClient) InsertStatusPage(ctx context.Context, statusPage api.StatusPage) error

func (*DbClient) SeedStatusPages

func (d *DbClient) SeedStatusPages() error

func (*DbClient) SetIncidentNotificationStartedToTrue added in v0.92.0

func (d *DbClient) SetIncidentNotificationStartedToTrue(ctx context.Context, incidents []api.Incident) error

func (*DbClient) UpdateStatusPage

func (d *DbClient) UpdateStatusPage(ctx context.Context, statusPage api.StatusPage) error

Jump to

Keyboard shortcuts

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