value

package
v0.33.13 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Helper functions for doing value conversions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsString added in v0.10.18

func AsString(x starlark.Value) (string, bool)

Wrapper around starlark.AsString

func SequenceToStringSlice added in v0.10.15

func SequenceToStringSlice(seq starlark.Sequence) ([]string, error)

func StringSliceToList added in v0.10.22

func StringSliceToList(slice []string) *starlark.List

func ValueGroupToCmdHelper added in v0.14.0

func ValueGroupToCmdHelper(t *starlark.Thread, cmdVal, cmdBatVal, cmdDir starlark.Value, env map[string]string) (model.Cmd, error)

In other similar build systems (Buck and Bazel), there's a "main" command, and then various per-platform overrides. https://docs.bazel.build/versions/master/be/general.html#genrule.cmd_bat This helper function abstracts out the precedence rules.

func ValueOrSequenceToSlice

func ValueOrSequenceToSlice(v starlark.Value) []starlark.Value

If `v` is a `starlark.Sequence`, return a slice of its elements Otherwise, return it as a single-element slice For functions that take `Union[List[T], T]`

func ValueToAbsPath added in v0.10.15

func ValueToAbsPath(thread *starlark.Thread, v starlark.Value) (string, error)

func ValueToBatCmd added in v0.14.0

func ValueToBatCmd(t *starlark.Thread, v, dir starlark.Value, env map[string]string) (model.Cmd, error)

func ValueToHostCmd added in v0.14.0

func ValueToHostCmd(t *starlark.Thread, v, dir starlark.Value, env map[string]string) (model.Cmd, error)

provides dockerfile-style behavior of: a string gets interpreted as a shell command (like, sh -c 'foo bar $X') an array of strings gets interpreted as a raw argv to exec

func ValueToUnixCmd added in v0.14.0

func ValueToUnixCmd(t *starlark.Thread, v, dir starlark.Value, env map[string]string) (model.Cmd, error)

Types

type Duration added in v0.15.1

type Duration time.Duration

Parse duration constants from starlark.

func (Duration) AsDuration added in v0.15.1

func (d Duration) AsDuration() time.Duration

func (Duration) IsZero added in v0.15.1

func (d Duration) IsZero() bool

func (*Duration) Unpack added in v0.15.1

func (d *Duration) Unpack(v starlark.Value) error

type ImageList added in v0.23.4

type ImageList []reference.Named

func (*ImageList) Unpack added in v0.23.4

func (s *ImageList) Unpack(v starlark.Value) error

Unpack an argument that can be expressed as a list or tuple of image references.

type ImplicitStringer added in v0.10.18

type ImplicitStringer interface {
	ImplicitString() string
}

type Int32 added in v0.18.6

type Int32 struct {
	starlark.Int
}

Int32 is a convenience type for unpacking int32 bounded values.

func (Int32) Int32 added in v0.18.6

func (i Int32) Int32() int32

Int32 returns the value as an int32.

It will panic if the value cannot be accurate represented as an int32.

func (*Int32) Unpack added in v0.18.6

func (i *Int32) Unpack(v starlark.Value) error

type LabelSet added in v0.22.1

type LabelSet struct {
	Values map[string]string
}

func (*LabelSet) Unpack added in v0.22.1

func (ls *LabelSet) Unpack(v starlark.Value) error

Unpack an argument that can either be expressed as a string or as a list of strings.

type LabelValue added in v0.22.1

type LabelValue string

func (*LabelValue) String added in v0.22.1

func (lv *LabelValue) String() string

func (*LabelValue) Unpack added in v0.22.1

func (lv *LabelValue) Unpack(v starlark.Value) error

type LocalPath added in v0.17.5

type LocalPath struct {
	Value string
	IsSet bool
	// contains filtered or unexported fields
}

func NewLocalPathUnpacker added in v0.17.5

func NewLocalPathUnpacker(t *starlark.Thread) LocalPath

func (*LocalPath) Unpack added in v0.17.5

func (p *LocalPath) Unpack(v starlark.Value) error

type LocalPathList added in v0.17.11

type LocalPathList struct {
	Value []string
	// contains filtered or unexported fields
}

func NewLocalPathListUnpacker added in v0.17.11

func NewLocalPathListUnpacker(t *starlark.Thread) LocalPathList

func (*LocalPathList) Unpack added in v0.17.11

func (p *LocalPathList) Unpack(v starlark.Value) error

type Name added in v0.19.0

type Name string

Names in Tilt should be valid Kubernetes API names.

We use the loosest validation rules: valid path segment names.

For discussion, see: https://github.com/tilt-dev/tilt/issues/4309

func (Name) String added in v0.19.0

func (n Name) String() string

func (*Name) Unpack added in v0.19.0

func (n *Name) Unpack(v starlark.Value) error

type Optional added in v0.27.0

type Optional[V starlark.Value] struct {
	IsSet bool
	Value V
}

Unpack values that could be V or starlark.None

func (*Optional[V]) Unpack added in v0.27.0

func (o *Optional[V]) Unpack(v starlark.Value) error

type PathMaker added in v0.10.15

type PathMaker interface {
	MakeLocalPath(relPath string) string
}

type StringList added in v0.22.8

type StringList []string

func (*StringList) Unpack added in v0.22.8

func (s *StringList) Unpack(v starlark.Value) error

Unpack an argument that can be expressed as a list or tuple of strings.

type StringOrStringList added in v0.16.0

type StringOrStringList struct {
	Values []string
	IsSet  bool
}

func (*StringOrStringList) Unpack added in v0.16.0

func (s *StringOrStringList) Unpack(v starlark.Value) error

Unpack an argument that can either be expressed as a string or as a list of strings.

type StringSequence added in v0.18.6

type StringSequence []string

StringSequence is a convenience type for dealing with string slices in Starlark.

func (StringSequence) Sequence added in v0.18.6

func (s StringSequence) Sequence() starlark.Sequence

func (*StringSequence) Unpack added in v0.18.6

func (s *StringSequence) Unpack(v starlark.Value) error

type StringStringMap added in v0.17.4

type StringStringMap map[string]string

func (*StringStringMap) AsMap added in v0.17.4

func (s *StringStringMap) AsMap() map[string]string

func (*StringStringMap) Unpack added in v0.17.4

func (s *StringStringMap) Unpack(v starlark.Value) error

type Stringable added in v0.17.2

type Stringable struct {
	Value string
	IsSet bool
}

func (*Stringable) Unpack added in v0.17.2

func (s *Stringable) Unpack(v starlark.Value) error

Jump to

Keyboard shortcuts

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