delta

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintDeltas

func PrintDeltas(groups []*BudgetCategoryDeltaGroup)

func SumChanges

func SumChanges(deltas []*BudgetCategoryDelta) (int64, int16)

SumChanges calculates the sum of all changes across the given groups It returns the dollars and cents of the changes

Types

type BudgetCategoryDelta

type BudgetCategoryDelta struct {
	BudgetCategory *model.BudgetCategory
	InitialDollars int64
	InitialCents   int16
	FinalDollars   int64
	FinalCents     int16
}

func (*BudgetCategoryDelta) CalculateDelta

func (bcd *BudgetCategoryDelta) CalculateDelta() (int64, int16)

CalculateDelta calculates the delta from the initial amount to the final amount. It returns the dollars and cents' difference. This currently only works with additive operations.

func (*BudgetCategoryDelta) HasChanges

func (bcd *BudgetCategoryDelta) HasChanges() bool

HasChanges determines if this delta has any actual changes to be applied

type BudgetCategoryDeltaGroup

type BudgetCategoryDeltaGroup struct {
	Name           string
	CategoryDeltas []*BudgetCategoryDelta
}

func NewDeltas

func NewDeltas(client ynab.Client, budget *model.Budget, actual []*model.BudgetCategoryGroup, toApply *input.BudgetChange) ([]*BudgetCategoryDeltaGroup, error)

Jump to

Keyboard shortcuts

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