bldb

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

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

Go to latest
Published: Aug 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BLDB

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

func Open

func Open(filename string) (*BLDB, error)

func (*BLDB) AddThing

func (b *BLDB) AddThing(name string, counter bool) (int64, error)

AddThing adds a thing to track. Returns the id on success

func (*BLDB) ClickThing

func (b *BLDB) ClickThing(id int64, when Date, amount int64) (int64, error)

ClickThing increases a thing today if it is a counter, or toggles it if it is not a counter

func (*BLDB) History

func (b *BLDB) History(when Date, daysBack int) (ThingsHistory, error)

func (*BLDB) Migrate

func (b *BLDB) Migrate() error

func (*BLDB) RemoveThing

func (b *BLDB) RemoveThing(id int64) error

RemoveThing removes a thing and frees up it's id

func (*BLDB) ResetThing

func (b *BLDB) ResetThing(id int64, when Date) error

type Date

type Date string

func DateFromTime

func DateFromTime(t time.Time) Date

func (Date) Add

func (d Date) Add(days int) (Date, error)

func (Date) AsTime

func (d Date) AsTime() (time.Time, error)

func (Date) Sub

func (d Date) Sub(o Date) (int64, error)

func (Date) TwoDigitDay

func (d Date) TwoDigitDay() string

func (Date) Valid

func (d Date) Valid() bool

type ThingHistory

type ThingHistory struct {
	Id      int64
	Name    string
	Counter bool
	Counts  []int64
}

type ThingsHistory

type ThingsHistory struct {
	FromWhen Date
	DaysBack int
	Things   []ThingHistory
}

Jump to

Keyboard shortcuts

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