utils

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KiB = 1024       // 1 KiB
	MiB = 1024 * KiB // 1 MiB
	GiB = 1024 * MiB // 1 GiB
)

Constants for common byte sizes

Variables

This section is empty.

Functions

func Zero

func Zero[T any]() T

Zero returns the zero value of type T

Types

type Atomic

type Atomic[T any] struct {
	// contains filtered or unexported fields
}

func NewAtomic

func NewAtomic[T any](value T) *Atomic[T]

func (*Atomic[T]) Get

func (a *Atomic[T]) Get() T

func (*Atomic[T]) MarshalJSON

func (a *Atomic[T]) MarshalJSON() ([]byte, error)

func (*Atomic[T]) Set

func (a *Atomic[T]) Set(value T)

func (*Atomic[T]) Swap

func (a *Atomic[T]) Swap(value T) T

func (*Atomic[T]) UnmarshalJSON

func (a *Atomic[T]) UnmarshalJSON(b []byte) error

type Sortable

type Sortable[T any] interface {
	Compare(T) int
}

Sortable is the interface required by slices.SortFunc

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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