data

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

type Object struct {
	Type     string
	ID       string
	Fields   map[string]any
	File     string
	Inline   bool
	ReadOnly bool
}

Object represents a single database object loaded from disk.

type Store

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

Store coordinates reading and writing objects on disk.

func NewStore

func NewStore(root string, cfg *config.Config) (*Store, error)

NewStore constructs a data store rooted at the given directory.

func NewStoreWithOps added in v0.7.0

func NewStoreWithOps(root string, cfg *config.Config, ops fileutil.Ops) (*Store, error)

NewStoreWithOps constructs a data store rooted at the given directory using the provided file operations.

func (*Store) Create

func (s *Store) Create(typeName string, fields map[string]any) (*Object, error)

Create writes a new object to disk.

func (*Store) Delete

func (s *Store) Delete(typeName, id string) error

Delete removes an object from disk.

func (*Store) Get

func (s *Store) Get(typeName, id string) (*Object, error)

Get returns the object by identifier.

func (*Store) GetExact added in v0.9.0

func (s *Store) GetExact(typeName, id string) (*Object, error)

GetExact returns the object by identifier, restricting the lookup to objects declared exactly as typeName.

func (*Store) List

func (s *Store) List(typeName string) ([]string, error)

List returns sorted identifiers for the specified type.

func (*Store) ListExact added in v0.9.0

func (s *Store) ListExact(typeName string) ([]string, error)

ListExact returns sorted identifiers for objects declared exactly as the specified type.

func (*Store) LoadAll

func (s *Store) LoadAll(typeName string) ([]*Object, error)

LoadAll retrieves all objects of a type.

func (*Store) LoadExactAll added in v0.9.0

func (s *Store) LoadExactAll(typeName string) ([]*Object, error)

LoadExactAll retrieves all objects declared exactly as typeName.

func (*Store) Update

func (s *Store) Update(typeName, id string, fields map[string]any, merge bool) (*Object, error)

Update replaces or merges an object on disk.

Jump to

Keyboard shortcuts

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