metadata

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 229

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeMetadata

func DecodeMetadata(input any, result any) error

DecodeMetadata decodes a component metadata into a struct. This is an extension of mitchellh/mapstructure which also supports decoding durations.

func GetMetadataProperty

func GetMetadataProperty(props map[string]string, keys ...string) (val string, ok bool)

GetMetadataProperty returns a property from the metadata map, with support for case-insensitive keys and aliases.

func GetMetadataPropertyWithMatchedKey added in v0.15.0

func GetMetadataPropertyWithMatchedKey(props map[string]string, keys ...string) (key string, val string, ok bool)

GetMetadataPropertyWithMatchedKey returns a property from the metadata map, with support for case-insensitive keys and aliases, while returning the original matching metadata field key.

Types

type ByteSize

type ByteSize struct {
	resource.Quantity
}

ByteSize contains a quantity for a resource that is measured in bytes. This extends the resource.Quantity struct from k8s.io/apimachinery to add some utility methods specific for Dapr. Although the library from K8s supports other kinds of resource quantities, our focus is on sizes in bytes.

func NewByteSize

func NewByteSize(defaultValue int64) ByteSize

NewByteSize returns a new ByteSize with a default value in bytes.

func (*ByteSize) GetBytes

func (q *ByteSize) GetBytes() (int64, error)

GetBytes returns the number of bytes in the quantity. Note: this operation is expensive, so it's recommended to cache the returned value.

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) ToISOString

func (d Duration) ToISOString() string

ToISOString returns the duration formatted as a ISO-8601 duration string (-ish). This methods supports days, hours, minutes, and seconds. It assumes all durations are in UTC time and are not impacted by DST (so all days are 24-hours long). This method does not support fractions of seconds, and durations are truncated to seconds. See https://en.wikipedia.org/wiki/ISO_8601#Durations for referece.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Properties added in v0.15.0

type Properties map[string]string

Properties contains metadata properties, as a key-value dictionary

func (Properties) Decode added in v0.15.0

func (p Properties) Decode(result any) error

Decode decodes metadata into a struct. This is an extension of mitchellh/mapstructure which also supports decoding durations.

func (Properties) GetProperty added in v0.15.0

func (p Properties) GetProperty(keys ...string) (val string, ok bool)

GetProperty returns a property from the metadata, with support for case-insensitive keys and aliases.

func (Properties) GetPropertyWithMatchedKey added in v0.15.0

func (p Properties) GetPropertyWithMatchedKey(keys ...string) (key string, val string, ok bool)

GetPropertyWithMatchedKey returns a property from the metadata, with support for case-insensitive keys and aliases, while returning the original matching metadata field key.

Jump to

Keyboard shortcuts

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