localstore

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package localstore is a helper for persistent JSON storage on the users machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDir

func DefaultDir(appID string) (string, error)

DefaultDir returns the default local updater storage directory given an appID.

func LoadJSONFile

func LoadJSONFile(path string, data any) error

LoadJSONFile unmarshals file contents from the given file path into a generic object. data cannot be nil. errors.Is(err, os.ErrNotExist) will return true if file doesn't exist.

func StoreJSONFile

func StoreJSONFile(path string, data any) error

StoreJSONFile marshals data from the given object into file with given path. File and directory tree will be created if they do not exist. data cannot be nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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