data

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) CreateAt added in v0.11.0

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

CreateAt writes a new object to disk, optionally at an explicit workspace-relative target that matches a writable include.

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