common

package
v0.0.0-...-b986963 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUsers      = errors.New(lang.ErrNoUsersS)
	ErrWrongDBClaim = errors.New(lang.ErrWrongDBClaimS)
)
View Source
var (
	// Frontend instance
	Fe FeIf
	// Firebase instance
	Fb FbIf

	MenuItems map[int]MenuItem
	Shortcuts = make(map[tcell.Key]int)
)

Functions

This section is empty.

Types

type Claim

type Claim struct {
	Checked bool
	Date    *time.Time
}

func NewClaimFrom

func NewClaimFrom(a any) (*Claim, error)

func (*Claim) Differs

func (c *Claim) Differs(d *Claim) bool

func (*Claim) DiffersType

func (c *Claim) DiffersType(d *Claim) bool

func (*Claim) FormatDate

func (c *Claim) FormatDate() string

func (*Claim) IsZero

func (c *Claim) IsZero() bool

func (*Claim) String

func (c *Claim) String() string

func (*Claim) ToAny

func (c *Claim) ToAny() any

type ClaimsMap

type ClaimsMap map[string]*Claim

func NewClaimsMap

func NewClaimsMap() *ClaimsMap

func NewClaimsMapFrom

func NewClaimsMapFrom(as map[string]any) (*ClaimsMap, error)

func (*ClaimsMap) String

func (c *ClaimsMap) String() string

type FbIf

type FbIf interface {
	Search(ctx context.Context, key, value string, cb func(uid string) error) error
	StoreAuthClaims(ctx context.Context, uid string, newClaims map[string]any) error
	IterUsers(cb func(*auth.UserRecord) error) error
	GetUsers(ctx context.Context, uids []auth.UserIdentifier) (*auth.GetUsersResult, error)
	GetSpecs(ctx context.Context) (map[string]any, error)
	UpdateSpecs(tr *firestore.Transaction, updates map[string]any) error
	RunTransaction(ctx context.Context, cb func(tr *firestore.Transaction, privileged map[string]any) error) error
	DoList() error
}

FbIf is an interface to be able to mock Firebase functionality

type FeIf

type FeIf interface {
	Run()
	CurrentPage() string
	SetPage(string)
	SetOnShow(string, func())
	ShowMsg(ms ...string)
	ShowConfirm(onYes, onNo func(), ms ...string)
	ShowProgress(ctx context.Context, cancelFunc context.CancelFunc, ms ...string)
	ClaimButtonSetDisabled(index int, isDisabled bool)
	HidePopup(popup string)
	LayoutUsers()
	Quit()

	ShowClaimChoser(i int, key string, c Claim)
	CreateClaimChoser()
	ClaimsDateSetDisabled(bool)
	ClaimsBtns(bool)
	ClaimsSetDate(time.Time)
	ClaimsDate() *time.Time
	ReplaceTableItem(i int, key string, p tview.Primitive)
}

FeIf is an interface to be able to mock tview GUI functionality.

type MenuItem struct {
	Shortcut string
	Keys     []tcell.Key
	MenuKey  string
	Text     string
	Positive bool
	IsDef    bool
	Function func() error
}

MenuItem defines default menu items' structure.

Jump to

Keyboard shortcuts

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