cache

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(projectID string) (*api.Project, bool)

Load retrieves cached project data if it exists and is not expired

func LoadUserInfo added in v1.2.0

func LoadUserInfo() (*api.UserInfo, bool)

LoadUserInfo retrieves cached user info if it exists and is not expired

func ResolveCategory

func ResolveCategory(project *api.Project, nameOrID string) (int, error)

ResolveCategory finds a category by name (case-insensitive, substring) or ID and returns the ID

func ResolveCurrency

func ResolveCurrency(project *api.Project, nameOrID string) (*api.Currency, error)

ResolveCurrency finds a currency by name (case-insensitive), ID, or currency code symbol and returns the currency

func ResolveMember

func ResolveMember(project *api.Project, username string) (int, error)

ResolveMember finds a member by username (case-insensitive) and returns their ID

func ResolvePaymentMode

func ResolvePaymentMode(project *api.Project, nameOrID string) (int, error)

ResolvePaymentMode finds a payment mode by name (case-insensitive, substring) or ID and returns the ID

func Save

func Save(projectID string, project *api.Project) error

Save stores project data in the cache

func SaveUserInfo added in v1.2.0

func SaveUserInfo(userInfo *api.UserInfo) error

SaveUserInfo stores user info in the cache

func SymbolToISO added in v1.2.0

func SymbolToISO(symbol string) string

SymbolToISO returns the uppercase ISO currency code for a given symbol. For ambiguous symbols (e.g. "$"), it prefers USD.

Types

type CachedProject

type CachedProject struct {
	Project  *api.Project `json:"project"`
	CachedAt time.Time    `json:"cached_at"`
}

CachedProject stores project data with timestamp

type CachedUserInfo added in v1.2.0

type CachedUserInfo struct {
	UserInfo *api.UserInfo `json:"user_info"`
	CachedAt time.Time     `json:"cached_at"`
}

CachedUserInfo stores user info data with timestamp

Jump to

Keyboard shortcuts

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