util

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Copyright (c) 2024 Eli Janssen Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var Version string

Functions

func Keys

func Keys[M ~map[K]V, K comparable, V any](m M) []K

Keys returns the keys of the map m. The keys will be an indeterminate order.

func KeysSorted

func KeysSorted[M ~map[K]V, K cmp.Ordered, V any](m M) []K

Keys returns the keys of the map m. The keys will be an indeterminate order.

func Must

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

func MustParseTime

func MustParseTime(layout, value string) time.Time

func MustReadAll

func MustReadAll(r io.ReadCloser) []byte

func OptionFlatMapConvert

func OptionFlatMapConvert[T any, V any](
	input mo.Option[T], mapF func(mo.Option[T]) (mo.Option[V], error),
) (mo.Option[V], error)

func OptionMapConvert

func OptionMapConvert[T any, V any](
	input mo.Option[T], mapF func(T) (V, error),
) (mo.Option[V], error)

func ToListByFunc

func ToListByFunc[T any, K comparable](sliceList []T, keyFunc func(T) K) []K

func ToMapIndexedByFunc

func ToMapIndexedByFunc[T any, K comparable, V any](sliceList []T, keyFunc func(T) (K, V)) map[K]V

func ToSet

func ToSet[T comparable](sliceList []T) map[T]struct{}

func ToSetIndexed

func ToSetIndexed[T comparable](sliceList []T) map[T]int

func Uniq

func Uniq[T comparable](sliceList []T) []T

Types

type AnyInteger added in v1.1.0

type AnyInteger interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

type CloseTimeMatcher

type CloseTimeMatcher struct {
	Value  time.Time
	Within time.Duration
}

func (CloseTimeMatcher) Match

func (a CloseTimeMatcher) Match(v interface{}) bool

Match satisfies sqlmock.Argument interface

type Matcher

type Matcher interface {
	Match(interface{}) bool
}

func OptionMatcher

func OptionMatcher[T any](m Matcher) Matcher

type MatcherFunc

type MatcherFunc func(v interface{}) bool

type VersionInfo

type VersionInfo struct {
	Version   string
	GoVersion string
	Revision  string
	Dirty     bool
}

func GetVersion

func GetVersion() (VersionInfo, error)

Jump to

Keyboard shortcuts

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