helper

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AlphabetNumeric = &RandomString{
		layout: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
		r:      rand.New(rand.NewSource(time.Now().UnixNano())),
		mu:     sync.Mutex{},
	}

	Numeric = &RandomString{
		layout: "0123456789",
		r:      rand.New(rand.NewSource(time.Now().UnixNano())),
		mu:     sync.Mutex{},
	}

	A2F = &RandomString{
		layout: "ABCDEF",
		r:      rand.New(rand.NewSource(time.Now().UnixNano())),
		mu:     sync.Mutex{},
	}
)

Functions

func Clone added in v0.3.0

func Clone[T any, A ~[]T](a A) A

func Filter added in v0.3.0

func Filter[T any, A ~[]T](arr A, check func(i int, v T) bool) A

Filter 过滤器

func Split added in v0.3.0

func Split(s string, sep string) []string

Split 分割字符串(空值将会被过滤掉)

func Uniq

func Uniq[T comparable](arr []T) []T

Types

type RandomString

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

func (*RandomString) Generate

func (c *RandomString) Generate(n int) []byte

func (*RandomString) Intn

func (c *RandomString) Intn(n int) int

func (*RandomString) Uint32

func (c *RandomString) Uint32() uint32

func (*RandomString) Uint64

func (c *RandomString) Uint64() uint64

Jump to

Keyboard shortcuts

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