common

package
v0.0.0-...-befd928 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DO_NOT_SEND = "doNotSend"
View Source
const MULTIPLE_ITEMS = "#MultipleItems#"
View Source
const MULTIPLE_ITEMS_END = "#MultipleItemsEnd#"

Variables

View Source
var DefaultLogHandler slog.Handler = slog.NewTextHandler(os.Stdout, nil)

Functions

func GetDeprecatedEnv

func GetDeprecatedEnv(name string, defaultValue string, deprecationNote string) string

func GetDeprecatedEnvBool

func GetDeprecatedEnvBool(name string, defaultValue bool, deprecationNote string) (bool, error)

func GetEnvBoolWithDeprecated

func GetEnvBoolWithDeprecated(newName string, oldName string, defaultValue bool) (bool, error)

func GetEnvWithDeprecated

func GetEnvWithDeprecated(newName string, oldName string, defaultValue string) string

func IllConfigBool

func IllConfigBool(entry dirapi.Entry, fallback bool, field func(dirapi.IllConfig) *bool) bool

func IllConfigString

func IllConfigString(entry dirapi.Entry, fallback string, field func(dirapi.IllConfig) *string) string

func MapToStruct

func MapToStruct(obj map[string]any, v any) error

func Must

func Must[T any](ctx ExtendedContext, handler func() (ret T, err error), errMsg string) T

func MustHttp

func MustHttp[T any](ctx ExtendedContext, w http.ResponseWriter, handler func() (ret T, err error), errMsg string) T

func PackItemNote

func PackItemNote(fields []string) string

func PackItemsNote

func PackItemsNote(items [][]string) string

PackItemsNote creates a note string for a SupplyingAgencyMessage containing multiple items, using the defined markers and escaping. Does the reverse of UnpackItemsNote.

func SplitSymbol

func SplitSymbol(symbol string) (authority, value string, err error)

func SplitSymbolLenient

func SplitSymbolLenient(symbol string) (string, string)

func StructToMap

func StructToMap(obj any) (map[string]any, error)

func ToInt32

func ToInt32(i int) int32

func UnpackItemNote

func UnpackItemNote(input string) []string

func UnpackItemsNote

func UnpackItemsNote(note string) ([][]string, int, int)

Types

type BrokerMode

type BrokerMode string
const (
	BrokerModeOpaque      BrokerMode = "opaque"
	BrokerModeTransparent BrokerMode = "transparent"
)

type ExtendedContext

type ExtendedContext interface {
	context.Context
	// return logger associated with this context
	Logger() *slog.Logger
	// create new instance backed by the same context and log handler but with new log args
	WithArgs(args *LoggerArgs) ExtendedContext
	// return logger args associated with this context
	LoggerArgs() LoggerArgs
}

func CreateExtCtxWithArgs

func CreateExtCtxWithArgs(ctx context.Context, args *LoggerArgs) ExtendedContext

func CreateExtCtxWithLogArgsAndHandler

func CreateExtCtxWithLogArgsAndHandler(ctx context.Context, args *LoggerArgs, logHandler slog.Handler) ExtendedContext

type LoggerArgs

type LoggerArgs struct {
	RequestId     string
	TransactionId string
	EventId       string
	Component     string
	Other         map[string]string
}

func (LoggerArgs) WithComponent

func (args LoggerArgs) WithComponent(component string) *LoggerArgs

Jump to

Keyboard shortcuts

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