utils

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStreamTooBig = errors.New("stream is too big")

Functions

func Concat

func Concat(sep string, values ...string) string

func ContentType

func ContentType(contentType string) string

func ConvertTo added in v0.0.4

func ConvertTo[T any](input any) (T, error)

func NewLimitedReader

func NewLimitedReader(source io.Reader, limit int) io.Reader

NewLimitedReader limits maximum number of bytes to read. If at least one byte read on top of if - ErrStreamTooBig returned.

func ReadCloser

func ReadCloser(reader io.Reader, closer io.Closer) io.ReadCloser

Types

type Pair

type Pair[T any] struct {
	Name     string `json:"name" yaml:"name"`
	Value[T] `yaml:",inline"`
}

type Set

type Set[T comparable] map[T]struct{}

func NewSet

func NewSet[T comparable](values ...T) Set[T]

func (Set[T]) Add

func (s Set[T]) Add(values ...T)

func (Set[T]) Contains

func (s Set[T]) Contains(values ...T) bool

func (Set[T]) Put

func (s Set[T]) Put(value T) bool

func (Set[T]) Remove

func (s Set[T]) Remove(values ...T)

type Value

type Value[T any] struct {
	Value   *T     `json:"value" yaml:"value"`
	FromEnv string `json:"from_env" yaml:"fromEnv"`
}

func (*Value[T]) Get

func (v *Value[T]) Get() (T, error)

Jump to

Keyboard shortcuts

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