Documentation ¶
Index ¶
- Constants
- func IClone(root any) any
- func ICompare(left, right any) bool
- func IGetBool(v any) (bool, error)
- func IGetBytes(v any) ([]byte, error)
- func IGetFloat32(v any) (float32, error)
- func IGetInt(v any) (int64, error)
- func IGetNumber(v any) (float64, error)
- func IGetString(v any) (string, error)
- func IGetStringMap(v any) (map[string]string, error)
- func IGetTimestamp(v any) (time.Time, error)
- func IGetUInt(v any) (uint64, error)
- func IIsNull(i any) bool
- func ISanitize(i any) any
- func IToBool(v any) (bool, error)
- func IToBytes(i any) []byte
- func IToFloat32(v any) (float32, error)
- func IToFloat64(v any) (float64, error)
- func IToInt(v any) (int64, error)
- func IToInt16(v any) (int16, error)
- func IToInt32(v any) (int32, error)
- func IToInt8(v any) (int8, error)
- func IToNumber(v any) (float64, error)
- func IToString(i any) string
- func IToUint(v any) (uint64, error)
- func IToUint16(v any) (uint16, error)
- func IToUint32(v any) (uint32, error)
- func IToUint8(v any) (uint8, error)
- func RestrictForComparison(v any) any
- type Delete
- type Nothing
- type Type
- type TypeError
Constants ¶
const ( // MaxInt represents the maximum value for a signed integer. MaxInt = maxUint >> 1 // MinInt represents the minimum value for a signed integer. MinInt = ^int64(MaxInt) )
Variables ¶
This section is empty.
Functions ¶
func ICompare ¶
ICompare returns true if both the left and right are equal according to one of the following conditions:
- The types exactly match and have the same value - The types are both either a string or byte slice and the underlying data is the same - The types are both numerical and have the same value - Both types are a matching slice or map containing values matching these same conditions.
func IGetBytes ¶
IGetBytes takes a boxed value and attempts to return a byte slice value. Returns an error if the value is not a string or byte slice.
func IGetFloat32 ¶
IGetFloat32 takes a boxed value and attempts to extract a number (float32) from it.
func IGetNumber ¶
IGetNumber takes a boxed value and attempts to extract a number (float64) from it.
func IGetString ¶
IGetString takes a boxed value and attempts to return a string value. Returns an error if the value is not a string or byte slice.
func IGetStringMap ¶
IGetStringMap takes a boxed value and attempts to extract a string map from it.
func IGetTimestamp ¶
IGetTimestamp takes a boxed value and attempts to coerce it into a timestamp, either by interpretting a numerical value as a unix timestamp, or by parsing a string value as RFC3339Nano.
func IGetUInt ¶
IGetUInt takes a boxed value and attempts to extract an unsigned integer (uint64) from it.
func IIsNull ¶
IIsNull returns whether a bloblang type is null, this includes Delete and Nothing types.
func ISanitize ¶
ISanitize takes a boxed value of any type and attempts to convert it into one of the following types: string, []byte, int64, uint64, float64, bool, []interface{}, map[string]interface{}, Delete, Nothing.
func IToBool ¶
IToBool takes a boxed value and attempts to extract a boolean from it or parse it into a bool.
func IToBytes ¶
IToBytes takes a boxed value of any type and attempts to convert it into a byte slice.
func IToFloat32 ¶
IToFloat32 takes a boxed value and attempts to extract a number (float32) from it or parse one.
func IToFloat64 ¶
IToFloat64 takes a boxed value and attempts to extract a number (float64) from it or parse one.
func IToInt ¶
IToInt takes a boxed value and attempts to extract a number (int64) from it or parse one.
func IToInt16 ¶
IToInt16 takes a boxed value and attempts to extract a number (int64) from it or parse one.
func IToInt32 ¶
IToInt32 takes a boxed value and attempts to extract a number (int32) from it or parse one.
func IToInt8 ¶
IToInt8 takes a boxed value and attempts to extract a number (int8) from it or parse one.
func IToNumber ¶
IToNumber takes a boxed value and attempts to extract a number (float64) from it or parse one.
func IToString ¶
IToString takes a boxed value of any type and attempts to convert it into a string.
func IToUint ¶
IToUint takes a boxed value and attempts to extract a number (uint64) from it or parse one.
func IToUint16 ¶
IToUint16 takes a boxed value and attempts to extract a number (uint16) from it or parse one.
func IToUint32 ¶
IToUint32 takes a boxed value and attempts to extract a number (uint32) from it or parse one.
func IToUint8 ¶
IToUint8 takes a boxed value and attempts to extract a number (uint8) from it or parse one.
func RestrictForComparison ¶
RestrictForComparison takes a boxed value of any type sanitizes it and, additionally, it attempts to perform the following conversions: - int64, uint64 and json.Number to float64. - []byte to string.
Types ¶
type Delete ¶
type Delete *struct{}
Delete is a special type that serializes to `null` when forced but indicates a target should be deleted.
type Nothing ¶
type Nothing *struct{}
Nothing is a special type that serializes to `null` when forced but indicates a query should be disregarded (and not mapped).
type Type ¶
type Type string
Type represents a discrete value type supported by Bloblang queries.
var ( TString Type = "string" TBytes Type = "bytes" TNumber Type = "number" TBool Type = "bool" TTimestamp Type = "timestamp" TArray Type = "array" TObject Type = "object" TNull Type = "null" TDelete Type = "delete" TNothing Type = "nothing" TQuery Type = "query expression" TUnknown Type = "unknown" // Specialised and not generally known over ValueNumber. TInt Type = "integer" TFloat Type = "float" )
ValueType variants.
type TypeError ¶
TypeError represents an error where a value of a type was required for a function, method or operator but instead a different type was found.
func NewTypeError ¶
NewTypeError creates a new type error.
func NewTypeErrorFrom ¶
NewTypeErrorFrom creates a new type error with an annotation of the query that provided the wrong type.