utils

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 17 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandlerNotfound = errors.New("connector handler not found")

Functions

func DebugJSONAttributes added in v0.3.0

func DebugJSONAttributes(data map[string]any, isDebug bool) []attribute.KeyValue

DebugJSONAttributes create OpenTelemetry attributes with JSON data. They are only visible on debug mode.

func DecodeArbitraryJSONPtrSlice added in v0.3.1

func DecodeArbitraryJSONPtrSlice(value any) ([]*any, error)

DecodeArbitraryJSONPtrSlice decodes an arbitrary json pointer slice from object by key.

func DecodeArbitraryJSONSlice added in v0.3.1

func DecodeArbitraryJSONSlice(value any) ([]any, error)

DecodeArbitraryJSONSlice decodes an arbitrary json slice from object by key.

func DecodeBoolean

func DecodeBoolean(value any) (bool, error)

DecodeBoolean tries to convert an unknown value to a bool value.

func DecodeBooleanPtrSlice added in v0.3.1

func DecodeBooleanPtrSlice(value any) ([]*bool, error)

DecodeBooleanPtrSlice decodes a boolean pointer slice from an unknown value.

func DecodeBooleanReflection added in v1.6.0

func DecodeBooleanReflection(value reflect.Value) (bool, error)

DecodeBooleanReflection decodes a boolean value from reflection.

func DecodeBooleanSlice added in v0.3.1

func DecodeBooleanSlice(value any) ([]bool, error)

DecodeBooleanSlice decodes a boolean slice from an unknown value.

func DecodeDate added in v1.6.0

func DecodeDate(value any, options ...DecodeTimeOption) (time.Time, error)

DecodeDate tries to convert an unknown date value to a time.Time value.

func DecodeDateTime

func DecodeDateTime(value any, options ...DecodeTimeOption) (time.Time, error)

DecodeDateTime tries to convert an unknown value to a time.Time value.

func DecodeDateTimePtrSlice added in v0.3.1

func DecodeDateTimePtrSlice(value any) ([]*time.Time, error)

DecodeDateTimePtrSlice tries to convert an unknown value to a time.Time pointer slice.

func DecodeDateTimeReflection added in v1.6.0

func DecodeDateTimeReflection(value reflect.Value, options ...DecodeTimeOption) (time.Time, error)

DecodeDateTimeReflection decodes a time.Time value from reflection.

func DecodeDateTimeSlice added in v0.3.1

func DecodeDateTimeSlice(value any) ([]time.Time, error)

DecodeDateTimeSlice tries to convert an unknown value to a time.Time slice.

func DecodeDuration

func DecodeDuration(value any, options ...DecodeTimeOption) (time.Duration, error)

DecodeDuration tries to convert an unknown value to a duration value.

func DecodeFloat

func DecodeFloat[T float32 | float64](value any) (T, error)

DecodeFloat tries to convert an unknown value to a float value.

func DecodeFloatPtrSlice added in v0.3.1

func DecodeFloatPtrSlice[T float32 | float64](value any) ([]*T, error)

DecodeFloatSlice decodes a float pointer slice from an unknown value.

func DecodeFloatReflection added in v1.6.0

func DecodeFloatReflection[T float32 | float64](value reflect.Value) (T, error)

DecodeFloatReflection decodes the floating-point value using reflection.

func DecodeFloatSlice added in v0.3.1

func DecodeFloatSlice[T float32 | float64](value any) ([]T, error)

DecodeFloatSlice decodes a float slice from an unknown value.

func DecodeInt

func DecodeInt[T int | int8 | int16 | int32 | int64](value any) (T, error)

DecodeInt tries to convert an unknown value to a not-null integer value.

func DecodeIntPtrSlice added in v0.3.1

func DecodeIntPtrSlice[T int | int8 | int16 | int32 | int64](value any) ([]*T, error)

DecodeIntPtrSlice decodes an integer slice from an unknown value.

func DecodeIntReflection added in v1.6.0

func DecodeIntReflection[T int | int8 | int16 | int32 | int64](value reflect.Value) (T, error)

DecodeIntReflection tries to convert an reflection value to an integer.

func DecodeIntSlice added in v0.3.1

func DecodeIntSlice[T int | int8 | int16 | int32 | int64](value any) ([]T, error)

DecodeIntSlice decodes an integer slice from an unknown value.

func DecodeNullableArbitraryJSONPtrSlice added in v0.3.1

func DecodeNullableArbitraryJSONPtrSlice(value any) (*[]*any, error)

DecodeNullableArbitraryJSONPtrSlice decodes a nullable arbitrary json pointer slice from object by key.

func DecodeNullableArbitraryJSONSlice added in v0.3.1

func DecodeNullableArbitraryJSONSlice(value any) (*[]any, error)

DecodeNullableArbitraryJSONSlice decodes a nullable arbitrary json slice from object by key.

func DecodeNullableBoolean

func DecodeNullableBoolean(value any) (*bool, error)

DecodeNullableBoolean tries to convert an unknown value to a bool pointer.

func DecodeNullableBooleanPtrSlice added in v0.3.1

func DecodeNullableBooleanPtrSlice(value any) (*[]*bool, error)

DecodeNullableBooleanPtrSlice decodes a boolean pointer slice from an unknown value.

func DecodeNullableBooleanReflection added in v1.6.0

func DecodeNullableBooleanReflection(value reflect.Value) (*bool, error)

DecodeBooleanReflection decodes a nullable boolean value from reflection.

func DecodeNullableBooleanSlice added in v0.3.1

func DecodeNullableBooleanSlice(value any) (*[]bool, error)

DecodeNullableBooleanSlice decodes a nullable boolean slice from an unknown value.

func DecodeNullableDate added in v1.6.0

func DecodeNullableDate(value any, options ...DecodeTimeOption) (*time.Time, error)

DecodeNullableDate tries to convert an unknown value to a date pointer.

func DecodeNullableDateTime

func DecodeNullableDateTime(value any, options ...DecodeTimeOption) (*time.Time, error)

DecodeNullableDateTime tries to convert an unknown value to a time.Time pointer.

func DecodeNullableDateTimePtrSlice added in v0.3.1

func DecodeNullableDateTimePtrSlice(value any) (*[]*time.Time, error)

DecodeNullableDateTimePtrSlice tries to convert an unknown value to a nullable time.Time pointer slice.

