storage

package
v0.0.0-...-0c3b333 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CsvReport

type CsvReport struct {
	Year  uint       `json:"year" validate:"required"`
	Month time.Month `json:"month" validate:"required"`
}

type PostgresDB

type PostgresDB struct {
	DB *pgxpool.Pool
}

func New

func New(ctx context.Context) (*PostgresDB, error)

func (*PostgresDB) AddSegment

func (pg *PostgresDB) AddSegment(ctx context.Context, segment Segment, log *slog.Logger) (uint64, error)

func (*PostgresDB) AddUser

func (pg *PostgresDB) AddUser(ctx context.Context, user User, log *slog.Logger) (uint64, error)

func (*PostgresDB) AddUserToSegments

func (pg *PostgresDB) AddUserToSegments(ctx context.Context, userSegment UserSegments, log *slog.Logger) error

func (*PostgresDB) CascadeDeleteSegment

func (pg *PostgresDB) CascadeDeleteSegment(ctx context.Context, segment Segment, log *slog.Logger) error

func (*PostgresDB) Close

func (pg *PostgresDB) Close()

func (*PostgresDB) CsvHistoryReport

func (pg *PostgresDB) CsvHistoryReport(ctx context.Context, csvDates CsvReport, log *slog.Logger) error

func (*PostgresDB) DeleteUserFromSegments

func (pg *PostgresDB) DeleteUserFromSegments(ctx context.Context, userSegment UserSegments, log *slog.Logger) error

func (*PostgresDB) DropDB

func (pg *PostgresDB) DropDB(ctx context.Context) error

func (*PostgresDB) GetSegmentUsersInfo

func (pg *PostgresDB) GetSegmentUsersInfo(ctx context.Context, segment Segment, log *slog.Logger) ([]uint64, error)

func (*PostgresDB) GetUserSegmentsInfo

func (pg *PostgresDB) GetUserSegmentsInfo(ctx context.Context, user User, log *slog.Logger) ([]string, error)

func (*PostgresDB) Migrate

func (pg *PostgresDB) Migrate(ctx context.Context) error

func (*PostgresDB) Ping

func (pg *PostgresDB) Ping(ctx context.Context) error

type Segment

type Segment struct {
	Id   uint64 `json:"id,omitempty"`
	Slug string `json:"slug" validate:"required"`
}

type User

type User struct {
	Id  uint64 `json:"id,omitempty"`
	UID uint64 `json:"user_id" validate:"required"`
}

type UserSegments

type UserSegments struct {
	UserID      uint64   `json:"user_id" validate:"required"`
	SegmentSlug []string `json:"segment_slug" validate:"required"`
}

Jump to

Keyboard shortcuts

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