w

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 27

Documentation

Index

Constants

View Source
const (
	PosRight = iota
	PosLeft
	PosCenter
)

Variables

This section is empty.

Functions

func AddFuncMaps added in v1.1.4

func AddFuncMaps(funcName string, f interface{})

func E

func E[T any](_ T, err error) error

func Filter

func Filter[T any](old []T, f func(item T) bool) []T

func Find

func Find[T any](s []T, t T, compare func(a, b T) bool) int

func Has

func Has[T any](s []T, t T, compare func(a, b T) bool) bool

func Include

func Include[T comparable](s []T, t T) bool

func Index

func Index[T comparable](s []T, t T) int

func Interfaces

func Interfaces[T any](objs []T) []interface{}

func JSONStringer

func JSONStringer(v any) fmt.Stringer

func Limit

func Limit[T any](s []T, limit int, hidePosition int, manySuffix ...T) []T

func M

func M[T any](v T, err error) T

func Map

func Map[S any, T any](old []S, f func(item S) T) []T

func NewStringer

func NewStringer(stringer func() string) fmt.Stringer

func P

func P[T any](o T) *T

func StringEqual added in v1.1.2

func StringEqual(a, b string) bool

Types

type Comparable added in v1.1.5

type Comparable interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
		~float32 | ~float64 | ~string
}

type OneOrMore added in v1.1.2

type OneOrMore[T comparable] []T

OneOrMore represents a value that can either be a string or an array of strings. Mainly here for serialization purposes

func (OneOrMore[T]) Contains added in v1.1.2

func (s OneOrMore[T]) Contains(value T) bool

Contains returns true when the value is contained in the slice

func (OneOrMore[T]) MarshalJSON added in v1.1.2

func (s OneOrMore[T]) MarshalJSON() ([]byte, error)

MarshalJSON converts this string or array to a JSON array or JSON string

func (OneOrMore[T]) MarshalYAML added in v1.1.2

func (s OneOrMore[T]) MarshalYAML() (interface{}, error)

func (*OneOrMore[T]) UnmarshalJSON added in v1.1.2

func (s *OneOrMore[T]) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals this string or array object from a JSON array or signal JSON value

func (*OneOrMore[T]) UnmarshalYAML added in v1.1.2

func (s *OneOrMore[T]) UnmarshalYAML(value *yaml.Node) error

type SortedMap added in v1.1.5

type SortedMap[K Comparable, V any] []SortedMapItem[K, V]

func NewSortedMap added in v1.1.5

func NewSortedMap[K Comparable, V any](kvs ...map[K]V) SortedMap[K, V]

func (SortedMap[K, V]) Len added in v1.1.5

func (s SortedMap[K, V]) Len() int

func (SortedMap[K, V]) Less added in v1.1.5

func (s SortedMap[K, V]) Less(i, j int) bool

func (SortedMap[K, V]) Swap added in v1.1.5

func (s SortedMap[K, V]) Swap(i, j int)

type SortedMapItem added in v1.1.5

type SortedMapItem[K Comparable, V any] struct {
	Key   K
	Value V
}

type Stringer

type Stringer struct {
	// contains filtered or unexported fields
}

func (Stringer) String

func (s Stringer) String() string

type Template added in v1.1.3

type Template struct {
	// contains filtered or unexported fields
}

func (*Template) DefinedTemplates added in v1.1.3

func (t *Template) DefinedTemplates() string

func (*Template) Execute added in v1.1.3

func (t *Template) Execute(wr io.Writer, data any) error

func (*Template) ExecuteTemplate added in v1.1.3

func (t *Template) ExecuteTemplate(wr io.Writer, name string, data any) error

func (Template) MarshalJSON added in v1.1.3

func (t Template) MarshalJSON() ([]byte, error)

func (Template) MarshalYAML added in v1.1.3

func (t Template) MarshalYAML() (interface{}, error)

func (*Template) Name added in v1.1.3

func (t *Template) Name() string

func (*Template) UnmarshalJSON added in v1.1.3

func (t *Template) UnmarshalJSON(data []byte) (err error)

func (*Template) UnmarshalYAML added in v1.1.3

func (t *Template) UnmarshalYAML(value *yaml.Node) (err error)

type TemplateHandler added in v1.1.3

type TemplateHandler interface {
	Name() string
	ExecuteTemplate(wr io.Writer, name string, data any) error
	Execute(wr io.Writer, data any) error
	DefinedTemplates() string
}

Jump to

Keyboard shortcuts

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