func DecodeNullableDateTimeReflection added in v1.6.1

func DecodeNullableDateTimeReflection(value reflect.Value, options ...DecodeTimeOption) (*time.Time, error)

DecodeNullableDateTimeReflection decodes a nullable time.Time value from reflection.

func DecodeNullableDateTimeSlice added in v0.3.1

func DecodeNullableDateTimeSlice(value any) (*[]time.Time, error)

DecodeNullableDateTimeSlice tries to convert an unknown value to a nullable time.Time slice.

func DecodeNullableDuration

func DecodeNullableDuration(value any, options ...DecodeTimeOption) (*time.Duration, error)

DecodeNullableDuration tries to convert an unknown value to a duration pointer.

func DecodeNullableFloat

func DecodeNullableFloat[T float32 | float64](value any) (*T, error)

DecodeNullableFloat tries to convert an unknown value to a float pointer.

func DecodeNullableFloatPtrSlice added in v0.3.1

func DecodeNullableFloatPtrSlice[T float32 | float64](value any) (*[]*T, error)

DecodeNullableFloatPtrSlice decodes a float pointer slice from an unknown value.

func DecodeNullableFloatReflection added in v1.6.0

func DecodeNullableFloatReflection[T float32 | float64](value reflect.Value) (*T, error)

DecodeNullableFloatReflection decodes the nullable floating-point value using reflection.

func DecodeNullableFloatSlice added in v0.3.1

func DecodeNullableFloatSlice[T float32 | float64](value any) (*[]T, error)

DecodeNullableFloatSlice decodes a float slice from an unknown value.

func DecodeNullableInt

func DecodeNullableInt[T int | int8 | int16 | int32 | int64](value any) (*T, error)

DecodeNullableInt tries to convert an unknown value to a nullable integer.

func DecodeNullableIntPtrSlice added in v0.3.1

func DecodeNullableIntPtrSlice[T int | int8 | int16 | int32 | int64](value any) (*[]*T, error)

DecodeNullableIntPtrSlice decodes an integer pointer slice from an unknown value.

func DecodeNullableIntReflection added in v1.6.0

func DecodeNullableIntReflection[T int | int8 | int16 | int32 | int64](value reflect.Value) (*T, error)

DecodeNullableIntReflection tries to convert an reflection value to a nullable integer.

func DecodeNullableIntSlice added in v0.3.1

func DecodeNullableIntSlice[T int | int8 | int16 | int32 | int64](value any) (*[]T, error)

DecodeNullableIntSlice decodes an integer pointer slice from an unknown value.

func DecodeNullableObject added in v1.6.0

func DecodeNullableObject[T any](value map[string]any, decodeHooks ...mapstructure.DecodeHookFunc) (*T, error)

DecodeNullableObject tries to decode an object from a map.

func DecodeNullableObjectValue

func DecodeNullableObjectValue[T any](object map[string]any, key string, decodeHooks ...mapstructure.DecodeHookFunc) (*T, error)

DecodeNullableObjectValue get and decode a nullable value from object by key.

func DecodeNullableRawJSON added in v0.3.1

func DecodeNullableRawJSON(value any) (*json.RawMessage, error)

DecodeNullableRawJSON decodes a raw json.RawMessage pointer from object by key.

func DecodeNullableRawJSONPtrSlice added in v0.3.1

func DecodeNullableRawJSONPtrSlice(value any) (*[]*json.RawMessage, error)

DecodeNullableRawJSONPtrSlice decodes a nullable json.RawMessage pointer slice from object by key.

func DecodeNullableRawJSONSlice added in v0.3.1

func DecodeNullableRawJSONSlice(value any) (*[]json.RawMessage, error)

DecodeNullableRawJSONSlice decodes a nullable json.RawMessage slice from object by key.

func DecodeNullableString

func DecodeNullableString(value any) (*string, error)

DecodeNullableString tries to convert an unknown value to a string pointer.

func DecodeNullableStringPtrSlice added in v0.3.1

func DecodeNullableStringPtrSlice(value any) (*[]*string, error)

DecodeNullableStringSlice decodes a nullable string slice from an unknown value.

func DecodeNullableStringReflection added in v1.6.0

func DecodeNullableStringReflection(value reflect.Value) (*string, error)

DecodeNullableStringReflection a nullable string from reflection value.

func DecodeNullableStringSlice added in v0.3.1

func DecodeNullableStringSlice(value any) (*[]string, error)

DecodeNullableStringSlice decodes a nullable string slice from an unknown value.

func DecodeNullableUUID added in v0.3.1

func DecodeNullableUUID(value any) (*uuid.UUID, error)

DecodeNullableUUID decodes UUID pointer from string or bytes.

func DecodeNullableUUIDPtrSlice added in v0.3.1

func DecodeNullableUUIDPtrSlice(value any) (*[]*uuid.UUID, error)

DecodeNullableUUIDPtrSlice decodes UUID pointer slice from array string.

func DecodeNullableUUIDSlice added in v0.3.1

func DecodeNullableUUIDSlice(value any) (*[]uuid.UUID, error)

DecodeNullableUUIDSlice decodes a nullable UUID slice from array string.

func DecodeNullableUint

func DecodeNullableUint[T uint | uint8 | uint16 | uint32 | uint64](value any) (*T, error)

DecodeNullableUint tries to convert an unknown value to a nullable unsigned integer pointer.

func DecodeNullableUintPtrSlice added in v0.3.1

func DecodeNullableUintPtrSlice[T uint | uint8 | uint16 | uint32 | uint64](value any) (*[]*T, error)

DecodeNullableUintPtrSlice decodes an unsigned integer pointer slice from an unknown value.

func DecodeNullableUintReflection added in v1.6.0

func DecodeNullableUintReflection[T uint | uint8 | uint16 | uint32 | uint64](value reflect.Value) (*T, error)

DecodeNullableUintReflection tries to convert an reflection value to a nullable unsigned-integer.

func DecodeNullableUintSlice added in v0.3.1

func DecodeNullableUintSlice[T uint | uint8 | uint16 | uint32 | uint64](value any) (*[]T, error)

DecodeNullableUintSlice decodes an unsigned integer slice from an unknown value.

func DecodeNullableValue

func DecodeNullableValue[T any](value any, decodeHooks ...mapstructure.DecodeHookFunc) (*T, error)

DecodeNullableValue tries to convert and set an unknown value into the target, fallback to mapstructure decoder.

