sbckey

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const NoPrefix = ""

NoPrefix defines an empty string constant, typically used to indicate the absence of any prefix.

Variables

This section is empty.

Functions

func ConsulDefaultKeyBuilder

func ConsulDefaultKeyBuilder[T any](prefix string) sbc.KeyBuilder[T]

ConsulDefaultKeyBuilder is a function that returns a key builder for Consul. It builds a key based on a value of an any type T. The built key is generated by formatting the value's type as a string and removing the leading slash if present.

Example usage:

builder := ConsulDefaultKeyBuilder[int]()
key := builder.BuildKey(42) // key = "int"

builder := ConsulDefaultKeyBuilder[int]("prefix/")
key := builder.BuildKey(42) // key = "prefix/int"

func DefaultKeyBuilder

func DefaultKeyBuilder[T any]() sbc.KeyBuilder[T]

DefaultKeyBuilder returns a KeyBuilder function that formats the type of the input value as a string.

func NatsDefaultKeyBuilder

func NatsDefaultKeyBuilder[T any]() sbc.KeyBuilder[T]

NatsDefaultKeyBuilder returns a KeyBuilder function that formats the type of the input value as a string. NATS key should be aligned to following naming convention https://docs.nats.io/nats-concepts/subjects#characters-allowed-for-subject-names

Allowed characters Any ASCII character except null and .,* and > Recommended characters: a to z, A to Z and 0 to 9 and - (names are case-sensitive, and cannot contain whitespace).

Types

This section is empty.

Jump to

Keyboard shortcuts

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