storage

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package storage is a small key-value store for app data that should survive restarts: settings, drafts, the last-seen screen. Values are JSON in one file in the app's data directory; keep it to kilobytes, and put secrets in securestore instead.

storage.Set(ctx, "theme", "dark")
var theme string
ok, err := storage.Get(ctx, "theme", &theme)

Under `nimbus native dev` the app runs on this machine, so the file lives in the user cache directory instead of on the device.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, key string) error

Delete removes key and saves.

func Get

func Get(ctx context.Context, key string, dst any) (ok bool, err error)

Get decodes the value under key into dst; ok is false when there is none.

func Set

func Set(ctx context.Context, key string, value any) error

Set stores value (anything JSON can encode) under key and saves.

Types

This section is empty.

Jump to

Keyboard shortcuts

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