func DecodeObject added in v1.6.0

func DecodeObject[T any](value map[string]any, decodeHooks ...mapstructure.DecodeHookFunc) (T, error)

DecodeObject tries to decode an object from a map.

func DecodeObjectValue

func DecodeObjectValue[T any](object map[string]any, key string, decodeHooks ...mapstructure.DecodeHookFunc) (T, error)

DecodeObjectValue get and decode a value from object by key.

func DecodeObjectValueDefault added in v1.6.0

func DecodeObjectValueDefault[T any](object map[string]any, key string, decodeHooks ...mapstructure.DecodeHookFunc) (T, error)

DecodeObjectValueDefault get and decode a value from object by key. Returns the empty object if the input value is null.

func DecodeRawJSONPtrSlice added in v0.3.1

func DecodeRawJSONPtrSlice(value any) ([]*json.RawMessage, error)

DecodeRawJSONPtrSlice decodes a json.RawMessage pointer slice from object by key.

func DecodeRawJSONSlice added in v0.3.1

func DecodeRawJSONSlice(value any) ([]json.RawMessage, error)

DecodeRawJSONSlice decodes a json.RawMessage slice from object by key.

func DecodeString

func DecodeString(value any) (string, error)

DecodeString tries to convert an unknown value to a string value.

func DecodeStringPtrSlice added in v0.3.1

func DecodeStringPtrSlice(value any) ([]*string, error)

DecodeStringPtrSlice decodes a string pointer slice from an unknown value.

func DecodeStringReflection added in v1.6.0

func DecodeStringReflection(value reflect.Value) (string, error)

DecodeStringReflection decodes a string from reflection value.

func DecodeStringSlice added in v0.3.1

func DecodeStringSlice(value any) ([]string, error)

DecodeStringSlice decodes a string slice from an unknown value.

func DecodeUUID added in v0.3.1

func DecodeUUID(value any) (uuid.UUID, error)

DecodeUUID decodes UUID from string.

func DecodeUUIDPtrSlice added in v0.3.1

func DecodeUUIDPtrSlice(value any) ([]*uuid.UUID, error)

DecodeUUIDPtrSlice decodes UUID slice from array string.

func DecodeUUIDSlice added in v0.3.1

func DecodeUUIDSlice(value any) ([]uuid.UUID, error)

DecodeUUIDSlice decodes UUID slice from array string.

func DecodeUint

func DecodeUint[T uint | uint8 | uint16 | uint32 | uint64](value any) (T, error)

DecodeUint tries to convert an unknown value to an unsigned integer value.

func DecodeUintPtrSlice added in v0.3.1

func DecodeUintPtrSlice[T uint | uint8 | uint16 | uint32 | uint64](value any) ([]*T, error)

DecodeUintSlice decodes an unsigned integer pointer slice from an unknown value.

func DecodeUintReflection added in v1.6.0

func DecodeUintReflection[T uint | uint8 | uint16 | uint32 | uint64](value reflect.Value) (T, error)

DecodeUintReflection tries to convert an reflection value to an unsigned-integer.

func DecodeUintSlice added in v0.3.1

func DecodeUintSlice[T uint | uint8 | uint16 | uint32 | uint64](value any) ([]T, error)

DecodeUintSlice decodes an unsigned integer slice from an unknown value.

func DecodeValue

func DecodeValue[T any](value any, decodeHooks ...mapstructure.DecodeHookFunc) (T, error)

DecodeValue tries to convert and set an unknown value into the target, the value must not be null fallback to mapstructure decoder.

func EncodeNullableObjectSlice added in v0.3.1

func EncodeNullableObjectSlice[T any](inputs *[]T) ([]map[string]any, error)

EncodeNullableObjectSlice encodes the pointer array of unknown type to map[string]any slice, using json tag to convert object keys.

func EncodeObject

func EncodeObject(input any) (map[string]any, error)

EncodeObject encodes an unknown type to a map[string]any, using json tag to convert object keys.

func EncodeObjectSlice

func EncodeObjectSlice[T any](input []T) ([]map[string]any, error)

EncodeObjectSlice encodes an array of unknown type to map[string]any slice, using json tag to convert object keys.

func EncodeObjectWithColumnSelection

func EncodeObjectWithColumnSelection[T any](fields map[string]schema.Field, data T) (map[string]any, error)

EncodeObjectWithColumnSelection encodes an object with column fields selection without relationship.

func EncodeObjects

func EncodeObjects(input any) ([]map[string]any, error)

EncodeObjects encodes an object rows to a slice of map[string]any, using json tag to convert object keys.

func EncodeObjectsWithColumnSelection

func EncodeObjectsWithColumnSelection[T any](fields map[string]schema.Field, data []T) ([]map[string]any, error)

EncodeObjectsWithColumnSelection encodes objects with column fields selection without relationship.

func EvalFunctionSelectionFieldValue added in v0.1.3

func EvalFunctionSelectionFieldValue(request *schema.QueryRequest) (schema.NestedField, error)

EvalFunctionSelectionFieldValue evaluates the __value field in a function query According to the NDC spec, selection fields of the function type must follow this structure:

{
	"fields": {
		"__value": {
			"type": "column",
			"column": "__value",
			"fields": {
				"type": "object",
				"fields": {
					"fieldA": { "type": "column", "column": "fieldA", "fields": null }
				} // or null
			}
		}
	}
}

func EvalNestedColumnArray

func EvalNestedColumnArray(fields *schema.NestedArray, value any) (any, error)

EvalNestedColumnArray evaluate and prune nested fields from array without relationship.

func EvalNestedColumnArrayIntoSlice

func EvalNestedColumnArrayIntoSlice[T any](fields *schema.NestedArray, value []T) (any, error)

EvalNestedColumnArrayIntoSlice evaluate and prune nested fields from array without relationship.

func EvalNestedColumnFields

func EvalNestedColumnFields(fields schema.NestedField, value any) (any, error)

EvalNestedColumnFields evaluate and prune nested fields without relationship.

func EvalNestedColumnObject

func EvalNestedColumnObject(fields *schema.NestedObject, value any) (any, error)

EvalNestedColumnObject evaluate and prune nested fields from an object without relationship.

func EvalObjectWithColumnSelection

func EvalObjectWithColumnSelection(fields map[string]schema.Field, data map[string]any) (map[string]any, error)

