internal

package
v0.0.0-...-08e4dfe Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const RequiredErrorCodeString = "required"
View Source
const RequiredErrorMessage = "property is required but was empty"

Variables

This section is empty.

Functions

func FindModuleRoot

func FindModuleRoot() string

FindModuleRoot finds the root of the current module. It does so by looking for a go.mod file in the current working directory.

func IsEmpty

func IsEmpty(v interface{}) bool

IsEmptyFunc verifies if the value is zero value of its type.

func JoinErrors

func JoinErrors[T error](b *strings.Builder, errs []T, indent string)

JoinErrors joins multiple errors into a single pretty-formatted string. JoinErrors assumes the errors are not nil, if this presumption is broken the formatting might not be correct.

func PrettyStringListBuilder

func PrettyStringListBuilder[T any](b *strings.Builder, values []T, surroundingStr string)

PrettyStringListBuilder writes a list of arbitrary values to the provided strings.Builder. It produces a human-readable comma-separated list. Example:

PrettyStringListBuilder(b, []string{"foo", "bar"}, "") -> "foo, bar"
PrettyStringListBuilder(b, []string{"foo", "bar"}, "'") -> "'foo', 'bar'"

func PropertyValueString

func PropertyValueString(v interface{}) string

PropertyValueString returns the string representation of the given value. Structs, interfaces, maps and slices are converted to compacted JSON strings (see struct exceptions below). It tries to improve readability by:

  • limiting the string to 100 characters
  • removing leading and trailing whitespaces
  • escaping newlines

If value is a struct implementing fmt.Stringer fmt.Stringer.String method will be used only if:

  • the struct does not contain any JSON tags
  • the struct is not empty or it is empty but does not have any fields

If a value is a struct of type time.Time it will be formatted using time.RFC3339 layout.

Types

This section is empty.

Directories

Path Synopsis
Package assert provides utility functions for testing which help assert provided conditions are met.
Package assert provides utility functions for testing which help assert provided conditions are met.
cmd
docextractor command
Package collections provides a set of utilities for working with collections, such as slices and maps.
Package collections provides a set of utilities for working with collections, such as slices and maps.
Package examples contains examples of how to use the library which are embedded in main README.md.
Package examples contains examples of how to use the library which are embedded in main README.md.
Package jsonpath provides utilities for working with [JSONPath RFC-9535], which is primarily used in govy for constructing property names.
Package jsonpath provides utilities for working with [JSONPath RFC-9535], which is primarily used in govy for constructing property names.
Package logging is responsible for setting up log/slog configuration.
Package logging is responsible for setting up log/slog configuration.
Package messagetemplates TODO
Package messagetemplates TODO
Package nameinfer provides utilities for inferring struct member names.
Package nameinfer provides utilities for inferring struct member names.
Package stringconvert provides utility functions for converting different types to string.
Package stringconvert provides utility functions for converting different types to string.

Jump to

Keyboard shortcuts

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