storage

package
v0.0.0-...-441fd9a Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillFile

type BillFile interface {
	AddBill(bill model.GroupBill) error
	GetBill(billID string) (bill model.GroupBill, err error)
	GetBills(startDate, finishDate string) ([]model.GroupBill, error)
	ListBills(id string, count int, dirNew bool) (bills []model.GroupBill, hasMore bool, err error)

	DeleteRecord(billID string) (err error)
	GetDeletedBill(billID string) (bill model.DeletedGroupBill, err error)
	GetDeletedBills() ([]model.DeletedGroupBill, error)
	RemoveDeletedBillHistory(billID string) error
	RestoreDeletedBill(billID string) error
}

func NewBillFile

func NewBillFile(groupID uint64, dir string, base string, logger l.Wrapper) BillFile

type GroupEnterInfo

type GroupEnterInfo struct {
	PersonID uint64
	GroupID  uint64
}

type MerchantPersonInfo

type MerchantPersonInfo struct {
	PersonID uint64
	CostDir  model.CostDir
}

type Organization

type Organization struct {
	Persons     map[uint64]model.Person
	Groups      map[uint64]model.Group
	SubWallets  map[uint64]model.Wallet
	Labels      map[uint64]model.Label
	GroupLabels map[uint64]map[uint64]model.Label

	Merchants      map[uint64]model.CostDir
	GroupMerchants map[uint64]map[uint64]model.CostDir
}

func NewOrganization

func NewOrganization() *Organization

type Storage

type Storage interface {
	NewPerson(name string) (personID, defaultWalletID uint64, err error)
	NewPersonEx(name string, suggestPersonID uint64) (personID, defaultWalletID uint64, err error)
	GetPersonName(personID uint64) (name string, err error)
	GetPersonGroupsIDs(personID uint64) (groupIDs []uint64, err error)
	GetPersonWalletIDs(personID uint64) (subWalletIDs []uint64, err error)
	SetPersonMerchant(personID uint64, costDir model.CostDir) error
	SetPersonGroupMerchant(personID, groupID uint64, costDir model.CostDir) error
	GetMerchantPersons() (merchants []MerchantPersonInfo)
	IsMerchantPerson(personID uint64) (dir model.CostDir, ok bool)
	GetGroupMerchantPersons(groupID uint64) (merchants []MerchantPersonInfo)
	IsGroupMerchantPerson(personID, groupID uint64) (dir model.CostDir, ok bool)

	NewGroup(name string, personID uint64) (id uint64, err error)
	JoinGroup(groupID, personID uint64) error
	LeaveGroup(groupID, personID uint64) error
	SetGroupAdmin(groupID, personID uint64, adminFlag bool) error
	IsGroupAdmin(groupID, personID uint64) (adminFlag bool, err error)
	GetGroupPersonIDs(groupID uint64) (personIDs, adminIDs []uint64, err error)
	GetGroupNames(groupIDs []uint64) (names []string, err error)

	NewWallet(name string, personID uint64) (id uint64, err error)
	GetWallet(walletID uint64) (wallet model.Wallet, err error)

	NewLabel(name string) (id uint64, err error)
	GetLabels() (labels []model.Label, err error)
	GetLabelName(id uint64) (name string, err error)

	NewGroupLabel(groupID uint64, name string) (id uint64, err error)
	GetGroupLabels(groupID uint64) (labels []model.Label, err error)
	GetGroupLabelName(labelID, groupID uint64) (name string, err error)

	Record(groupID uint64, groupBill model.GroupBill) error
	GetBill(groupID uint64, billID string) (bill model.GroupBill, err error)
	DeleteRecord(groupID uint64, recordID string) error
	GetBills(groupID uint64) ([]model.GroupBill, error)
	GetBillsEx(groupID uint64, startYear, startMonth, startDay, finishYear,
		finishMonth, finishDay int) ([]model.GroupBill, error)
	GetBillsByID(groupID uint64, id string, count int, dirNew bool) (bills []model.GroupBill, hasMore bool, err error)

	GetDeletedBills(groupID uint64) (bills []model.DeletedGroupBill, err error)
	GetDeletedBill(groupID uint64, billID string) (bill model.DeletedGroupBill, err error)
	CleanDeletedBill(groupID uint64, billID string) (err error)
	RestoreDeletedBill(groupID uint64, billID string) (err error)

	AddGroupEnterCodes(enterCodes []string, personID, groupID uint64, duration time.Duration) (err error)
	ActiveGroupEnterCode(enterCode string) (personID, groupID uint64, ok bool, err error)
}

func NewStorage

func NewStorage(dataRoot string, debug bool, logger l.Wrapper) Storage

Jump to

Keyboard shortcuts

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