EvalObjectWithColumnSelection evaluate and prune column fields without relationship.

func EvalObjectsWithColumnSelection

func EvalObjectsWithColumnSelection(fields map[string]schema.Field, data []map[string]any) ([]map[string]any, error)

EvalObjectsWithColumnSelection evaluate and prune column fields of array objects without relationship.

func GetAny

func GetAny(object map[string]any, key string) (any, bool)

GetAny get an unknown value from object by key.

func GetArbitraryJSON added in v0.3.1

func GetArbitraryJSON(object map[string]any, key string) (any, error)

GetArbitraryJSON get an arbitrary json value from object by key.

func GetArbitraryJSONDefault added in v1.6.0

func GetArbitraryJSONDefault(object map[string]any, key string) (any, error)

GetArbitraryJSONDefault get an arbitrary json value from object by key. Return nil if the value does not exist

func GetArbitraryJSONPtrSlice added in v0.3.1

func GetArbitraryJSONPtrSlice(object map[string]any, key string) ([]*any, error)

GetArbitraryJSONPtrSlice get an arbitrary json pointer slice from object by key.

func GetArbitraryJSONPtrSliceDefault added in v1.6.0

func GetArbitraryJSONPtrSliceDefault(object map[string]any, key string) ([]*any, error)

GetArbitraryJSONPtrSliceDefault get an arbitrary json pointer slice from object by key.

func GetArbitraryJSONSlice added in v0.3.1

func GetArbitraryJSONSlice(object map[string]any, key string) ([]any, error)

GetArbitraryJSONSlice get an arbitrary json slice from object by key.

func GetArbitraryJSONSliceDefault added in v1.6.0

func GetArbitraryJSONSliceDefault(object map[string]any, key string) ([]any, error)

GetArbitraryJSONSliceDefault get an arbitrary json slice from object by key.

func GetBoolean added in v0.3.1

func GetBoolean(object map[string]any, key string) (bool, error)

GetBoolean get a bool value from object by key.

func GetBooleanDefault added in v1.6.0

func GetBooleanDefault(object map[string]any, key string) (bool, error)

GetBooleanDefault get a bool value from object by key. Returns false if the value is null

func GetBooleanPtrSlice added in v0.3.1

func GetBooleanPtrSlice(object map[string]any, key string) ([]*bool, error)

GetBooleanPtrSlice get a boolean pointer slice value from object by key.

func GetBooleanPtrSliceDefault added in v1.6.0

func GetBooleanPtrSliceDefault(object map[string]any, key string) ([]*bool, error)

GetBooleanPtrSliceDefault get a boolean pointer slice value from object by key.

func GetBooleanSlice added in v0.3.1

func GetBooleanSlice(object map[string]any, key string) ([]bool, error)

GetBooleanSlice get a boolean slice value from object by key.

func GetBooleanSliceDefault added in v1.6.0

func GetBooleanSliceDefault(object map[string]any, key string) ([]bool, error)

GetBooleanSliceDefault get a boolean slice value from object by key.

func GetDateTime

func GetDateTime(object map[string]any, key string, options ...DecodeTimeOption) (time.Time, error)

GetDateTime get a time.Time value from object by key.

func GetDateTimeDefault added in v1.6.0

func GetDateTimeDefault(object map[string]any, key string, options ...DecodeTimeOption) (time.Time, error)

GetDateTimeDefault get a time.Time value from object by key. Returns the empty time if the value is empty.

func GetDateTimePtrSlice added in v0.3.1

func GetDateTimePtrSlice(object map[string]any, key string) ([]*time.Time, error)

GetDateTimePtrSlice get a time.Time pointer slice from object by key.

func GetDateTimePtrSliceDefault added in v1.6.0

func GetDateTimePtrSliceDefault(object map[string]any, key string) ([]*time.Time, error)

GetDateTimePtrSliceDefault get a time.Time pointer slice from object by key.

func GetDateTimeSlice added in v0.3.1

func GetDateTimeSlice(object map[string]any, key string) ([]time.Time, error)

GetDateTimeSlice get a time.Time slice from object by key.

func GetDateTimeSliceDefault added in v1.6.0

func GetDateTimeSliceDefault(object map[string]any, key string) ([]time.Time, error)

GetDateTimeSliceDefault get a time.Time slice from object by key.

func GetDefault added in v0.3.0

func GetDefault[T comparable](value T, defaultValue T) T

GetDefault returns the value or default one if value is empty.

func GetDefaultPtr added in v0.3.0

func GetDefaultPtr[T any](value *T, defaultValue *T) *T

GetDefaultPtr returns the first pointer or default one if GetDefaultPtr is nil.

func GetDefaultValuePtr added in v0.3.0

func GetDefaultValuePtr[T comparable](value *T, defaultValue T) T

GetDefaultValuePtr return the value of pointer or default one if the value of pointer is null or empty.

func GetDuration

func GetDuration(object map[string]any, key string, options ...DecodeTimeOption) (time.Duration, error)

GetDuration get a time.Duration value from object by key.

func GetDurationDefault added in v1.6.0

func GetDurationDefault(object map[string]any, key string, options ...DecodeTimeOption) (time.Duration, error)

GetDurationDefault get a time.Duration value from object by key. Returns 0 if the value is null.

func GetFloat

func GetFloat[T float32 | float64](object map[string]any, key string) (T, error)

GetFloat get a float value from object by key.

func GetFloatDefault added in v1.6.0

func GetFloatDefault[T float32 | float64](object map[string]any, key string) (T, error)

GetFloatDefault get a float value from object by key. Returns 0 if the field is null.

func GetFloatPtrSlice added in v0.3.1

func GetFloatPtrSlice[T float32 | float64](object map[string]any, key string) ([]*T, error)

GetFloatPtrSlice get a float slice from object by key.

func GetFloatPtrSliceDefault added in v1.6.0

func GetFloatPtrSliceDefault[T float32 | float64](object map[string]any, key string) ([]*T, error)

GetFloatPtrSliceDefault get a float slice from object by key.

func GetFloatSlice added in v0.3.1

func GetFloatSlice[T float32 | float64](object map[string]any, key string) ([]T, error)

GetFloatSlice get a float slice from object by key.

func GetFloatSliceDefault added in v1.6.0

func GetFloatSliceDefault[T float32 | float64](object map[string]any, key string) ([]T, error)

GetFloatSliceDefault get a float slice from object by key.

