storage

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateAssociationConditions

type CreateAssociationConditions struct {
	CardIndex        protomodels.CardIndex
	RelatedCardIndex protomodels.CardIndex
	Association      protomodels.AssociationTypes
}

type ListCardsRequest

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

func NewListCardRequest

func NewListCardRequest() ListCardsRequest

func (ListCardsRequest) Where

func (req ListCardsRequest) Where() []glinq.QueryString

func (ListCardsRequest) WhereCardIndexIn

func (req ListCardsRequest) WhereCardIndexIn(indices []protomodels.CardIndex) ListCardsRequest

func (ListCardsRequest) WhereLabelContains

func (req ListCardsRequest) WhereLabelContains(label string) ListCardsRequest

func (ListCardsRequest) WhereLanguage

func (req ListCardsRequest) WhereLanguage(lang protomodels.Language) ListCardsRequest

func (ListCardsRequest) WhereNeedReview

func (req ListCardsRequest) WhereNeedReview(today itime.UnixTime) ListCardsRequest

type Storage

type Storage interface {
	// todo : refactor with builder pattern
	ListCards(ctx context.Context, req ListCardsRequest) ([]protomodels.Card, error)

	ListCardIndices(ctx context.Context) ([]protomodels.CardIndex, error)

	GetAssociations(ctx context.Context, cardIndex protomodels.CardIndex) (protomodels.RelatedCards, error)

	CreateAssociation(ctx context.Context, conditions CreateAssociationConditions) error

	// upsert to logs NewCards++
	CreateCard(ctx context.Context, card protomodels.Card) error

	// zero values will NOT been updated
	UpdateCard(ctx context.Context, card protomodels.Card) error

	DeleteCard(ctx context.Context, cardIndex protomodels.CardIndex) error

	GetLog(ctx context.Context, date time.Time) (protomodels.Log, error)

	ListLogs(ctx context.Context, from time.Time, until time.Time) ([]protomodels.Log, error)

	// upsert to logs ReviewedCards++
	// update card review date
	ReviewCard(ctx context.Context, cardIndex protomodels.CardIndex) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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