Documentation ¶
Overview ¶
package typedvalues provides a data container for annotating, interpreting, and transferring arbitrary data.
It revolves around the TypedValue struct type. Users typically serialize generic (though not entirely generic yet) Golang data to a TypedValue in order to serialize and transfer it. Users can set and get annotations from the TypedValue, which is for example used to preserve important headers from a HTTP request from which the entity was parsed.
The package relies heavily on Protobuf. Besides the primitive types, it supports any entity implementing the proto.Message interface. Internally the TypedValue uses the Protobuf Golang implementation for serializing and deserializing the TypedValue.
In Workflows TypedValues are used for: serialization, allowing it to store the data in the same format as the workflow structures; storing metadata of task outputs, by annotating the TypedValues; and data evaluation, by parsing and formatting task inputs and outputs into structured data (where possible).
Package typedvalues is a generated protocol buffer package.
It is generated from these files:
pkg/types/typedvalues/typedvalues.proto
It has these top-level messages:
TypedValue Expression MapValue ArrayValue NilValue SchedulerValues
Index ¶
- Constants
- Variables
- func IsExpression(s string) bool
- func MustUnwrap(tv *TypedValue) interface{}
- func MustWrapMapTypedValue(tvs map[string]interface{}) map[string]*TypedValue
- func RemoveExpressionDelimiters(expr string) string
- func Unwrap(tv *TypedValue) (interface{}, error)
- func UnwrapArray(tv *TypedValue) ([]interface{}, error)
- func UnwrapBool(tv *TypedValue) (bool, error)
- func UnwrapBytes(tv *TypedValue) ([]byte, error)
- func UnwrapExpression(tv *TypedValue) (string, error)
- func UnwrapFloat64(tv *TypedValue) (float64, error)
- func UnwrapInt64(tv *TypedValue) (int64, error)
- func UnwrapMap(tv *TypedValue) (map[string]interface{}, error)
- func UnwrapMapTypedValue(tvs map[string]*TypedValue) (map[string]interface{}, error)
- func UnwrapProto(tv *TypedValue) (proto.Message, error)
- func UnwrapString(tv *TypedValue) (string, error)
- func UnwrapTypedValueMap(tv *TypedValue) (map[string]*TypedValue, error)
- func WrapMapTypedValue(tvs map[string]interface{}) (map[string]*TypedValue, error)
- type ArrayValue
- type Expression
- type MapValue
- type NamedInput
- type NilValue
- type SchedulerValues
- type TypedValue
- func (*TypedValue) Descriptor() ([]byte, []int)
- func (m *TypedValue) Equals(other *TypedValue) bool
- func (m *TypedValue) Float64() float64
- func (m *TypedValue) GetMetadata() map[string]string
- func (m *TypedValue) GetMetadataValue(k string) (string, bool)
- func (m *TypedValue) GetValue() *google_protobuf.Any
- func (m *TypedValue) Interface() interface{}
- func (*TypedValue) ProtoMessage()
- func (m *TypedValue) Reset()
- func (m *TypedValue) SetMetadata(k string, v string) *TypedValue
- func (m *TypedValue) Short() string
- func (m *TypedValue) String() string
- func (m *TypedValue) ValueType() string
Constants ¶
const (
MetadataPriority = "priority"
)
const (
TypeUrlPrefix = "types.fission.io/"
)
Variables ¶
var ( ErrIllegalTypeAssertion = errors.New("illegal type assertion") ErrUnsupportedType = errors.New("unsupported type") )
Functions ¶
func IsExpression ¶
func MustUnwrap ¶
func MustUnwrap(tv *TypedValue) interface{}
func MustWrapMapTypedValue ¶
func MustWrapMapTypedValue(tvs map[string]interface{}) map[string]*TypedValue
func Unwrap ¶
func Unwrap(tv *TypedValue) (interface{}, error)
func UnwrapArray ¶
func UnwrapArray(tv *TypedValue) ([]interface{}, error)
func UnwrapBool ¶
func UnwrapBool(tv *TypedValue) (bool, error)
func UnwrapBytes ¶
func UnwrapBytes(tv *TypedValue) ([]byte, error)
func UnwrapExpression ¶
func UnwrapExpression(tv *TypedValue) (string, error)
func UnwrapFloat64 ¶
func UnwrapFloat64(tv *TypedValue) (float64, error)
func UnwrapInt64 ¶
func UnwrapInt64(tv *TypedValue) (int64, error)
TODO reduce verbosity of these numberic implementations
func UnwrapMap ¶
func UnwrapMap(tv *TypedValue) (map[string]interface{}, error)
func UnwrapMapTypedValue ¶
func UnwrapMapTypedValue(tvs map[string]*TypedValue) (map[string]interface{}, error)
func UnwrapProto ¶
func UnwrapProto(tv *TypedValue) (proto.Message, error)
func UnwrapString ¶
func UnwrapString(tv *TypedValue) (string, error)
func UnwrapTypedValueMap ¶
func UnwrapTypedValueMap(tv *TypedValue) (map[string]*TypedValue, error)
func WrapMapTypedValue ¶
func WrapMapTypedValue(tvs map[string]interface{}) (map[string]*TypedValue, error)
Types ¶
type ArrayValue ¶
type ArrayValue struct {
Value []*TypedValue `protobuf:"bytes,1,rep,name=value" json:"value,omitempty"`
}
func (*ArrayValue) Descriptor ¶
func (*ArrayValue) Descriptor() ([]byte, []int)
func (*ArrayValue) GetValue ¶
func (m *ArrayValue) GetValue() []*TypedValue
func (*ArrayValue) ProtoMessage ¶
func (*ArrayValue) ProtoMessage()
func (*ArrayValue) Reset ¶
func (m *ArrayValue) Reset()
func (*ArrayValue) String ¶
func (m *ArrayValue) String() string
type Expression ¶
type Expression struct {
Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
}
func (*Expression) Descriptor ¶
func (*Expression) Descriptor() ([]byte, []int)
func (*Expression) GetValue ¶
func (m *Expression) GetValue() string
func (*Expression) ProtoMessage ¶
func (*Expression) ProtoMessage()
func (*Expression) Reset ¶
func (m *Expression) Reset()
func (*Expression) String ¶
func (m *Expression) String() string
type MapValue ¶
type MapValue struct {
Value map[string]*TypedValue `` /* 130-byte string literal not displayed */
}
func (*MapValue) Descriptor ¶
func (*MapValue) GetValue ¶
func (m *MapValue) GetValue() map[string]*TypedValue
func (*MapValue) ProtoMessage ¶
func (*MapValue) ProtoMessage()
type NamedInput ¶
type NamedInput struct { Key string Val *TypedValue }
NamedInput provides the TypedValue along with an associated key.
func Prioritize ¶
func Prioritize(inputs map[string]*TypedValue) []NamedInput
Prioritize sorts the inputs based on the priority label (descending order)
type NilValue ¶
type NilValue struct { }
func (*NilValue) Descriptor ¶
func (*NilValue) ProtoMessage ¶
func (*NilValue) ProtoMessage()
type SchedulerValues ¶
type SchedulerValues struct {
Value map[string]*TypedValue `` /* 130-byte string literal not displayed */
}
func (*SchedulerValues) Descriptor ¶
func (*SchedulerValues) Descriptor() ([]byte, []int)
func (*SchedulerValues) GetValue ¶
func (m *SchedulerValues) GetValue() map[string]*TypedValue
func (*SchedulerValues) ProtoMessage ¶
func (*SchedulerValues) ProtoMessage()
func (*SchedulerValues) Reset ¶
func (m *SchedulerValues) Reset()
func (*SchedulerValues) String ¶
func (m *SchedulerValues) String() string
type TypedValue ¶
type TypedValue struct { // Value holds the actual value in a serialized form. Value *google_protobuf.Any `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` // Labels hold metadata about the value. It is used for example to store origins of data, past transformations, // and information needed by serialization processes. Metadata map[string]string `` /* 136-byte string literal not displayed */ }
TypedValue is used to serialize, deserialize, transfer data values across the workflow engine.
It consists partly copy of protobuf's Any, to avoid protobuf requirement of a protobuf-based type.
func MustWrap ¶
func MustWrap(val interface{}) *TypedValue
func UnwrapTypedValueArray ¶
func UnwrapTypedValueArray(tv *TypedValue) ([]*TypedValue, error)
func Wrap ¶
func Wrap(val interface{}) (*TypedValue, error)
func (*TypedValue) Descriptor ¶
func (*TypedValue) Descriptor() ([]byte, []int)
func (*TypedValue) Equals ¶
func (m *TypedValue) Equals(other *TypedValue) bool
func (*TypedValue) Float64 ¶
func (m *TypedValue) Float64() float64
func (*TypedValue) GetMetadata ¶
func (m *TypedValue) GetMetadata() map[string]string
func (*TypedValue) GetMetadataValue ¶
func (m *TypedValue) GetMetadataValue(k string) (string, bool)
func (*TypedValue) GetValue ¶
func (m *TypedValue) GetValue() *google_protobuf.Any
func (*TypedValue) Interface ¶
func (m *TypedValue) Interface() interface{}
func (*TypedValue) ProtoMessage ¶
func (*TypedValue) ProtoMessage()
func (*TypedValue) Reset ¶
func (m *TypedValue) Reset()
func (*TypedValue) SetMetadata ¶
func (m *TypedValue) SetMetadata(k string, v string) *TypedValue
func (*TypedValue) Short ¶
func (m *TypedValue) Short() string
Short prints a short description of the Value
func (*TypedValue) String ¶
func (m *TypedValue) String() string
func (*TypedValue) ValueType ¶
func (m *TypedValue) ValueType() string
Directories ¶
Path | Synopsis |
---|---|
Package controlflow adds support for workflows and tasks (together "flows") to TypedValues.
|
Package controlflow adds support for workflows and tasks (together "flows") to TypedValues. |
package httpconv provides methods for mapping TypedValues to and from HTTP requests and responses.
|
package httpconv provides methods for mapping TypedValues to and from HTTP requests and responses. |