func GetInt

func GetInt[T int | int8 | int16 | int32 | int64](object map[string]any, key string) (T, error)

GetInt get an integer value from object by key.

func GetIntDefault added in v1.6.0

func GetIntDefault[T int | int8 | int16 | int32 | int64](object map[string]any, key string) (T, error)

GetIntDefault get an integer value from object by key. Returns 0 if the field is null.

func GetIntPtrSlice added in v0.3.1

func GetIntPtrSlice[T int | int8 | int16 | int32 | int64](object map[string]any, key string) ([]*T, error)

GetIntPtrSlice get an integer slice from object by key.

func GetIntPtrSliceDefault added in v1.6.0

func GetIntPtrSliceDefault[T int | int8 | int16 | int32 | int64](object map[string]any, key string) ([]*T, error)

GetIntPtrSliceDefault get an integer slice from object by key.

func GetIntSlice added in v0.3.1

func GetIntSlice[T int | int8 | int16 | int32 | int64](object map[string]any, key string) ([]T, error)

GetIntSlice get an integer slice from object by key.

func GetIntSliceDefault added in v1.6.0

func GetIntSliceDefault[T int | int8 | int16 | int32 | int64](object map[string]any, key string) ([]T, error)

GetIntSliceDefault get an integer slice from object by key.

func GetKeys added in v1.4.0

func GetKeys[K cmp.Ordered, V any](input map[K]V) []K

GetKeys gets keys of a map.

func GetNullableArbitraryJSON added in v0.3.1

func GetNullableArbitraryJSON(object map[string]any, key string) (*any, error)

GetNullableArbitraryJSON get an arbitrary json pointer from object by key.

func GetNullableArbitraryJSONPtrSlice added in v0.3.1

func GetNullableArbitraryJSONPtrSlice(object map[string]any, key string) (*[]*any, error)

GetNullableArbitraryJSONPtrSlice get a nullable arbitrary json pointer slice from object by key.

func GetNullableArbitraryJSONSlice added in v0.3.1

func GetNullableArbitraryJSONSlice(object map[string]any, key string) (*[]any, error)

GetNullableArbitraryJSONSlice get a nullable arbitrary json slice from object by key.

func GetNullableBoolean added in v0.3.1

func GetNullableBoolean(object map[string]any, key string) (*bool, error)

GetNullableBoolean get a bool pointer from object by key.

func GetNullableBooleanPtrSlice added in v0.3.1

func GetNullableBooleanPtrSlice(object map[string]any, key string) (*[]*bool, error)

GetNullableBooleanPtrSlice get a nullable boolean slice from object by key.

func GetNullableBooleanSlice added in v0.3.1

func GetNullableBooleanSlice(object map[string]any, key string) (*[]bool, error)

GetNullableBooleanSlice get a nullable boolean slice from object by key.

func GetNullableDateTime

func GetNullableDateTime(object map[string]any, key string, options ...DecodeTimeOption) (*time.Time, error)

GetNullableDateTime get a time.Time pointer from object by key.

func GetNullableDateTimePtrSlice added in v0.3.1

func GetNullableDateTimePtrSlice(object map[string]any, key string) (*[]*time.Time, error)

GetNullableDateTimePtrSlice get a nullable time.Time pointer slice from object by key.

func GetNullableDateTimeSlice added in v0.3.1

func GetNullableDateTimeSlice(object map[string]any, key string) (*[]time.Time, error)

GetNullableDateTimeSlice get a nullable time.Time slice from object by key.

func GetNullableDuration

func GetNullableDuration(object map[string]any, key string, options ...DecodeTimeOption) (*time.Duration, error)

GetNullableDuration get a time.Duration pointer from object by key.

func GetNullableFloat

func GetNullableFloat[T float32 | float64](object map[string]any, key string) (*T, error)

GetNullableFloat get a float pointer from object by key.

func GetNullableFloatPtrSlice added in v0.3.1

func GetNullableFloatPtrSlice[T float32 | float64](object map[string]any, key string) (*[]*T, error)

GetNullableFloatPtrSlice get a float pointer slice from object by key.

func GetNullableFloatSlice added in v0.3.1

func GetNullableFloatSlice[T float32 | float64](object map[string]any, key string) (*[]T, error)

GetNullableFloatSlice get a float pointer slice from object by key.

func GetNullableInt

func GetNullableInt[T int | int8 | int16 | int32 | int64](object map[string]any, key string) (*T, error)

GetNullableInt get an integer pointer from object by key.

func GetNullableIntPtrSlice added in v0.3.1

func GetNullableIntPtrSlice[T int | int8 | int16 | int32 | int64](object map[string]any, key string) (*[]*T, error)

GetNullableIntPtrSlice get an integer pointer slice from object by key.

func GetNullableIntSlice added in v0.3.1

func GetNullableIntSlice[T int | int8 | int16 | int32 | int64](object map[string]any, key string) (*[]T, error)

GetNullableIntSlice get an integer pointer slice from object by key.

func GetNullableRawJSON added in v0.3.1

func GetNullableRawJSON(object map[string]any, key string) (*json.RawMessage, error)

GetNullableRawJSON gets a raw json.RawMessage pointer from object by key.

func GetNullableRawJSONPtrSlice added in v0.3.1

func GetNullableRawJSONPtrSlice(object map[string]any, key string) (*[]*json.RawMessage, error)

GetNullableRawJSONPtrSlice get a nullable json.RawMessage pointer slice from object by key.

func GetNullableRawJSONSlice added in v0.3.1

func GetNullableRawJSONSlice(object map[string]any, key string) (*[]json.RawMessage, error)

GetNullableRawJSONSlice get a nullable json.RawMessage slice from object by key.

func GetNullableString

func GetNullableString(object map[string]any, key string) (*string, error)

GetNullableString get a string pointer from object by key.

func GetNullableStringPtrSlice added in v0.3.1

func GetNullableStringPtrSlice(object map[string]any, key string) (*[]*string, error)

GetNullableStringPtrSlice get a nullable string pointer slice from object by key.

func GetNullableStringSlice added in v0.3.1

func GetNullableStringSlice(object map[string]any, key string) (*[]string, error)

GetNullableStringSlice get a string pointer slice from object by key.

func GetNullableUUID added in v0.3.1

func GetNullableUUID(object map[string]any, key string) (*uuid.UUID, error)

GetNullableUUID get an UUID pointer from object by key.

