runtimevar

package module
v2.0.0-...-a649600 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Runtimevar Source

The runtimevar source is a source for the Go Cloud Development Kit runtimevar package.

This package takes a runtimevar.Variable and then allows you to use it as a backend source. When constructing your runtimevar.Variable, use the gocloud.dev/runtimevar.BytesDecoder decoder to allow your Snapshot value to be []byte. We then use the built in go-config encoder to decode the value. This defaults to json.

New Source

Specify a runtimevar source with the Go CDK runtimevar.Variable. It will panic if not specified.

// See https://godoc.org/gocloud.dev/runtimevar for examples on how to create
// a gocloud.dev/runtimevar.Varible. Use a BytesDecoder.
srv := runtimevar.NewSource(
	runtimevar.WithVariable(v),
)

Config Format

To load different runtimevar formats e.g yaml, toml, xml you must specify an encoder.

e := toml.NewEncoder()

src := runtimevar.NewSource(
        runtimevar.WithVariable(v),
	source.WithEncoder(e),
)

Load Source

Load the source into config

// Create new config
conf := config.NewConfig()

// Load runtimevar source
conf.Load(src)

Documentation

Overview

package runtimevar is the source for gocloud.dev/runtimevar

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSource

func NewSource(opts ...source.Option) source.Source

func WithVariable

func WithVariable(v *runtimevar.Variable) source.Option

WithVariable sets the runtimevar.Variable.

Types

This section is empty.

Jump to

Keyboard shortcuts

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