metadata

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TTLMetadataKey defines the metadata key for setting a time to live (as a Go duration or number of seconds).
	TTLMetadataKey          = "ttl"
	TTLInSecondsMetadataKey = "ttlInSeconds"

	// RawPayloadKey defines the metadata key for forcing raw payload in pubsub.
	RawPayloadKey = "rawPayload"

	// PriorityMetadataKey defines the metadata key for setting a priority.
	PriorityMetadataKey = "priority"

	// ContentType defines the metadata key for the content type.
	ContentType = "contentType"

	// QueryIndexName defines the metadata key for the name of query indexing schema (for redis).
	QueryIndexName = "queryIndexName"

	// MaxBulkPubBytesKey defines the maximum bytes to publish in a bulk publish request metadata.
	MaxBulkPubBytesKey string = "maxBulkPubBytes"
)

Variables

This section is empty.

Functions

func GetMetadataInfoFromStructType

func GetMetadataInfoFromStructType(t reflect.Type, metadataMap *MetadataMap, componentType ComponentType) error

GetMetadataInfoFromStructType converts a struct to a map of field name (or struct tag) to field type. This is used to generate metadata documentation for components.

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 aliases

func IsRawPayload

func IsRawPayload(props map[string]string) (bool, error)

IsRawPayload determines if payload should be used as-is.

func TryGetContentType

func TryGetContentType(props map[string]string) (string, bool)

func TryGetPriority

func TryGetPriority(props map[string]string) (uint8, bool, error)

TryGetPriority tries to get the priority for binding and any other building block.

func TryGetQueryIndexName

func TryGetQueryIndexName(props map[string]string) (string, bool)

func TryGetTTL

func TryGetTTL(props map[string]string) (time.Duration, bool, error)

TryGetTTL tries to get the ttl as a time.Duration value for pubsub, binding and any other building block.

Types

type Base

type Base struct {
	// Name is the name of the component that's being used.
	Name string
	// Properties is the metadata properties.
	Properties map[string]string `json:"properties,omitempty"`
}

Base is the common metadata across components. All components-specific metadata should embed this.

func (Base) GetProperty

func (b Base) GetProperty(names ...string) (string, bool)

GetProperty returns the value of a property, looking it up case-insensitively

type ComponentType

type ComponentType string
const (
	BindingType            ComponentType = "bindings"
	StateStoreType         ComponentType = "state"
	SecretStoreType        ComponentType = "secretstores"
	PubSubType             ComponentType = "pubsub"
	LockStoreType          ComponentType = "lock"
	ConfigurationStoreType ComponentType = "configuration"
	MiddlewareType         ComponentType = "middleware"
	CryptoType             ComponentType = "crypto"
	NameResolutionType     ComponentType = "nameresolution"
	WorkflowType           ComponentType = "workflows"
	ConversationType       ComponentType = "conversation"
)

func (ComponentType) BuiltInMetadataProperties

func (t ComponentType) BuiltInMetadataProperties() []string

BuiltInMetadataProperties returns the built-in metadata properties for the given component type. These are normally parsed by the runtime.

func (ComponentType) IsValid

func (t ComponentType) IsValid() bool

IsValid returns true if the component type is valid.

type ComponentWithMetadata

type ComponentWithMetadata interface {
}

ComponentWithMetadata is empty when the `metadata` build tag is not present. The build tag is present when running the linter.

type MetadataField

type MetadataField struct {
	// Field type
	Type string
	// True if the field should be ignored by the metadata analyzer
	Ignored bool
	// True if the field is deprecated
	Deprecated bool
	// Aliases used for old, deprecated names
	Aliases []string
}

type MetadataMap

type MetadataMap map[string]MetadataField

Jump to

Keyboard shortcuts

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