func GetNullableUUIDPtrSlice added in v0.3.1

func GetNullableUUIDPtrSlice(object map[string]any, key string) (*[]*uuid.UUID, error)

GetNullableUUIDPtrSlice get an UUID pointer slice from object by key.

func GetNullableUUIDSlice added in v0.3.1

func GetNullableUUIDSlice(object map[string]any, key string) (*[]uuid.UUID, error)

GetNullableUUIDSlice get an UUID pointer slice from object by key.

func GetNullableUint

func GetNullableUint[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) (*T, error)

GetNullableUint get an unsigned integer pointer from object by key.

func GetNullableUintPtrSlice added in v0.3.1

func GetNullableUintPtrSlice[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) (*[]*T, error)

GetNullableUintPtrSlice get an unsigned integer pointer slice from object by key.

func GetNullableUintSlice added in v0.3.1

func GetNullableUintSlice[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) (*[]T, error)

GetNullableUintSlice get an unsigned integer pointer slice from object by key.

func GetRawJSON added in v0.3.1

func GetRawJSON(object map[string]any, key string) (json.RawMessage, error)

GetRawJSON get a raw json.RawMessage value from object by key.

func GetRawJSONDefault added in v1.6.0

func GetRawJSONDefault(object map[string]any, key string) (json.RawMessage, error)

GetRawJSONDefault get a raw json.RawMessage value from object by key. Returns nil if the value is empty

func GetRawJSONPtrSlice added in v0.3.1

func GetRawJSONPtrSlice(object map[string]any, key string) ([]*json.RawMessage, error)

GetRawJSONPtrSlice get a json.RawMessage pointer slice from object by key.

func GetRawJSONPtrSliceDefault added in v1.6.0

func GetRawJSONPtrSliceDefault(object map[string]any, key string) ([]*json.RawMessage, error)

GetRawJSONPtrSliceDefault get a json.RawMessage pointer slice from object by key.

func GetRawJSONSlice added in v0.3.1

func GetRawJSONSlice(object map[string]any, key string) ([]json.RawMessage, error)

GetRawJSONSlice get a raw json.RawMessage slice from object by key.

func GetRawJSONSliceDefault added in v1.6.0

func GetRawJSONSliceDefault(object map[string]any, key string) ([]json.RawMessage, error)

GetRawJSONSliceDefault get a raw json.RawMessage slice from object by key.

func GetSortedKeys added in v1.4.0

func GetSortedKeys[K cmp.Ordered, V any](input map[K]V) []K

GetSortedKeys gets keys of a map and sorts them.

func GetSortedValuesByKey added in v1.4.0

func GetSortedValuesByKey[K cmp.Ordered, V any](input map[K]V) []V

GetSortedValuesByKey gets values of a map and sorts by keys.

func GetString

func GetString(object map[string]any, key string) (string, error)

GetString get a string value from object by key.

func GetStringDefault added in v1.6.0

func GetStringDefault(object map[string]any, key string) (string, error)

GetStringDefault get a string value from object by key. Returns an empty string if the value is null

func GetStringPtrSlice added in v0.3.1

func GetStringPtrSlice(object map[string]any, key string) ([]*string, error)

GetStringPtrSlice get a string pointer slice value from object by key.

func GetStringPtrSliceDefault added in v1.6.0

func GetStringPtrSliceDefault(object map[string]any, key string) ([]*string, error)

GetStringPtrSliceDefault get a string pointer slice value from object by key.

func GetStringSlice added in v0.3.1

func GetStringSlice(object map[string]any, key string) ([]string, error)

GetStringSlice get a string slice value from object by key.

func GetStringSliceDefault added in v1.6.0

func GetStringSliceDefault(object map[string]any, key string) ([]string, error)

GetStringSliceDefault get a string slice value from object by key.

func GetUUID added in v0.3.1

func GetUUID(object map[string]any, key string) (uuid.UUID, error)

GetUUID get an UUID value from object by key.

func GetUUIDDefault added in v1.6.0

func GetUUIDDefault(object map[string]any, key string) (uuid.UUID, error)

GetUUIDDefault get an UUID value from object by key. Returns uuid.Nil if the value is null

func GetUUIDPtrSlice added in v0.3.1

func GetUUIDPtrSlice(object map[string]any, key string) ([]*uuid.UUID, error)

GetUUIDPtrSlice get an UUID slice from object by key.

func GetUUIDPtrSliceDefault added in v1.6.0

func GetUUIDPtrSliceDefault(object map[string]any, key string) ([]*uuid.UUID, error)

GetUUIDPtrSliceDefault get an UUID slice from object by key.

func GetUUIDSlice added in v0.3.1

func GetUUIDSlice(object map[string]any, key string) ([]uuid.UUID, error)

GetUUIDSlice get an UUID slice from object by key.

func GetUUIDSliceDefault added in v1.6.0

func GetUUIDSliceDefault(object map[string]any, key string) ([]uuid.UUID, error)

GetUUIDSliceDefault get an UUID slice from object by key.

func GetUint

func GetUint[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) (T, error)

GetUint get an unsigned integer value from object by key.

func GetUintDefault added in v1.6.0

func GetUintDefault[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) (T, error)

GetUintDefault gets an unsigned integer value from object by key. Returns 0 if the field is null.

func GetUintPtrSlice added in v0.3.1

func GetUintPtrSlice[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) ([]*T, error)

GetUintPtrSlice get an unsigned integer slice from object by key.

func GetUintPtrSliceDefault added in v1.6.0

func GetUintPtrSliceDefault[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) ([]*T, error)

GetUintPtrSliceDefault get an unsigned integer slice from object by key.

func GetUintSlice added in v0.3.1

func GetUintSlice[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) ([]T, error)

GetUintSlice get an unsigned integer slice from object by key.

func GetUintSliceDefault added in v1.6.0

func GetUintSliceDefault[T uint | uint8 | uint16 | uint32 | uint64](object map[string]any, key string) ([]T, error)

GetUintSliceDefault get an unsigned integer slice from object by key.

func IsDebug added in v1.4.0

func IsDebug(logger *slog.Logger) bool

IsDebug checks if the log level is debug.

func IsNil

func IsNil(value any) bool

IsNil a safe function to check null value.

func JSONAttribute added in v0.3.0

func JSONAttribute(key string, data any) attribute.KeyValue

