common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoOnFailure

func DoOnFailure(assertToBeTrue *bool, otherwise func())

func DoOnFailureIgnore

func DoOnFailureIgnore(assertToBeTrue *bool, otherwise func() error)

func FormatVersion

func FormatVersion(v Version, format VersionFormat) string

func IgnoreCloseError

func IgnoreCloseError(when io.Closer)

func IgnoreError

func IgnoreError(when func() error)

func KeepCloseError

func KeepCloseError(target *error, when io.Closer)

func KeepError

func KeepError(target *error, when func() error)

func MapSlice

func MapSlice[I any, O any](in []I, mapper func(I) O) []O

func MapSliceErr

func MapSliceErr[I any, O any](in []I, mapper func(I) (O, error)) ([]O, error)

func Must

func Must(v error, msgAndArgs ...any)

func MustNotNil

func MustNotNil(v any, msgAndArgs ...any)

func P

func P[T any](a T) *T

func ToDebugString

func ToDebugString(formatted bool, what any) string

Types

type Duration

type Duration struct {
	// contains filtered or unexported fields
}

func DurationOf

func DurationOf(native time.Duration) Duration

func MustNewDuration

func MustNewDuration(plain string) Duration

func NewDuration

func NewDuration(plain string) (Duration, error)

func (Duration) IsEqualTo

func (this Duration) IsEqualTo(other any) bool

func (Duration) IsZero

func (this Duration) IsZero() bool

func (Duration) MarshalText

func (this Duration) MarshalText() (text []byte, err error)

func (*Duration) Native

func (this *Duration) Native() time.Duration

func (*Duration) Set

func (this *Duration) Set(text string) error

func (*Duration) SetNative

func (this *Duration) SetNative(v time.Duration)

func (Duration) String

func (this Duration) String() string

func (*Duration) UnmarshalText

func (this *Duration) UnmarshalText(text []byte) error

type FileMode

type FileMode struct {
	// contains filtered or unexported fields
}

func MustNewFileMode

func MustNewFileMode(plain string) FileMode

func NewFileMode

func NewFileMode(plain string) (FileMode, error)

func (FileMode) Get

func (this FileMode) Get() os.FileMode

func (FileMode) IsEqualTo

func (this FileMode) IsEqualTo(other any) bool

func (FileMode) IsZero

func (this FileMode) IsZero() bool

func (FileMode) MarshalText

func (this FileMode) MarshalText() (text []byte, err error)

func (*FileMode) Set

func (this *FileMode) Set(text string) error

func (FileMode) String

func (this FileMode) String() string

func (*FileMode) UnmarshalText

func (this *FileMode) UnmarshalText(text []byte) error

type Regexp

type Regexp struct {
	// contains filtered or unexported fields
}

func MustNewRegexp

func MustNewRegexp(plain string) Regexp

func NewRegexp

func NewRegexp(plain string) (Regexp, error)

func (Regexp) IsEqualTo

func (this Regexp) IsEqualTo(other any) bool

func (Regexp) IsZero

func (this Regexp) IsZero() bool

func (Regexp) MarshalText

func (this Regexp) MarshalText() (text []byte, err error)

func (*Regexp) MatchString

func (this *Regexp) MatchString(s string) bool

func (*Regexp) Set

func (this *Regexp) Set(text string) error

func (Regexp) String

func (this Regexp) String() string

func (*Regexp) UnmarshalText

func (this *Regexp) UnmarshalText(text []byte) error

type Remote

type Remote interface {
	User() string
	Host() net.Host
	String() string
}

type StructuredKey

type StructuredKey []string

func StructuredKeyOf

func StructuredKeyOf(args ...string) StructuredKey

func (StructuredKey) Child

func (this StructuredKey) Child(key string) StructuredKey

func (StructuredKey) Index

func (this StructuredKey) Index(i int) StructuredKey

func (StructuredKey) String

func (this StructuredKey) String() string

type Version

type Version interface {
	Title() string
	Version() string
	Revision() string
	Edition() VersionEdition
	BuildAt() time.Time
	Vendor() string
	GoVersion() string
	Platform() string
}

type VersionEdition

type VersionEdition uint8
const (
	VersionEditionUnknown VersionEdition = iota
	VersionEditionGeneric
	VersionEditionExtended
)

func (*VersionEdition) Set

func (this *VersionEdition) Set(plain string) error

func (VersionEdition) String

func (this VersionEdition) String() string

type VersionFormat

type VersionFormat uint8
const (
	VersionFormatShort VersionFormat = iota
	VersionFormatLong
)

Jump to

Keyboard shortcuts

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