storage

package
v0.0.0-...-76732a0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllFields = []string{
		"user_id",
		"file_id",
		"customer_id",
		"period_start",
		"paid_plan",
		"paid_amount",
		"period_end",
	}
)

Functions

This section is empty.

Types

type Invoice

type Invoice struct {
	UserID      string
	FileID      string
	CustomerID  uint32
	PeriodStart time.Time
	PaidPlan    string
	PaidAmount  float32
	PeriodEnd   time.Time
}

type Options

type Options struct {
	Host     string
	Port     string
	User     string
	Password string
	DB       string
}

type PostgresClient

type PostgresClient struct {
	Client *pgxpool.Pool
}

func NewPostgresClient

func NewPostgresClient(ctx context.Context, options *Options) (*PostgresClient, error)

func (*PostgresClient) Create

func (pc *PostgresClient) Create(ctx context.Context, table string, fields []string, invoices []Invoice) error

func (*PostgresClient) Delete

func (pc *PostgresClient) Delete(ctx context.Context, table, userID, fileID string) error

func (*PostgresClient) ReadByPeriod

func (pc *PostgresClient) ReadByPeriod(
	ctx context.Context,
	table string,
	fields []string,
	userID, fileID string,
	periodStart, periodEnd time.Time) ([]Invoice, error)

Jump to

Keyboard shortcuts

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