JSONAttribute creates a OpenTelemetry attribute with JSON data.

func MergeMap added in v1.4.0

func MergeMap[K comparable, V any](dest map[K]V, src map[K]V) map[K]V

MergeMap merges two value maps into one.

func MergeSchemas added in v1.4.0

func MergeSchemas(schemas ...*schema.SchemaResponse) (*schema.SchemaResponse, []error)

MergeSchemas merge multiple connector schemas into one schema.

func ParseBoolMapFromString added in v1.6.0

func ParseBoolMapFromString(input string) (map[string]bool, error)

ParseBoolMapFromString parses a bool map from a string with format:

<key1>=<value1>;<key2>=<value2>

func ParseFloatMapFromString added in v1.6.0

func ParseFloatMapFromString[T float32 | float64](input string) (map[string]T, error)

ParseFloatMapFromString parses a float map from a string with format:

<key1>=<value1>;<key2>=<value2>

func ParseIntMapFromString added in v1.5.0

func ParseIntMapFromString(input string) (map[string]int, error)

ParseIntMapFromString parses an integer map from a string with format:

<key1>=<value1>;<key2>=<value2>

func ParseIntegerMapFromString added in v1.6.0

func ParseIntegerMapFromString[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](input string) (map[string]T, error)

ParseIntegerMapFromString parses an integer map from a string with format:

<key1>=<value1>;<key2>=<value2>

func ParseStringMapFromString added in v1.6.0

func ParseStringMapFromString(input string) (map[string]string, error)

ParseStringMapFromString parses a string map from a string with format:

<key1>=<value1>;<key2>=<value2>

func PointersToValues added in v0.3.1

func PointersToValues[T any](input []*T) ([]T, error)

PointersToValues converts the pointer slice to value slice.

func ResolveArgumentVariables

func ResolveArgumentVariables(arguments map[string]schema.Argument, variables map[string]any) (map[string]any, error)

ResolveArgumentVariables resolve variables in arguments if exist.

func ToPtr

func ToPtr[V any](value V) *V

ToPtr converts a value to its pointer.

func ToPtrs added in v0.3.1

func ToPtrs[T any](input []T) []*T

ToPtrs converts the value slice to pointer slice.

func UnwrapPointerFromAny added in v0.3.1

func UnwrapPointerFromAny(value any) (any, bool)

UnwrapPointerFromAny unwraps pointers from the input any type.

func UnwrapPointerFromAnyToReflectValue added in v1.6.0

func UnwrapPointerFromAnyToReflectValue(value any) (reflect.Value, bool)

UnwrapPointerFromAnyToReflectValue unwraps pointers from the input any type to the reflection value.

func UnwrapPointerFromReflectValue added in v0.3.1

func UnwrapPointerFromReflectValue(reflectValue reflect.Value) (reflect.Value, bool)

UnwrapPointerFromReflectValue unwraps pointers from the reflect value.

Types

type DecodeTimeOption added in v1.6.1

type DecodeTimeOption func(*decodeTimeOptions)

DecodeTimeOption abstracts a time decoding option

func WithBaseUnix added in v1.6.1

func WithBaseUnix(base time.Duration) DecodeTimeOption

WithBaseUnix sets the base unix value to decode date time or duration

func WithTimeParser added in v1.6.1

func WithTimeParser(parser func(string) (time.Time, error)) DecodeTimeOption

WithTimeParser sets the time parser function to decode date time

type Decoder added in v0.1.1

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

Decoder is a wrapper of mapstructure decoder.

func NewDecoder deprecated added in v0.1.1

func NewDecoder(decodeHooks ...mapstructure.DecodeHookFunc) *Decoder

NewDecoder creates a Decoder instance.

Deprecated: use the generic DecodeValue and DecodeObjectValue functions instead

func (Decoder) DecodeNullableObjectValue deprecated added in v0.1.1

func (d Decoder) DecodeNullableObjectValue(target any, object map[string]any, key string) error

DecodeNullableObjectValue get and decode a nullable value from object by key.

Deprecated: use the generic DecodeNullableObjectValue function instead

func (Decoder) DecodeNullableValue deprecated added in v0.1.1

func (d Decoder) DecodeNullableValue(target any, value any) error

DecodeNullableValue tries to convert and set an unknown value into the target, fallback to mapstructure decoder.

Deprecated: use the generic DecodeNullableValue function instead

func (Decoder) DecodeObject deprecated added in v1.4.0

func (d Decoder) DecodeObject(target any, value map[string]any) error

DecodeObject tries to decode an object from a map.

Deprecated: use the generic DecodeObject function instead

func (Decoder) DecodeObjectValue deprecated added in v0.1.1

func (d Decoder) DecodeObjectValue(target any, object map[string]any, key string) error

DecodeObjectValue get and decode a value from object by key.

Deprecated: use the generic DecodeObjectValue function instead

func (Decoder) DecodeValue deprecated added in v0.1.1

func (d Decoder) DecodeValue(target any, value any) error

DecodeValue tries to convert and set an unknown value into the target, the value must not be null fallback to mapstructure decoder.

Deprecated: use the generic DecodeValue function instead

type EnvBool added in v1.6.0

type EnvBool struct {
	Value    *bool   `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
}

EnvBool represents either a literal boolean or an environment reference

func NewEnvBoolValue added in v1.6.0

func NewEnvBoolValue(value bool) EnvBool

NewEnvBoolValue creates an EnvBool with a literal value

func NewEnvBoolVariable added in v1.6.0

func NewEnvBoolVariable(name string) EnvBool

NewEnvBoolVariable creates an EnvBool with a variable name

func (*EnvBool) Get added in v1.6.0

func (ev *EnvBool) Get() (bool, error)

Get gets literal value or from system environment

func (*EnvBool) GetOrDefault added in v1.6.0

func (ev *EnvBool) GetOrDefault(defaultValue bool) (bool, error)

GetOrDefault gets literal value or from system environment. Returns the default value if the environment value is empty

func (*EnvBool) UnmarshalJSON added in v1.6.0

func (ev *EnvBool) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EnvFloat added in v1.6.0

type EnvFloat struct {
	Value    *float64 `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string  `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
}

EnvFloat represents either a literal floating point number or an environment reference

func NewEnvFloatValue added in v1.6.0

func NewEnvFloatValue(value float64) EnvFloat

NewEnvFloatValue creates an EnvFloat with a literal value

func NewEnvFloatVariable added in v1.6.0

func NewEnvFloatVariable(name string) EnvFloat

NewEnvFloatVariable creates an EnvFloat with a variable name

func (*EnvFloat) Get added in v1.6.0

func (ev *EnvFloat) Get() (float64, error)

Get gets literal value or from system environment

func (*EnvFloat) GetOrDefault added in v1.6.0

func (ev *EnvFloat) GetOrDefault(defaultValue float64) (float64, error)

GetOrDefault gets literal value or from system environment. Returns the default value if the environment value is empty

func (*EnvFloat) UnmarshalJSON added in v1.6.0

func (ev *EnvFloat) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EnvInt added in v1.6.0

type EnvInt struct {
	Value    *int64  `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
}

