snapshot

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSnapshotPayload

type CreateSnapshotPayload struct {
	Snap_date       string                                     `json:"snap_date"`
	Description     string                                     `json:"description"`
	Snapshot_values []snapshotvalue.CreateSnapshotValuePayload `json:"snapshot_values"`
	Benchmark_id    int                                        `json:"benchmark_id"`
}

func (CreateSnapshotPayload) Validate

func (p CreateSnapshotPayload) Validate() error

type DeleteSnapshotParams

type DeleteSnapshotParams struct {
	Id int `json:"id"`
}

func (DeleteSnapshotParams) Validate

func (p DeleteSnapshotParams) Validate() error

type GetSnapshotByIdParams

type GetSnapshotByIdParams struct {
	Id int `json:"id"`
}

func (GetSnapshotByIdParams) Validate

func (p GetSnapshotByIdParams) Validate() error

type GetSnapshotByIdQuery

type GetSnapshotByIdQuery struct {
	Group_by         string `json:"group_by"` // Easier to analyze this as a string so we don't have to worry about setting up a reflection case for this as an enum
	Maturation_start string `json:"maturation_start"`
	Maturation_end   string `json:"maturation_end"`
}

func (GetSnapshotByIdQuery) Validate

func (q GetSnapshotByIdQuery) Validate() error

type GetSnapshotsQuery

type GetSnapshotsQuery struct {
	Snap_ids        []int  `json:"snap_ids"`
	Snap_date_lower string `json:"snap_date_lower"` // mm/dd/yyyy
	Snap_date_upper string `json:"snap_date_upper"` // mm/dd/yyyy
	Order_date_by   string `json:"order_date_by"`   // ASC or DESC

	types.PaginationQuery
}

func (GetSnapshotsQuery) Validate

func (q GetSnapshotsQuery) Validate() error

type GroupByCategory

type GroupByCategory string
const (
	BY_ACCOUNT_NAME        GroupByCategory = "ACCOUNT_NAME"
	BY_ACCOUNT_INSTITUTION GroupByCategory = "ACCOUNT_INSTITUTION"
	BY_TAX_SHELTER         GroupByCategory = "TAX_SHELTER"
	BY_ASSET_CATEGORY      GroupByCategory = "ASSET_CATEGORY"
	BY_MATURATION_DATE     GroupByCategory = "MATURATION_DATE"
	BY_LIQUIDITY           GroupByCategory = "LIQUIDITY"
)

type HandleGroupByResourceOptions

type HandleGroupByResourceOptions struct {
	Group_by         string
	Maturation_start string
	Maturation_end   string
}

type PostgresSnapshotStore

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

func NewPostgresSnapshotStore

func NewPostgresSnapshotStore(db *pgxpool.Pool, logger *slog.Logger) *PostgresSnapshotStore

func (*PostgresSnapshotStore) CreateSnapshot

func (s *PostgresSnapshotStore) CreateSnapshot(ctx context.Context, snapshot *types.Snapshot) (types.Snapshot, error)

func (*PostgresSnapshotStore) DeleteSnapshot

func (s *PostgresSnapshotStore) DeleteSnapshot(ctx context.Context, snapId, userId int) (types.Snapshot, error)

func (*PostgresSnapshotStore) GetSnapshotByDate

func (s *PostgresSnapshotStore) GetSnapshotByDate(ctx context.Context, snapshotDate string, userId int) (types.Snapshot, error)

func (*PostgresSnapshotStore) GetSnapshotById

func (s *PostgresSnapshotStore) GetSnapshotById(ctx context.Context, snapshotId, userId int) (types.Snapshot, []types.SnapshotValue, error)

func (*PostgresSnapshotStore) GetSnapshotTotal

func (s *PostgresSnapshotStore) GetSnapshotTotal(ctx context.Context, userId, snapId int, options *types.GetSnapshotTotalStoreOptions) (total float64, e error)

func (*PostgresSnapshotStore) GetSnapshots

func (*PostgresSnapshotStore) GroupByAccount

func (s *PostgresSnapshotStore) GroupByAccount(ctx context.Context, snapId, userId int, options *types.GetGroupByAccountStoreOptions) (types.ResourcesGrouped, error)

func (*PostgresSnapshotStore) GroupByHolding

func (s *PostgresSnapshotStore) GroupByHolding(ctx context.Context, userId, snapId int, options *types.GetGroupByHoldingStoreOptions) (types.ResourcesGrouped, error)

func (*PostgresSnapshotStore) GroupByLiquidity

func (s *PostgresSnapshotStore) GroupByLiquidity(ctx context.Context, userId, snapId int) ([]types.LiquidityResource, float64, error)

func (*PostgresSnapshotStore) GroupByMaturationDate

func (s *PostgresSnapshotStore) GroupByMaturationDate(ctx context.Context, userId, snapId int, options *types.GetGroupByMaturationDateStoreOptions) ([]types.MaturationDateResource, error)

func (*PostgresSnapshotStore) RefreshSnapshotTotal

func (s *PostgresSnapshotStore) RefreshSnapshotTotal(ctx context.Context, userId, snapshotId int) (float64, error)

func (*PostgresSnapshotStore) RefreshSnapshotWeightedER

func (s *PostgresSnapshotStore) RefreshSnapshotWeightedER(ctx context.Context, userId, snapId int) (weightedER float64, e error)

func (*PostgresSnapshotStore) UpdateSnapshot

func (s *PostgresSnapshotStore) UpdateSnapshot(ctx context.Context, snap *types.Snapshot) (types.Snapshot, error)

type SnapshotHandlerImpl

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

func NewSnapshotHandler

func NewSnapshotHandler(
	userStore types.UserStore,
	benchmarkStore types.BenchmarkStore,
	accountStore types.AccountStore,
	holdingStore types.HoldingStore,
	snapshotStore types.SnapshotStore,
	snapshotValueStore types.SnapshotValueStore,
	logger *slog.Logger,
) *SnapshotHandlerImpl

func (*SnapshotHandlerImpl) CreateSnapshot

func (h *SnapshotHandlerImpl) CreateSnapshot(c fiber.Ctx) error

func (*SnapshotHandlerImpl) DeleteSnapshot

func (h *SnapshotHandlerImpl) DeleteSnapshot(c fiber.Ctx) error

func (*SnapshotHandlerImpl) GetSnapshotById

func (h *SnapshotHandlerImpl) GetSnapshotById(c fiber.Ctx) error

func (*SnapshotHandlerImpl) GetSnapshots

func (h *SnapshotHandlerImpl) GetSnapshots(c fiber.Ctx) error

func (*SnapshotHandlerImpl) RebalanceSnapshot

func (h *SnapshotHandlerImpl) RebalanceSnapshot(c fiber.Ctx) error

func (*SnapshotHandlerImpl) UpdateSnapshot

func (h *SnapshotHandlerImpl) UpdateSnapshot(c fiber.Ctx) error

type UpdateSnapshotParams

type UpdateSnapshotParams struct {
	Id int `json:"id"`
}

func (UpdateSnapshotParams) Validate

func (p UpdateSnapshotParams) Validate() error

type UpdateSnapshotPayload

type UpdateSnapshotPayload struct {
	Snap_date    string `json:"snap_date"`
	Description  string `json:"description"`
	Benchmark_id int    `json:"benchmark_id"`
}

func (UpdateSnapshotPayload) Validate

func (p UpdateSnapshotPayload) Validate() error

Jump to

Keyboard shortcuts

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