utils

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToQueryIfSet

func AddToQueryIfSet(q url.Values, key string, value string)

func FirstNElementsOfSlice

func FirstNElementsOfSlice[Element any](slice []Element, n int) []Element

func MapToCommaString

func MapToCommaString[t any](slice []t) string

func UnmarshalJSONEnum

func UnmarshalJSONEnum[T ~string](src []byte, allowedValues *Set[T]) (*T, error)

Types

type Set

type Set[t comparable] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[T comparable](items ...T) *Set[T]

func (*Set[t]) Add

func (s *Set[t]) Add(item t)

func (*Set[t]) Has

func (s *Set[t]) Has(item t) bool

func (*Set[t]) Len

func (s *Set[t]) Len() int

func (*Set[t]) Remove

func (s *Set[t]) Remove(item t)

func (*Set[t]) ToSlice

func (s *Set[t]) ToSlice() []t

Jump to

Keyboard shortcuts

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