pages

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	GetMonth(ctx context.Context, id uint) (db.Month, error)
	GetMonthID(ctx context.Context, year, month int) (uint, error)
	GetMonths(ctx context.Context, years ...int) ([]db.Month, error)

	GetSpendTypes(ctx context.Context) ([]db.SpendType, error)

	SearchSpends(ctx context.Context, args db.SearchSpendsArgs) ([]db.Spend, error)
}

type FooterTemplateData

type FooterTemplateData struct {
	Version string
	GitHash string
}

type Handlers

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

func NewHandlers

func NewHandlers(db DB, log logrus.FieldLogger, cacheTemplates bool, version, gitHash string) *Handlers

func (Handlers) IndexPage

func (h Handlers) IndexPage(w http.ResponseWriter, r *http.Request)

GET / - redirects to the current month page

func (Handlers) MonthPage

func (h Handlers) MonthPage(w http.ResponseWriter, r *http.Request)

GET /{year:[0-9]+}-{month:[0-9]+}

func (Handlers) MonthsPage added in v0.7.0

func (h Handlers) MonthsPage(w http.ResponseWriter, r *http.Request)

GET /months?offset=0

func (Handlers) SearchSpendsPage

func (h Handlers) SearchSpendsPage(w http.ResponseWriter, r *http.Request)

GET /search/spends

Query Params:

  • title - spend title
  • notes - spend notes
  • min_cost - minimal const
  • max_cost - maximal cost
  • after - date in format 'yyyy-mm-dd'
  • before - date in format 'yyyy-mm-dd'
  • type_id - Spend Type id to search (can be passed multiple times: ?type_id=56&type_id=58). Use id '0' to search for Spends without type
  • sort - sort type: 'title', 'date' or 'cost'
  • order - sort order: 'asc' or 'desc'

type SpendType added in v0.5.0

type SpendType struct {
	db.SpendType

	// FullName is a composite name that contains names of parent Spend Types
	FullName string
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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