budgeter

package
v0.0.0-...-5e69f72 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {

	// Config is a store where CLI can persist data in a key, value format.
	Config Store
	// DBPath is the filepath for the datastore being used. It does not have a
	// default, so it must be set. The wipe and backup commands currently assume
	// that the database is stored in a local file.
	DBPath string
	// Err is used by CLI to log errors. By default, it writes to stderr with no
	// date prefix.
	Err io.Writer

	// In is the input stream that the CLI reads from. It defaults to stdin.
	In io.Reader

	// Out is where CLI prints its regular output. It defaults to stdout
	Out io.Writer
	// Transactions is a Transactions table, it allows the CLI app to interact
	// with a store of transactions. It does not have a default, so it must be set.
	Transactions Table
	// contains filtered or unexported fields
}

func (*CLI) Run

func (c *CLI) Run(args []string) int

Run runs the budgeter CLI with the given arguments.

Run returns an error code. A nonzero code is an error, and 0 means success.

type Store

type Store interface {
	// Put puts a value into the Store. If it is already present, it's overwritten.
	Put(Key, Value string) error
	// Get gets a value from the Store. If the value is not present, "" is
	// returned with a nil error.
	Get(Key string) (string, error)
}

type Table

type Table interface {
	Insert(transaction.Transaction) error
	RangeTotal(start, end time.Time) (transaction.Cent, error)
	Remove(transactionID int) error
	Search(query string, limit int) (*transaction.Rows, error)
	Total() (transaction.Cent, error)
}

Jump to

Keyboard shortcuts

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