api

package
v0.0.0-...-d508fec Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expense

type Expense struct {
	ID       string    `json:"id"`
	Amount   float64   `json:"amount"`
	Category string    `json:"category"`
	Date     time.Time `json:"date"`
	Notes    string    `json:"notes"`
}

type ExpenseRepo

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

func NewExpenseRepo

func NewExpenseRepo(db *sql.DB) *ExpenseRepo

func (*ExpenseRepo) Add

func (r *ExpenseRepo) Add(expense Expense) error

func (*ExpenseRepo) All

func (r *ExpenseRepo) All() ([]Expense, error)

func (*ExpenseRepo) Summarize

func (r *ExpenseRepo) Summarize() ([]ExpenseSummary, error)

type ExpenseSummary

type ExpenseSummary struct {
	Year        int     `json:"year"`
	Month       int     `json:"month"`
	Category    string  `json:"category"`
	TotalAmount float64 `json:"total_amount"`
}

type Expenses

type Expenses []Expense

func (Expenses) FindByID

func (es Expenses) FindByID(id string) *Expense

type Setup

type Setup struct {
	DB         *sql.DB
	APIAddress string
	APIMux     *http.ServeMux
}

func NewSetup

func NewSetup() (*Setup, error)

Jump to

Keyboard shortcuts

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