state

package
v0.0.0-...-53bbe6e Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PlaygroundFile = "play.jsonnet"

Providing a name for error message purposes, this has no use expect to provide more presentable error messages as it shows the error being in 'play.jsonnet', as opposed to no file name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {

	// Server address binding
	Address string

	// ShareDomain is used for the share functionality. The shareable hash is
	// appended to this value.
	//
	// In short, this value should be how the application is accessed.
	ShareDomain string
}

Config contains server configuration

type State

type State struct {
	Store  map[string]string
	Vm     *jsonnet.VM
	Hasher hash.Hash
	Config *Config
	Logger *slog.Logger
}

State contains the shared state of the running server across all routes.

func New

func New(bindAddress, shareAddress string) *State

New creates a new default State

func NewWithLogger

func NewWithLogger(bindAddress, shareAddress string, logger *slog.Logger) *State

NewWithLogger creates a new default State

func (*State) EvaluateSnippet

func (s *State) EvaluateSnippet(snippet string) (string, error)

func (*State) FormatSnippet

func (s *State) FormatSnippet(snippet string) (string, error)

Jump to

Keyboard shortcuts

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