utils

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecorateContext

func DecorateContext(c context.Context, k ContextKey, v string) context.Context

DecorateContext decorates the given context with a key-value pair. It returns a new context with the provided key-value pair added.

func GetDescription

func GetDescription(c context.Context) string

GetDescription retrieves the description value from the context. If the value is found and is of type string, it is returned. Otherwise, an empty string is returned.

func GetEnvironment

func GetEnvironment(c context.Context) string

GetEnvironment returns the environment value from the given context. If the environment value is not found in the context, it returns "dev" as the default value.

func GetTitle

func GetTitle(c context.Context) string

GetTitle retrieves the title from the context. If the title is found, it returns the title as a string. If the title is not found, it returns an empty string.

Types

type ContextKey

type ContextKey string
var DescriptionKey ContextKey = "description"
var EnvironmentKey ContextKey = "environment"
var TitleKey ContextKey = "title"

Jump to

Keyboard shortcuts

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