core

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Overview

Package core provides facilities for low-level integration with Starlark.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolArg

func BoolArg(kwargs []starlark.Tuple, keyToFind string, defaultValue bool) (bool, error)

BoolArg return a boolean value from starlark.Tupe based on a given key, defaults to defaultValue.

func CheckArgNames added in v0.48.0

func CheckArgNames(kwargs []starlark.Tuple, validKeys map[string]struct{}) error

func Int64Arg added in v0.48.0

func Int64Arg(kwargs []starlark.Tuple, keyToFind string) (int64, error)

Types

type GoValue

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

func NewGoValue

func NewGoValue(val interface{}) GoValue

func NewGoValueWithOpts added in v0.48.0

func NewGoValueWithOpts(val interface{}, opts GoValueOpts) GoValue

func (GoValue) AsStarlarkValue

func (e GoValue) AsStarlarkValue() starlark.Value

type GoValueOpts added in v0.48.0

type GoValueOpts struct {
	MapIsStruct bool
	Convert     func(interface{}) (starlark.Value, bool)
}

type GoValueToStarlarkValueConversion

type GoValueToStarlarkValueConversion interface {
	AsStarlarkValue() starlark.Value
}

type StarlarkFunc

type StarlarkFunc func(thread *starlark.Thread, f *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)

func ErrDescWrapper added in v0.25.0

func ErrDescWrapper(desc string, wrappedFunc StarlarkFunc) StarlarkFunc

func ErrWrapper

func ErrWrapper(wrappedFunc StarlarkFunc) StarlarkFunc

type StarlarkNoop

type StarlarkNoop struct{}

func (*StarlarkNoop) Freeze

func (s *StarlarkNoop) Freeze()

func (*StarlarkNoop) Hash

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

func (*StarlarkNoop) String

func (s *StarlarkNoop) String() string

func (*StarlarkNoop) Truth

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

func (*StarlarkNoop) Type

func (s *StarlarkNoop) Type() string

type StarlarkStruct

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

func NewStarlarkStruct added in v0.48.0

func NewStarlarkStruct(goStringKeyToStarlarkValue *orderedmap.Map) *StarlarkStruct

func (*StarlarkStruct) Attr

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

returns (nil, nil) if attribute not present

func (*StarlarkStruct) AttrNames

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

callers must not modify the result.

func (*StarlarkStruct) Freeze

func (s *StarlarkStruct) Freeze()

func (*StarlarkStruct) Get added in v0.48.0

func (s *StarlarkStruct) Get(key starlark.Value) (val starlark.Value, found bool, err error)

func (*StarlarkStruct) Hash

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

func (*StarlarkStruct) Items added in v0.48.0

func (s *StarlarkStruct) Items() (items []starlark.Tuple)

func (*StarlarkStruct) Iterate added in v0.48.0

func (s *StarlarkStruct) Iterate() starlark.Iterator

func (*StarlarkStruct) Len added in v0.48.0

func (s *StarlarkStruct) Len() int

func (*StarlarkStruct) String

func (s *StarlarkStruct) String() string

func (*StarlarkStruct) Truth

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

func (*StarlarkStruct) Type

func (s *StarlarkStruct) Type() string

type StarlarkStructIterator added in v0.48.0

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

func (*StarlarkStructIterator) Done added in v0.48.0

func (s *StarlarkStructIterator) Done()

func (*StarlarkStructIterator) Next added in v0.48.0

type StarlarkValue

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

func NewStarlarkValue

func NewStarlarkValue(val starlark.Value) StarlarkValue

func (StarlarkValue) AsBool

func (e StarlarkValue) AsBool() (bool, error)

func (StarlarkValue) AsFloat64 added in v0.48.0

func (e StarlarkValue) AsFloat64() (float64, error)

AsFloat64 converts a Starlark number (either int or float) to the corresponding Go double-precision float.

func (StarlarkValue) AsGoValue added in v0.48.0

func (e StarlarkValue) AsGoValue() (interface{}, error)

func (StarlarkValue) AsInt64

func (e StarlarkValue) AsInt64() (int64, error)

func (StarlarkValue) AsString

func (e StarlarkValue) AsString() (string, error)

type StarlarkValueToGoValueConversion

type StarlarkValueToGoValueConversion interface {
	AsGoValue() (interface{}, error)
}

type UnconvertableStarlarkValue added in v0.48.0

type UnconvertableStarlarkValue interface {
	ConversionHint() string
}

Jump to

Keyboard shortcuts

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