scope

package
v5.3.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2017 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package scope provides functionality to handele variable scopes.

Index

Constants

This section is empty.

Variables

View Source
var GetCounter <-chan int

GetCounter returns a strictly increasing sequence of int values.

View Source
var Random *rand.Rand

Random is the source for all randomness used in packe scope.

View Source
var ResetCounter chan<- int

ResetCounter resets the stream generated by GetCounter to the sent value.

Functions

func RandomIntn

func RandomIntn(n int) int

RandomIntn returns a random int in the rnage [0,n) read from Random. It is safe for concurrent use.

Types

type Variables

type Variables map[string]string

Variables represents a set of (variable-name, variable-value)-pairs.

func New

func New(outer, inner Variables, auto bool) Variables

New merges outer and inner variables into a new scope. Variables defined in the outer scope will be copied to the new scope: Variables from the inner scope may not overwrite variables from the outer scope. Worded differently: The inner scope provides some kind of default which gets overwriten from the outside.

Variable values in the inner scope may reference values from the outer scope.

If auto variables are requested the new scope will contain the COUNTER and RANDOM variable.

func (Variables) Copy

func (vars Variables) Copy() Variables

Copy returns a copy of vars.

func (Variables) Replacer

func (vars Variables) Replacer() *strings.Replacer

Replacer to replace {{name}} pattern with the given values from vars.

Jump to

Keyboard shortcuts

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