repo

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FactLabels

type FactLabels struct {
	FactId    uint32 `db:"fact_id"`
	FactTax   string `db:"fact_tax"`
	FactName  string `db:"fact_name"`
	LabelId   uint32 `db:"label_id"`
	LabelHash uint64 `db:"xxhash1"`
	DescrHash uint64 `db:"xxhash2"`
}

type FactUnit

type FactUnit struct {
	CIK    uint32 `db:"company_cik"`
	FactId uint32 `db:"fact_id"`
	UnitId uint32 `db:"unit_id"`

	Start pgtype.Date `db:"fact_start"`
	End   time.Time   `db:"fact_end"`
	Val   float64     `db:"val"`
	Accn  string      `db:"accn"`
	FY    uint        `db:"fy"`
	FP    string      `db:"fp"`
	Form  string      `db:"form"`
	Filed time.Time   `db:"filed"`
	Frame pgtype.Text `db:"frame"`
}

func (*FactUnit) NamedArgs

func (self *FactUnit) NamedArgs() pgx.NamedArgs

func (*FactUnit) WithFrame

func (self *FactUnit) WithFrame(frame string) *FactUnit

func (*FactUnit) WithStart

func (self *FactUnit) WithStart(d time.Time) *FactUnit

type Postgreser

type Postgreser interface {
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string,
		rowSrc pgx.CopyFromSource) (int64, error)
	Begin(ctx context.Context) (pgx.Tx, error)
}

type Repo

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

func New

func New(db Postgreser) *Repo

func (*Repo) AddCompany

func (self *Repo) AddCompany(ctx context.Context, cik uint32, name string,
) (bool, error)

func (*Repo) AddFact

func (self *Repo) AddFact(ctx context.Context, tax, name string) (uint32, error)

func (*Repo) AddFactUnit

func (self *Repo) AddFactUnit(ctx context.Context, fact FactUnit) error

func (*Repo) AddLabel

func (self *Repo) AddLabel(ctx context.Context, factId uint32,
	label, descr string, labelHash, descrHash uint64,
) error

func (*Repo) AddLastUpdate

func (self *Repo) AddLastUpdate(ctx context.Context, at time.Time) error

func (*Repo) AddUnit

func (self *Repo) AddUnit(ctx context.Context, name string) (uint32, error)

func (*Repo) CopyFactUnits

func (self *Repo) CopyFactUnits(ctx context.Context, length int,
	next func(i int) (FactUnit, error),
) error

func (*Repo) FactLabels

func (self *Repo) FactLabels(ctx context.Context) ([]FactLabels, error)

func (*Repo) FiledCounts

func (self *Repo) FiledCounts(ctx context.Context, cik uint32,
) (map[time.Time]uint32, error)

func (*Repo) LastFiled

func (self *Repo) LastFiled(ctx context.Context) (map[uint32]time.Time, error)

func (*Repo) LastUpdated

func (self *Repo) LastUpdated(ctx context.Context,
) (lastUpdated time.Time, err error)

func (*Repo) ReplaceFactUnits

func (self *Repo) ReplaceFactUnits(ctx context.Context, cik uint32,
	lastFiled time.Time, length int, next func(i int) (FactUnit, error),
) error

func (*Repo) Units

func (self *Repo) Units(ctx context.Context) (map[uint32]string, error)

Jump to

Keyboard shortcuts

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