utils

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	VAR        = "var"
	ATTRIBUTES = "attributes"
	FUNCTIONS  = "functions"
)

Variables

View Source
var File_proto_determined_proto protoreflect.FileDescriptor

Functions

func CtyNumberToNative added in v1.7.0

func CtyNumberToNative(val cty.Value) (interface{}, error)

func CtyToExpression added in v1.7.0

func CtyToExpression(cv cty.Value, rng hcl.Range) hclsyntax.Expression

func CtyToNative added in v1.7.0

func CtyToNative(val cty.Value) (interface{}, error)

func ExpressionToCty added in v1.7.0

func ExpressionToCty(ref map[string]interface{}, node *Tree, v hclsyntax.Expression) (cty.Value, error)

func NativeToCty added in v1.7.0

func NativeToCty(item interface{}) (cty.Value, error)

Types

type ListStruct added in v1.8.0

type ListStruct struct {
	ListFields []*Struct `protobuf:"bytes,1,rep,name=list_fields,json=listFields,proto3" json:"list_fields,omitempty"`
	// contains filtered or unexported fields
}

func (*ListStruct) Descriptor deprecated added in v1.8.0

func (*ListStruct) Descriptor() ([]byte, []int)

Deprecated: Use ListStruct.ProtoReflect.Descriptor instead.

func (*ListStruct) GetListFields added in v1.8.0

func (x *ListStruct) GetListFields() []*Struct

func (*ListStruct) ProtoMessage added in v1.8.0

func (*ListStruct) ProtoMessage()

func (*ListStruct) ProtoReflect added in v1.8.0

func (x *ListStruct) ProtoReflect() protoreflect.Message

func (*ListStruct) Reset added in v1.8.0

func (x *ListStruct) Reset()

func (*ListStruct) String added in v1.8.0

func (x *ListStruct) String() string

type Map2Struct added in v1.8.0