EnvInt represents either a literal integer or an environment reference

func NewEnvIntValue added in v1.6.0

func NewEnvIntValue(value int64) EnvInt

NewEnvIntValue creates an EnvInt with a literal value

func NewEnvIntVariable added in v1.6.0

func NewEnvIntVariable(name string) EnvInt

NewEnvIntVariable creates an EnvInt with a variable name

func (EnvInt) Get added in v1.6.0

func (ev EnvInt) Get() (int64, error)

Get gets literal value or from system environment

func (EnvInt) GetOrDefault added in v1.6.0

func (ev EnvInt) GetOrDefault(defaultValue int64) (int64, error)

GetOrDefault gets literal value or from system environment. Returns the default value if the environment value is empty

func (*EnvInt) UnmarshalJSON added in v1.6.0

func (ev *EnvInt) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EnvMapBool added in v1.6.0

type EnvMapBool struct {
	Value    map[string]bool `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string         `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
}

EnvMapBool represents either a literal bool map or an environment reference

func NewEnvMapBoolValue added in v1.6.0

func NewEnvMapBoolValue(value map[string]bool) EnvMapBool

NewEnvMapBoolValue creates an EnvMapBool with a literal value

func NewEnvMapBoolVariable added in v1.6.0

func NewEnvMapBoolVariable(name string) EnvMapBool

NewEnvMapBoolVariable creates an EnvMapBool with a variable name

func (*EnvMapBool) Get added in v1.6.0

func (ev *EnvMapBool) Get() (map[string]bool, error)

Get gets literal value or from system environment

func (*EnvMapBool) UnmarshalJSON added in v1.6.0

func (ev *EnvMapBool) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EnvMapFloat added in v1.6.0

type EnvMapFloat struct {
	Value    map[string]float64 `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string            `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
	// contains filtered or unexported fields
}

EnvMapFloat represents either a literal float map or an environment reference

func NewEnvMapFloatValue added in v1.6.0

func NewEnvMapFloatValue(value map[string]float64) EnvMapFloat

NewEnvMapFloatValue creates an EnvMapFloat with a literal value

func NewEnvMapFloatVariable added in v1.6.0

func NewEnvMapFloatVariable(name string) EnvMapFloat

NewEnvMapFloatVariable creates an EnvMapFloat with a variable name

func (*EnvMapFloat) Get added in v1.6.0

func (ev *EnvMapFloat) Get() (map[string]float64, error)

Get gets literal value or from system environment

func (*EnvMapFloat) UnmarshalJSON added in v1.6.0

func (ev *EnvMapFloat) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EnvMapInt added in v1.6.0

type EnvMapInt struct {
	Value    map[string]int64 `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string          `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
}

EnvMapInt represents either a literal int map or an environment reference

func NewEnvMapIntValue added in v1.6.0

func NewEnvMapIntValue(value map[string]int64) EnvMapInt

NewEnvMapIntValue creates an EnvMapInt with a literal value

func NewEnvMapIntVariable added in v1.6.0

func NewEnvMapIntVariable(name string) EnvMapInt

NewEnvMapIntVariable creates an EnvMapInt with a variable name

func (*EnvMapInt) Get added in v1.6.0

func (ev *EnvMapInt) Get() (map[string]int64, error)

Get gets literal value or from system environment

func (*EnvMapInt) UnmarshalJSON added in v1.6.0

func (ev *EnvMapInt) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EnvMapString added in v1.6.0

type EnvMapString struct {
	Value    map[string]string `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string           `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
}

EnvMapString represents either a literal string map or an environment reference

func NewEnvMapStringValue added in v1.6.0

func NewEnvMapStringValue(value map[string]string) EnvMapString

NewEnvMapStringValue creates an EnvMapString with a literal value

func NewEnvMapStringVariable added in v1.6.0

func NewEnvMapStringVariable(name string) EnvMapString

NewEnvMapStringVariable creates an EnvMapString with a variable name

func (*EnvMapString) Get added in v1.6.0

func (ev *EnvMapString) Get() (map[string]string, error)

Get gets literal value or from system environment

func (*EnvMapString) UnmarshalJSON added in v1.6.0

func (ev *EnvMapString) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EnvString added in v1.6.0

type EnvString struct {
	Value    *string `json:"value,omitempty" yaml:"value,omitempty" jsonschema:"oneof_required=value"`
	Variable *string `json:"env,omitempty" yaml:"env,omitempty" jsonschema:"oneof_required=env"`
}

EnvString represents either a literal string or an environment reference

func NewEnvStringValue added in v1.6.0

func NewEnvStringValue(value string) EnvString

NewEnvStringValue creates an EnvString with a literal value

func NewEnvStringVariable added in v1.6.0

func NewEnvStringVariable(name string) EnvString

NewEnvStringVariable creates an EnvString with a variable name

func (EnvString) Get added in v1.6.0

func (ev EnvString) Get() (string, error)

Get gets literal value or from system environment

func (*EnvString) UnmarshalJSON added in v1.6.0

func (ev *EnvString) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MapEncoder

type MapEncoder interface {
	ToMap() map[string]any
}

MapEncoder abstracts a type with the ToMap method to encode type to map.

type ObjectDecoder

type ObjectDecoder interface {
	FromValue(value map[string]any) error
}

ObjectDecoder abstracts a type with the FromValue method to decode an object value.

type Scalar

type Scalar interface {
	ScalarName() string
}

Scalar abstracts a scalar interface to determine when evaluating.

type ValueDecoder

type ValueDecoder interface {
	FromValue(value any) error
}

ValueDecoder abstracts a type with the FromValue method to decode any value.

Jump to

Keyboard shortcuts

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