Documentation ¶
Index ¶
- func AllUnique[T comparable](sl []T) bool
- func Contains[T comparable](sl []T, item T) bool
- func DecodeOptions(in io.ReadCloser, formatHint string, out any) error
- func Exec(ctx context.Context, command string, args ...string) error
- func ExecOutput(ctx context.Context, command string, args ...string) ([]byte, error)
- func Pointer[T any](t T) *T
- func PrettyByteSize(bf float64) string
- func UpsertSlice[T comparable](sl []T, item T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllUnique ¶ added in v0.1.2
func AllUnique[T comparable](sl []T) bool
AllUnique returns true if all elements in the given slice are unique.
func Contains ¶
func Contains[T comparable](sl []T, item T) bool
Contains returns true if the given slice contains the given item.
func DecodeOptions ¶
func DecodeOptions(in io.ReadCloser, formatHint string, out any) error
DecodeOptions will attempt to decode the given reader into the given object. The formatHint is used to select the format of the document. If the formatHint is empty, the format is guessed from the document. The document is first treated as a go-template with some custom functions. This allows us to use environment variables and file contents in the config.
func ExecOutput ¶
ExecOutput executes a command with context and returns the output.
func PrettyByteSize ¶ added in v0.1.2
PrettyByteSize returns a human-readable string of the given byte size.
func UpsertSlice ¶ added in v0.6.0
func UpsertSlice[T comparable](sl []T, item T) []T
UpsertSlice with insert the given item into a slice if it does not exist, otherwise it will update the existing item and return the updated slice.
Types ¶
This section is empty.