utils

package
v2.934.2 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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSorted

func AppendSorted[A any](a []A, i A, comp func(A, A) bool) []A

func Dedent

func Dedent(s string) string

func ExtensionsToGoMap

func ExtensionsToGoMap(extensions *extensions.Extensions) map[string]any

func GetEndLine

func GetEndLine(node *yaml.Node) int

func GetSimplifiedRef

func GetSimplifiedRef(ref string) references.Reference

GetSimplifiedRef will return the reference without the preceding file path Though if we get a customer that has the same ref in two different files they include this may identify them incorrectly But that will be a problem anyway as libopenapi when returning references from an external file won't include the file path for a local reference with that file and so we might fail to distinguish between them that way. The fix we need is for libopenapi to also track which file the reference is in so we can always prefix them with the file path

func GetSortedKeys

func GetSortedKeys[K cmp.Ordered, V any](m map[K]V) []K

func IncrementName

func IncrementName(name string) string

func InsertBefore

func InsertBefore(s, match, insert string) (string, error)

func InsertBeforeOrAppend

func InsertBeforeOrAppend(s, match, insert string) string

func MapArray

func MapArray[T any, O any](vs []T, f func(T) O) []O

func MapToArray

func MapToArray[T comparable, O any](m map[T]O) []O

func MapToSequencedMap

func MapToSequencedMap[K cmp.Ordered, V any](m map[K]V) *sequencedmap.Map[K, V]

func Must

func Must[T any](v T, err error) T

func OneManQueue

func OneManQueue(fn func()) func()

A OneManQueue is much like golang's SingleFlight but not every call has to execute. Like SingleFlight, if there's an ongoing call it will enqueue the call. At most At most one call live in the queue. Hence the name. The last call always replaces the currently enqueued call.

func RecursivelyListDirectories

func RecursivelyListDirectories(paths ...string) []string

func RemoveEndNumber

func RemoveEndNumber(name string) string

func ReplaceAllStringSubmatchFunc

func ReplaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func([]string) string) string

func SuffixParamType

func SuffixParamType(name, paramType string) string

func ToBool

func ToBool(value interface{}) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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