metadata

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 106

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.

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

Jump to

Keyboard shortcuts

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