kvview

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Overview

Package kvview gives templates the key-value store of a mock server, as text.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type View

type View struct {
	// contains filtered or unexported fields
}

View gives templates the values of a key-value store as text: {{ .KV.Get "key" }}. A key that may be missing reads with Has first: {{ if .KV.Has "key" }}.

func New

func New(ctx context.Context, kv vlatte.KV) *View

New returns the View of kv, read with ctx.

func (*View) Get

func (v *View) Get(key string) (string, error)

Get returns the value stored under key as text. A key that isn't stored is an error, as a missing map key is, so a typo doesn't render as an empty value.

func (*View) Has

func (v *View) Has(key string) (bool, error)

Has reports whether a value is stored under key.

Jump to

Keyboard shortcuts

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