jsonstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package jsonstore persists Go values as JSON files on disk. Save marshals a value and writes it atomically (via internal/fileutil); Load reads and unmarshals one, reporting absence without an error so callers can treat a missing file as empty state. It is the shared home for the marshal+atomic write and read+unmarshal patterns previously duplicated across the scheduler, cache, artifact, and hide stores.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(path string, v any) (found bool, err error)

Load reads path and unmarshals its JSON contents into v. It returns (false, nil) when the file does not exist, leaving v unmodified, so callers can distinguish "absent" from a decode error. A successful load returns (true, nil).

func Save

func Save(path string, v any, perm os.FileMode) error

Save marshals v to JSON and writes it to path atomically with the given file permission. The parent directory is created (mode 0700) if needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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