record

package
v1.0.77 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 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 Builder

type Builder interface {
	Build(path string) (Store, error)
}

Builder creates record stores from a path

type CtxStore

type CtxStore interface {
	TxStore
	WithTx(fn func(TxStore) error) error
}

CtxStore is a context-aware record store

type Store

type Store interface {
	CtxStore

	WithContext(ctx context.Context) CtxStore
	Close() error
}

Store is the main record storage interface

type TxStore

type TxStore interface {
	Count(filter resource.Filter) (int, error)
	FindPagedRIDs(filter resource.Filter, offset int, limit int) ([]resource.RID, error)
	FindRecords(rids ...resource.RID) (resource.Box[resource.Record], error)
	FindRecord(rid resource.RID) (*resource.Record, error)
	FindCreatorByCID(cid resource.CID) (resource.Creator, error)
	FindCreatorByNickname(source source.ID, nickname string) (resource.Creator, error)
	FindURLs(normalizedURLs ...string) ([]string, error)
	FindTagNames(tids ...resource.TID) ([]string, error)
	TagNames() ([]string, error)

	CID(source source.ID, platformID string) resource.CID
	UpsertTags(tags []models.Tag) error
	UpsertCreator(source source.ID, creatorInfo models.CreatorInfo) (resource.CID, error)

	SaveRecord(metadata *models.Metadata, characterCard *png.CharacterCard, time timestamp.Nano, importIndex ...int) (resource.RID, error)
	RestoreRecord(rec *resource.Record, characterCard *png.CharacterCard) (resource.RID, error)
	UpdateSyncData(rid resource.RID, syncData resource.SyncData) error
	UpdateExportData(rid resource.RID, exportData resource.ExportData) error

	UpdateFavoriteData(favorite bool, rids ...resource.RID) error
	ToggleFavorite(rid resource.RID) error

	Delete(rids ...resource.RID) (int, error)

	CleanupCreators() (int, error)
}

TxStore provides transactional record operations

Jump to

Keyboard shortcuts

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