catalog

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catalog

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

Catalog implements Service using record and blob stores

func (*Catalog) BasicIntegrity

func (c *Catalog) BasicIntegrity() ([]resource.RID, bool)

func (*Catalog) CID

func (c *Catalog) CID(source source.ID, platformID string) resource.CID

func (*Catalog) CardVersionExists

func (c *Catalog) CardVersionExists(rid resource.RID, version timestamp.Nano) (bool, error)

func (*Catalog) CardVersions

func (c *Catalog) CardVersions(rid resource.RID) []timestamp.Nano

func (*Catalog) CleanupCreators

func (c *Catalog) CleanupCreators() (int, error)

func (*Catalog) Close

func (c *Catalog) Close() error

func (*Catalog) Count

func (c *Catalog) Count(filter resource.Filter) (int, error)

func (*Catalog) Delete

func (c *Catalog) Delete(rids ...resource.RID) (int, error)

func (*Catalog) FindCreatorByCID

func (c *Catalog) FindCreatorByCID(cid resource.CID) (resource.Creator, error)

func (*Catalog) FindCreatorByNickname

func (c *Catalog) FindCreatorByNickname(source source.ID, nickname string) (resource.Creator, error)

func (*Catalog) FindPagedRIDs

func (c *Catalog) FindPagedRIDs(filter resource.Filter, offset int, limit int) ([]resource.RID, error)

func (*Catalog) FindRecord

func (c *Catalog) FindRecord(rid resource.RID) (*resource.Record, error)

func (*Catalog) FindRecords

func (c *Catalog) FindRecords(rids ...resource.RID) (resource.Box[resource.Record], error)

func (*Catalog) FindURLs

func (c *Catalog) FindURLs(normalizedURLs ...string) ([]string, error)

func (*Catalog) FixRecordIntegrity

func (c *Catalog) FixRecordIntegrity(rec *resource.Record) resource.RecordIntegrity

func (*Catalog) GetCardBytes

func (c *Catalog) GetCardBytes(rid resource.RID, version timestamp.Nano) ([]byte, error)

func (*Catalog) GetRawCard

func (c *Catalog) GetRawCard(rid resource.RID, version timestamp.Nano) (*png.RawCard, error)

func (*Catalog) GetSheet

func (c *Catalog) GetSheet(rid resource.RID, version timestamp.Nano) (*character.Sheet, error)

func (*Catalog) GetSheetBytes

func (c *Catalog) GetSheetBytes(rid resource.RID, version timestamp.Nano) ([]byte, error)

func (*Catalog) RestoreCard

func (c *Catalog) RestoreCard(rec *resource.Record, characterCard *png.CharacterCard) (resource.RID, error)

func (*Catalog) SaveCard

func (c *Catalog) SaveCard(metadata *models.Metadata, characterCard *png.CharacterCard, time timestamp.Nano, importIndex ...int) (resource.RID, error)

func (*Catalog) TagNames

func (c *Catalog) TagNames() ([]string, error)

func (*Catalog) Thumbnail

func (c *Catalog) Thumbnail(rid resource.RID) (image.Image, error)

func (*Catalog) ThumbnailBytes

func (c *Catalog) ThumbnailBytes(rid resource.RID) ([]byte, error)

func (*Catalog) ToggleFavorite

func (c *Catalog) ToggleFavorite(rid resource.RID) error

func (*Catalog) UpdateExportData

func (c *Catalog) UpdateExportData(rid resource.RID, exportData resource.ExportData) error

func (*Catalog) UpdateFavoriteData

func (c *Catalog) UpdateFavoriteData(favorite bool, rids ...resource.RID) error

func (*Catalog) UpdateSyncData

func (c *Catalog) UpdateSyncData(rid resource.RID, syncData resource.SyncData) error

func (*Catalog) WithContext

func (c *Catalog) WithContext(ctx context.Context) Service

type Service

type Service 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)
	TagNames() ([]string, error)

	CID(source source.ID, platformID string) resource.CID

	SaveCard(metadata *models.Metadata, characterCard *png.CharacterCard, time timestamp.Nano, importIndex ...int) (resource.RID, error)
	RestoreCard(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

	GetRawCard(rid resource.RID, version timestamp.Nano) (*png.RawCard, error)
	GetCardBytes(rid resource.RID, version timestamp.Nano) ([]byte, error)
	GetSheet(rid resource.RID, version timestamp.Nano) (*character.Sheet, error)
	GetSheetBytes(rid resource.RID, version timestamp.Nano) ([]byte, error)
	Thumbnail(rid resource.RID) (image.Image, error)
	ThumbnailBytes(rid resource.RID) ([]byte, error)
	CardVersions(rid resource.RID) []timestamp.Nano
	CardVersionExists(rid resource.RID, version timestamp.Nano) (bool, error)

	BasicIntegrity() ([]resource.RID, bool)
	FixRecordIntegrity(rec *resource.Record) resource.RecordIntegrity

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

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

Service provides unified access to record and blob stores

func New

func New(recordStore record.Store, blobStore blob.Store) Service

New creates a new Catalog with the given stores

Jump to

Keyboard shortcuts

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