util

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calculate added in v0.4.0

func Calculate(args ...interface{}) interface{}

func CutPrefixUnderscore

func CutPrefixUnderscore(s string) (prefix string, rest string)

func CutSuffixUnderscore

func CutSuffixUnderscore(s string) (rest string, suffix string)

func ExecuteTemplate

func ExecuteTemplate(templ, templateName string, fns template.FuncMap, data interface{}) string

func HighBit

func HighBit[T IntNumber](v T) T

func IndentSpace

func IndentSpace(v any, n int) string

func IndentSpace4

func IndentSpace4(v any) string

func IndentSpace4NoFirst

func IndentSpace4NoFirst(v any) string

func IndentSpace8

func IndentSpace8(v any) string

func IndentSpace8NoFirst

func IndentSpace8NoFirst(v any) string

func IndentSpaceNoFirst

func IndentSpaceNoFirst(v any, n int) string

func IndentTab

func IndentTab(v any, n int) string

func IndentTab1

func IndentTab1(v any) string

func IsAllLower

func IsAllLower(s string) bool

func IsAllUpper

func IsAllUpper(s string) bool

func IsBool added in v0.4.0

func IsBool(v interface{}) bool

func IsCapitalized

func IsCapitalized(s string) bool

func IsDigit

func IsDigit(s rune) bool

func IsFloat added in v0.4.0

func IsFloat(v interface{}) bool

func IsInt added in v0.4.0

func IsInt(v interface{}) bool

func IsIntOrUint added in v0.4.0

func IsIntOrUint(v interface{}) bool

func IsLetter

func IsLetter(s rune) bool

func IsLower

func IsLower(s rune) bool

func IsNumber added in v0.4.0

func IsNumber(v interface{}) bool

func IsUint added in v0.4.0

func IsUint(v interface{}) bool

func IsUncapitalized

func IsUncapitalized(s string) bool

func IsUpper

func IsUpper(s rune) bool

func LowBit

func LowBit[T IntNumber](v T) T

func ToALLCAP_CASE

func ToALLCAP_CASE(s string) string

func ToBool

func ToBool(v interface{}) bool

func ToFloat32

func ToFloat32(v interface{}) float32

func ToFloat64

func ToFloat64(v interface{}) float64

func ToInt

func ToInt(v interface{}) int

func ToInt16

func ToInt16(v interface{}) int16

func ToInt32

func ToInt32(v interface{}) int32

func ToInt64

func ToInt64(v interface{}) int64

func ToInt8

func ToInt8(v interface{}) int8

func ToLower

func ToLower(s rune) rune

func ToPascalCase

func ToPascalCase(s string) string

func ToSizeString

func ToSizeString(bitSize int64) string

func ToUint

func ToUint(v interface{}) uint

func ToUint16

func ToUint16(v interface{}) uint16

func ToUint32

func ToUint32(v interface{}) uint32

func ToUint64

func ToUint64(v interface{}) uint64

func ToUint8

func ToUint8(v interface{}) uint8

func ToUpper

func ToUpper(s rune) rune

func TocamelCase

func TocamelCase(s string) string

func Tosnake_case

func Tosnake_case(s string) string

Types

type Bool

type Bool interface {
	~bool
}

type Entry

type Entry[K comparable, V any] struct {
	Key   K
	Value V
}

type Float

type Float interface {
	~float32 | ~float64
}

type Int

type Int interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type IntNumber

type IntNumber interface {
	Int | Uint
}

type Number

type Number interface {
	IntNumber | Float
}

type OrderedMap

type OrderedMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewOrderedMap

func NewOrderedMap[K comparable, V any]() *OrderedMap[K, V]

func (*OrderedMap[K, V]) Clear

func (m *OrderedMap[K, V]) Clear()

func (*OrderedMap[K, V]) Entries

func (m *OrderedMap[K, V]) Entries() []Entry[K, V]

func (*OrderedMap[K, V]) First

func (m *OrderedMap[K, V]) First() Entry[K, V]

func (*OrderedMap[K, V]) Get

func (m *OrderedMap[K, V]) Get(key K) (V, bool)

func (*OrderedMap[K, V]) Has

func (m *OrderedMap[K, V]) Has(key K) bool

func (*OrderedMap[K, V]) Index

func (m *OrderedMap[K, V]) Index(i int) Entry[K, V]

func (*OrderedMap[K, V]) Keys

func (m *OrderedMap[K, V]) Keys() []K

func (*OrderedMap[K, V]) Last

func (m *OrderedMap[K, V]) Last() Entry[K, V]

func (*OrderedMap[K, V]) Len

func (m *OrderedMap[K, V]) Len() int

func (*OrderedMap[K, V]) MustGet

func (m *OrderedMap[K, V]) MustGet(key K) V

func (*OrderedMap[K, V]) MustPut

func (m *OrderedMap[K, V]) MustPut(key K, value V)

func (*OrderedMap[K, V]) Put

func (m *OrderedMap[K, V]) Put(key K, value V) bool

func (*OrderedMap[K, V]) PutAnonymous

func (m *OrderedMap[K, V]) PutAnonymous(value V)

PutAnonymous adds an anonymous entry with default key.

WARNING: added entry which will never be indexed, you can only access it by iteration.

func (*OrderedMap[K, V]) Rank

func (m *OrderedMap[K, V]) Rank(key K) int

func (*OrderedMap[K, V]) Remove

func (m *OrderedMap[K, V]) Remove(key K)

func (*OrderedMap[K, V]) Sub added in v0.4.0

func (m *OrderedMap[K, V]) Sub(start, end int) *OrderedMap[K, V]

func (*OrderedMap[K, V]) Values

func (m *OrderedMap[K, V]) Values() []V

type Uint

type Uint interface {
	~uint | ~uint8 | ~uint16 | ~uint32
}

Jump to

Keyboard shortcuts

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