convert

package
v0.0.0-...-a41e324 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StructTags = []string{"starlark"}

Functions

func ConvertToStringMap

func ConvertToStringMap(v interface{}) interface{}

func NewStruct

func NewStruct(v interface{}) starlark.Value

func ToValue

func ToValue(v interface{}) (starlark.Value, error)

Types

type MethodsWrapper

type MethodsWrapper interface {
	Methods() map[string]builtin.Function
}

type StarlarkStruct

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

func (*StarlarkStruct) Attr

func (s *StarlarkStruct) Attr(name string) (starlark.Value, error)

Attr returns a starlark value that wraps the method or field with the given name.

func (*StarlarkStruct) AttrNames

func (s *StarlarkStruct) AttrNames() []string

AttrNames returns the list of all fields and methods on this struct.

func (*StarlarkStruct) Freeze

func (s *StarlarkStruct) Freeze()

Freeze causes the value, and all values transitively reachable from it through collections and closures, to be marked as frozen. All subsequent mutations to the data structure through this API will fail dynamically, making the data structure immutable and safe for publishing to other Starlark interpreters running concurrently.

func (*StarlarkStruct) Hash

func (s *StarlarkStruct) Hash() (uint32, error)

Hash returns a function of x such that Equals(x, y) => Hash(x) == Hash(y). Hash may fail if the value's type is not hashable, or if the value contains a non-hashable value.

func (*StarlarkStruct) MarshalJSON

func (s *StarlarkStruct) MarshalJSON() ([]byte, error)

func (*StarlarkStruct) SetField

func (s *StarlarkStruct) SetField(name string, val starlark.Value) error

SetField sets the struct field with the given name with the given value.

func (*StarlarkStruct) String

func (s *StarlarkStruct) String() string

String returns the string representation of the value. Starlark string values are quoted as if by Python's repr.

func (*StarlarkStruct) Truth

func (s *StarlarkStruct) Truth() starlark.Bool

Truth returns the truth value of an object.

func (*StarlarkStruct) Type

func (s *StarlarkStruct) Type() string

Type returns a short string describing the value's type.

Jump to

Keyboard shortcuts

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