type Map2Struct struct {
	Map2Fields map[string]*MapStruct `` /* 179-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Map2Struct) Descriptor deprecated added in v1.8.0

func (*Map2Struct) Descriptor() ([]byte, []int)

Deprecated: Use Map2Struct.ProtoReflect.Descriptor instead.

func (*Map2Struct) GetMap2Fields added in v1.8.0

func (x *Map2Struct) GetMap2Fields() map[string]*MapStruct

func (*Map2Struct) ProtoMessage added in v1.8.0

func (*Map2Struct) ProtoMessage()

func (*Map2Struct) ProtoReflect added in v1.8.0

func (x *Map2Struct) ProtoReflect() protoreflect.Message

func (*Map2Struct) Reset added in v1.8.0

func (x *Map2Struct) Reset()

func (*Map2Struct) String added in v1.8.0

func (x *Map2Struct) String() string

type MapStruct added in v1.8.0

type MapStruct struct {
	MapFields map[string]*Struct `` /* 176-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*MapStruct) Descriptor deprecated added in v1.8.0

func (*MapStruct) Descriptor() ([]byte, []int)

Deprecated: Use MapStruct.ProtoReflect.Descriptor instead.

func (*MapStruct) GetMapFields added in v1.8.0

func (x *MapStruct) GetMapFields() map[string]*Struct

func (*MapStruct) ProtoMessage added in v1.8.0

func (*MapStruct) ProtoMessage()

func (*MapStruct) ProtoReflect added in v1.8.0

func (x *MapStruct) ProtoReflect() protoreflect.Message

func (*MapStruct) Reset added in v1.8.0

func (x *MapStruct) Reset()

func (*MapStruct) String added in v1.8.0

func (x *MapStruct) String() string

type Struct added in v1.8.0

type Struct struct {
	ClassName string            `protobuf:"bytes,1,opt,name=ClassName,proto3" json:"ClassName,omitempty"`
	Fields    map[string]*Value `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

func NewStruct added in v1.8.0

func NewStruct(name string, v ...map[string]interface{}) (*Struct, error)

NewStruct constructs a Struct from a generic Go map. v is optionally map[string]interface{}. The map values are converted using NewValue.

func (*Struct) Descriptor deprecated added in v1.8.0

func (*Struct) Descriptor() ([]byte, []int)

Deprecated: Use Struct.ProtoReflect.Descriptor instead.

func (*Struct) GetClassName added in v1.8.0

func (x *Struct) GetClassName() string

func (*Struct) GetFields added in v1.8.0

func (x *Struct) GetFields() map[string]*Value

func (*Struct) ProtoMessage added in v1.8.0

func (*Struct) ProtoMessage()

func (*Struct) ProtoReflect added in v1.8.0

func (x *Struct) ProtoReflect() protoreflect.Message

func (*Struct) Reset added in v1.8.0

func (x *Struct) Reset()

func (*Struct) String added in v1.8.0

func (x *Struct) String() string

type Tree added in v1.7.0

type Tree struct {
	Name  string
	Data  sync.Map
	Up    *Tree
	Downs []*Tree
	// contains filtered or unexported fields
}

Tree is a tree structure that can be used to represent a nested structure in HCL

func DefaultTreeFunctions added in v1.10.1

func DefaultTreeFunctions(ref map[string]interface{}) (*Tree, map[string]interface{})

DefaultTreeFunctions returns the default tree, and the map containing default functions and the default tree

func NewTree added in v1.7.0

func NewTree(name string) *Tree

NewTree creates a new tree with the given name

func (*Tree) AddItem added in v1.7.0

func (self *Tree) AddItem(k string, v cty.Value)

AddItem adds a new item the tree data.

func (*Tree) AddNode added in v1.7.0

func (self *Tree) AddNode(name string) *Tree

AddNode adds a new node to the tree. It returns the newly created node.

func (*Tree) AddNodes added in v1.8.3

func (self *Tree) AddNodes(tag string, names ...string) *Tree

AddNodes adds a new node to the tree, and then adds the given names as children to the new node.

func (*Tree) DeleteItem added in v1.7.0

func (self *Tree) DeleteItem(k string)

GetItem returns the item with the given key in the tree data

func (*Tree) DeleteNode added in v1.7.0

func (self *Tree) DeleteNode(name string)

DeleteNode deletes the node with the given name.

func (*Tree) FindNode added in v1.7.0

func (self *Tree) FindNode(names []string) *Tree

GetItem returns the item with the given key.

func (*Tree) GetNode added in v1.8.2

func (self *Tree) GetNode(tag string, names ...string) *Tree

GetNode returns the node with the given name. If the node does not exist, it returns nil.

func (*Tree) Variables added in v1.7.0

func (self *Tree) Variables() map[string]cty.Value

Variables returns the variables which can be used as the HCL Value context.

type Value added in v1.8.0

type Value struct {

	// The kind of value.
	//
	// Types that are assignable to Kind:
	//
	//	*Value_SingleStruct
	//	*Value_ListStruct
	//	*Value_MapStruct
	//	*Value_Map2Struct
	Kind isValue_Kind `protobuf_oneof:"kind"`
	// contains filtered or unexported fields
}

func NewValue added in v1.8.0

func NewValue(v interface{}) (*Value, error)

NewValue constructs a Value from generic Go interface v.

╔═══════════════════════════╤══════════════════════════════╗
║ Go type                   │ Conversion                   ║
╠═══════════════════════════╪══════════════════════════════╣
║ string                    │ ending SingleStruct value    ║
║ []string                  │ ending ListStruct value      ║
║ map[string]string         │ ending MapStruct value       ║
║                           │                              ║
║ [2]interface{}            │ SingleStruct value           ║
║ [][2]interface{}          │ ListStruct value             ║
║ map[string][2]interface{} │ MapStruct value              ║
║                           │                              ║
║ *Struct                   │ SingleStruct                 ║
║ []*Struct                 │ ListStruct                   ║
║ map[string]*Struct        │ MapStruct                    ║
╚═══════════════════════════╧══════════════════════════════╝

func (*Value) Descriptor deprecated added in v1.8.0

func (*Value) Descriptor() ([]byte, []int)

Deprecated: Use Value.ProtoReflect.Descriptor instead.

func (*Value) GetKind added in v1.8.0

func (m *Value) GetKind() isValue_Kind

func (*Value) GetListStruct added in v1.8.0

func (x *Value) GetListStruct() *ListStruct

func (*Value) GetMap2Struct added in v1.8.0

func (x *Value) GetMap2Struct() *Map2Struct

func (*Value) GetMapStruct added in v1.8.0

func (x *Value) GetMapStruct() *MapStruct

func (*Value) GetSingleStruct added in v1.8.0

func (x *Value) GetSingleStruct() *Struct

func (*Value) ProtoMessage added in v1.8.0

func (*Value) ProtoMessage()

func (*Value) ProtoReflect added in v1.8.0

func (x *Value) ProtoReflect() protoreflect.Message

func (*Value) Reset added in v1.8.0

func (x *Value) Reset()

func (*Value) String added in v1.8.0

func (x *Value) String() string

type Value_ListStruct added in v1.8.0

type Value_ListStruct struct {
	ListStruct *ListStruct `protobuf:"bytes,2,opt,name=list_struct,json=listStruct,proto3,oneof"`
}

type Value_Map2Struct added in v1.8.0

type Value_Map2Struct struct {
	Map2Struct *Map2Struct `protobuf:"bytes,4,opt,name=map2_struct,json=map2Struct,proto3,oneof"`
}

type Value_MapStruct added in v1.8.0

type Value_MapStruct struct {
	MapStruct *MapStruct `protobuf:"bytes,3,opt,name=map_struct,json=mapStruct,proto3,oneof"`
}

type Value_SingleStruct added in v1.8.0

type Value_SingleStruct struct {
	SingleStruct *Struct `protobuf:"bytes,1,opt,name=single_struct,json=singleStruct,proto3,oneof"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