skycfg

package
v0.0.0-...-c41840e Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fail = starlark.NewBuiltin("fail", failImpl)

Functions

func HashModule

func HashModule() starlark.Value

func JsonModule

func JsonModule() starlark.Value

JsonModule returns a Starlark module for JSON helpers.

func NewSkyProtoMessage

func NewSkyProtoMessage(msg proto.Message) *skyProtoMessage

func NewSkyProtoPackage

func NewSkyProtoPackage(registry ProtoRegistry, name string) starlark.Value

NewSkyProtoPackage creates a Starlark value representing a named Protobuf package.

Protobuf packagess are conceptually similar to a C++ namespace or Ruby module, in that they're aggregated from multiple .proto source files.

func ToProtoMessage

func ToProtoMessage(val starlark.Value) (proto.Message, bool)

func UrlModule

func UrlModule() starlark.Value

UrlModule returns a Starlark module for URL helpers.

func YamlModule

func YamlModule() starlark.Value

YamlModule returns a Starlark module for YAML helpers.

Types

type Module

type Module struct {
	Name  string
	Attrs starlark.StringDict
}

A Starlark module, for namespacing of built-in functions.

func (*Module) Attr

func (mod *Module) Attr(name string) (starlark.Value, error)

func (*Module) AttrNames

func (mod *Module) AttrNames() []string

func (*Module) Freeze

func (mod *Module) Freeze()

func (*Module) Hash

func (mod *Module) Hash() (uint32, error)

func (*Module) String

func (mod *Module) String() string

func (*Module) Truth

func (mod *Module) Truth() starlark.Bool

func (*Module) Type

func (mod *Module) Type() string

type ProtoModule

type ProtoModule struct {
	Registry ProtoRegistry
	// contains filtered or unexported fields
}

func NewProtoModule

func NewProtoModule(registry ProtoRegistry) *ProtoModule

func (*ProtoModule) Attr

func (mod *ProtoModule) Attr(name string) (starlark.Value, error)

func (*ProtoModule) AttrNames

func (mod *ProtoModule) AttrNames() []string

func (*ProtoModule) Freeze

func (mod *ProtoModule) Freeze()

func (*ProtoModule) Hash

func (mod *ProtoModule) Hash() (uint32, error)

func (*ProtoModule) String

func (mod *ProtoModule) String() string

func (*ProtoModule) Truth

func (mod *ProtoModule) Truth() starlark.Bool

func (*ProtoModule) Type

func (mod *ProtoModule) Type() string

type ProtoRegistry

type ProtoRegistry interface {
	// UNSTABLE lookup from full protobuf message name to a Go type of the
	// generated message struct.
	UnstableProtoMessageType(name string) (reflect.Type, error)

	// UNSTABLE lookup from go-protobuf enum name to the name->value map.
	UnstableEnumValueMap(name string) map[string]int32
}

UNSTABLE extension point for configuring how protobuf messages are loaded.

This will be stabilized after the go-protobuf v2 API has reached GA.

type TestContext

type TestContext struct {
	Attrs    starlark.StringDict
	Failures []error
}

TestContext is keeps track of whether there is a failure during a test execution

func AssertModule

func AssertModule() *TestContext

AssertModule contains assertion functions. The *TestContext returned can be used to track assertion failures. assert.* functions from this module will mutate the *TestContext. After execution is complete, TestContext.Failures will be non-empty if any of the assertions failed, and also contain details about the failures.

func (*TestContext) AssertBinaryImpl

func (t *TestContext) AssertBinaryImpl(op syntax.Token) func(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

AssertBinaryImpl returns a function that implements comparing binary values in an assertion (i.e. assert_eq(1, 2))

func (*TestContext) AssertFails

func (t *TestContext) AssertFails(thread *starlark.Thread, fn *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func (*TestContext) Attr

func (t *TestContext) Attr(name string) (starlark.Value, error)

func (*TestContext) AttrNames

func (t *TestContext) AttrNames() []string

func (*TestContext) CallInternal

func (t *TestContext) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

CallInternal is the implementation for assert(...)

func (*TestContext) Freeze

func (t *TestContext) Freeze()

func (*TestContext) Hash

func (t *TestContext) Hash() (uint32, error)

func (*TestContext) Name

func (t *TestContext) Name() string

func (*TestContext) String

func (t *TestContext) String() string

func (*TestContext) Truth

func (t *TestContext) Truth() starlark.Bool

func (*TestContext) Type

func (t *TestContext) Type() string

Jump to

Keyboard shortcuts

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