models

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidJSON = errors.New("invalid json")
)

Functions

func ReadPlaintext

func ReadPlaintext(plaintext string, url URL) (string, error)

func WritePlaintext

func WritePlaintext(plaintext string, url URL, updated string) (string, error)

Types

type Store

type Store interface {
	io.Closer

	// Get returns the value identified by the given URL.
	Get(ctx context.Context, value Value) (string, error)

	// Set updates the value identified by the given URL.
	Set(ctx context.Context, value Value, updated string) error

	// Delete destroys the value identified by the given URL.
	Delete(ctx context.Context, value Value) error
}

type StoreFactory

type StoreFactory func(ctx context.Context) (Store, error)

type URL

type URL struct {
	*url.URL
}

URL is lightweight wrapper around url.URL that adds a few convenience methods.

func (URL) Default added in v0.5.0

func (u URL) Default() (string, bool)

Default returns the `default` query param, and whether that params exists in the URL.

type Value

type Value string

Value is a value to inject into the environment.

func (Value) String

func (v Value) String() string

String returns v as a string.

func (Value) URL

func (v Value) URL() URL

URL returns v as a URL.

type Vars

type Vars map[string]Value

Vars is a map of key/value pairs to use as environment variables.

func (Vars) Environ

func (vars Vars) Environ() []string

Environ returns a list of key/value pairs in the form of "key=value" (similar to os.Environ).

func (Vars) Get

func (vars Vars) Get(key string) (Value, bool)

Get returns the value for key and true if key exists in the collection.

func (Vars) Map

func (vars Vars) Map() map[string]string

func (Vars) Pluck

func (vars Vars) Pluck(keys ...string) Vars

Jump to

Keyboard shortcuts

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