util

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToInt64

func BytesToInt64(b []byte) int64

func BytesToString

func BytesToString(b []byte) string

func Domain

func Domain(link string) (string, error)

func Int64ToBytes

func Int64ToBytes(i int64) []byte

func MaxLen

func MaxLen(str string, max int) string

func Must

func Must[T any](value T, err error) T

func SafeDomain

func SafeDomain(link string) string

func SplitMax

func SplitMax(text, sep string, max int) []string

func StringToBytes

func StringToBytes(s string) []byte

func StripHTMLTags

func StripHTMLTags(s string) string

func StripNewLine

func StripNewLine(s string, maxNewLine int) string

func ToPtr

func ToPtr[T any](val T) *T

Types

type Dict

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

func NewDict

func NewDict[T any]() *Dict[T]

func (*Dict[T]) Del

func (d *Dict[T]) Del(key string) (value T)

func (*Dict[T]) Get

func (d *Dict[T]) Get(key string) (value T)

func (*Dict[T]) Has

func (d *Dict[T]) Has(key string) bool

func (*Dict[T]) Len

func (d *Dict[T]) Len() int

func (*Dict[T]) Loop

func (d *Dict[T]) Loop(fn func(string, T) bool)

func (*Dict[T]) Set

func (d *Dict[T]) Set(key string, item T)

type List

type List[T any] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewList

func NewList[T any](size int) *List[T]

func (*List[T]) Add

func (l *List[T]) Add(item T)

func (*List[T]) Del

func (l *List[T]) Del(i int, j int)

func (*List[T]) Get

func (l *List[T]) Get(i int) T

func (*List[T]) Insert

func (l *List[T]) Insert(i int, item T)

func (*List[T]) IsEmpty

func (l *List[T]) IsEmpty() bool

func (*List[T]) Len

func (l *List[T]) Len() int

func (*List[T]) Loop

func (l *List[T]) Loop(fn func(i int, item T) bool)

func (*List[T]) Shift

func (l *List[T]) Shift() T

func (*List[T]) Unshift

func (l *List[T]) Unshift(item T)

Jump to

Keyboard shortcuts

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