types

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(v any) bool

IsNil reports whether v is nil.

func ToString

func ToString(v any) string

ToString converts v to a string.

func ToStringE

func ToStringE(v any) (string, error)

ToStringE converts v to a string.

func ToStringSlicePreserveString

func ToStringSlicePreserveString(v any) []string

ToStringSlicePreserveString is the same as ToStringSlicePreserveStringE, but it never fails.

func ToStringSlicePreserveStringE

func ToStringSlicePreserveStringE(v any) ([]string, error)

ToStringSlicePreserveStringE converts v to a string slice. If v is a string, it will be wrapped in a string slice.

func TypeToString

func TypeToString(v any) (string, bool)

TypeToString converts v to a string if it's a valid string type. Note that this will not try to convert numeric values etc., use ToString for that.

func Unwrapv

func Unwrapv(v any) any

Unwrap returns the underlying value of v if it implements Unwrapper, otherwise v is returned.

Types

type DevMarker

type DevMarker interface {
	DevOnly()
}

DevMarker is a marker interface for types that should only be used during development.

type KeyValueStr

type KeyValueStr struct {
	Key   string
	Value string
}

KeyValueStr is a string tuple.

type KeyValues

type KeyValues struct {
	Key    any
	Values []any
}

KeyValues holds an key and a slice of values.

func (KeyValues) KeyString

func (k KeyValues) KeyString() string

KeyString returns the key as a string, an empty string if conversion fails.

func (KeyValues) String

func (k KeyValues) String() string

type LowHigh

type LowHigh[S ~[]byte | string] struct {
	Low  int
	High int
}

LowHigh is typically used to represent a slice boundary.

func (LowHigh[S]) IsZero

func (l LowHigh[S]) IsZero() bool

func (LowHigh[S]) Value

func (l LowHigh[S]) Value(source S) S

type RLocker

type RLocker interface {
	RLock()
	RUnlock()
}

RLocker represents the read locks in sync.RWMutex.

type Unwrapper

type Unwrapper interface {
	// Unwrapv is for internal use only.
	// It got its slightly odd name to prevent collisions with user types.
	Unwrapv() any
}

Unwrapper is implemented by types that can unwrap themselves.

type Zeroer

type Zeroer interface {
	IsZero() bool
}

Zeroer, as implemented by time.Time, will be used by the truth template funcs in Hugo (if, with, not, and, or).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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