Documentation ¶
Overview ¶
Package types contains types shared between packages in Hugo.
Package types contains types shared between packages in Hugo.
Index ¶
- Variables
- func IsNil(v any) bool
- func NewBool(b bool) *bool
- func ToDuration(v any) time.Duration
- func ToDurationE(v any) (time.Duration, error)
- func ToString(v any) string
- func ToStringE(v any) (string, error)
- func ToStringSlicePreserveString(v any) []string
- func ToStringSlicePreserveStringE(v any) ([]string, error)
- func TypeToString(v any) (string, bool)
- func Unwrapv(v any) any
- type CloseAdder
- type Closer
- type Closers
- type DevMarker
- type EvictingStringQueue
- func (q *EvictingStringQueue) Add(v string) *EvictingStringQueue
- func (q *EvictingStringQueue) Contains(v string) bool
- func (q *EvictingStringQueue) Len() int
- func (q *EvictingStringQueue) Peek() string
- func (q *EvictingStringQueue) PeekAll() []string
- func (q *EvictingStringQueue) PeekAllSet() map[string]bool
- type KeyValue
- type KeyValueStr
- type KeyValues
- type LowHigh
- type PrintableValueProvider
- type RLocker
- type Result
- type Unwrapper
- type Zeroer
Constants ¶
This section is empty.
Variables ¶
var InvocationCounter atomic.Int64
This is only used for debugging purposes.
Functions ¶
func ToDuration ¶ added in v0.85.0
ToDuration converts v to time.Duration. See ToDurationE if you need to handle errors.
func ToDurationE ¶ added in v0.85.0
ToDurationE converts v to time.Duration.
func ToStringSlicePreserveString ¶ added in v0.65.0
ToStringSlicePreserveString is the same as ToStringSlicePreserveStringE, but it never fails.
func ToStringSlicePreserveStringE ¶ added in v0.84.0
ToStringSlicePreserveStringE converts v to a string slice. If v is a string, it will be wrapped in a string slice.
func TypeToString ¶ added in v0.67.1
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.
Types ¶
type CloseAdder ¶ added in v0.127.0
type CloseAdder interface {
Add(Closer)
}
type DevMarker ¶ added in v0.55.0
type DevMarker interface {
DevOnly()
}
DevMarker is a marker interface for types that should only be used during development.
type EvictingStringQueue ¶ added in v0.30.1
type EvictingStringQueue struct {
// contains filtered or unexported fields
}
EvictingStringQueue is a queue which automatically evicts elements from the head of the queue when attempting to add new elements onto the queue and it is full. This queue orders elements LIFO (last-in-first-out). It throws away duplicates. Note: This queue currently does not contain any remove (poll etc.) methods.
func NewEvictingStringQueue ¶ added in v0.30.1
func NewEvictingStringQueue(size int) *EvictingStringQueue
NewEvictingStringQueue creates a new queue with the given size.
func (*EvictingStringQueue) Add ¶ added in v0.30.1
func (q *EvictingStringQueue) Add(v string) *EvictingStringQueue
Add adds a new string to the tail of the queue if it's not already there.
func (*EvictingStringQueue) Contains ¶ added in v0.54.0
func (q *EvictingStringQueue) Contains(v string) bool
Contains returns whether the queue contains v.
func (*EvictingStringQueue) Len ¶ added in v0.123.0
func (q *EvictingStringQueue) Len() int
func (*EvictingStringQueue) Peek ¶ added in v0.30.1
func (q *EvictingStringQueue) Peek() string
Peek looks at the last element added to the queue.
func (*EvictingStringQueue) PeekAll ¶ added in v0.30.1
func (q *EvictingStringQueue) PeekAll() []string
PeekAll looks at all the elements in the queue, with the newest first.
func (*EvictingStringQueue) PeekAllSet ¶ added in v0.30.1
func (q *EvictingStringQueue) PeekAllSet() map[string]bool
PeekAllSet returns PeekAll as a set.
type KeyValueStr ¶ added in v0.38.1
KeyValueStr is a string tuple.
type KeyValues ¶
KeyValues holds an key and a slice of values.
func NewKeyValuesStrings ¶
NewKeyValuesStrings takes a given key and slice of values and returns a new KeyValues struct.
type PrintableValueProvider ¶ added in v0.132.0
type PrintableValueProvider interface {
PrintableValue() any
}
PrintableValueProvider is implemented by types that can provide a printable value.
type RLocker ¶ added in v0.63.0
type RLocker interface { RLock() RUnlock() }
RLocker represents the read locks in sync.RWMutex.
type Result ¶ added in v0.132.0
Result is a generic result type.
func (Result[T]) PrintableValue ¶ added in v0.132.0
PrintableValue returns the value or panics if there is an error.