Documentation
¶
Overview ¶
Package storage provides JSON file-based persistence for SNIP entities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("entity not found") ErrDuplicateName = errors.New("entity with this name already exists") )
Common storage errors.
Functions ¶
This section is empty.
Types ¶
type Repositories ¶
type Repositories struct {
Snippets domain.SnippetRepository
Categories domain.CategoryRepository
Tags domain.TagRepository
// contains filtered or unexported fields
}
Repositories bundles all repository implementations with shared state. All repositories share the same underlying store for data consistency.
func New ¶
func New(filepath string) *Repositories
New creates repositories with all implementations sharing the same store.
func (*Repositories) Load ¶
func (r *Repositories) Load() error
Load reads all data from the JSON file into memory. If the file doesn't exist, this is not an error.
func (*Repositories) Save ¶
func (r *Repositories) Save() error
Save persists all data to the JSON file atomically.
Click to show internal directories.
Click to hide internal directories.