utils

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchSlice

func BatchSlice[K any](size int, result []K) <-chan []K

func Between

func Between(data string, keys ...string) string

Between function to get content between two keys

func ByteSliceToString

func ByteSliceToString(b []byte) string

ByteSliceToString cast given bytes to string, without allocation memory

func CRC32

func CRC32(field string) uint32

func GenerateEntityHash

func GenerateEntityHash(entity []byte) (string, error)

func GetShortID

func GetShortID() ([]byte, error)

GetShortID return short id

func GetTinyID

func GetTinyID() ([]byte, error)

GetTinyID return tiny id

func GetUniqueID

func GetUniqueID() string

GetUniqueID return unique id

func MaskField

func MaskField(str string, keepUnmaskedFront int, keepUnmaskedEnd int) string

func SafeGet

func SafeGet[T any](ptr *T, defaultValue T) T

SafeGet return value of pointer, and return default value if it nil

func SplitByChunks

func SplitByChunks(s string, chunkSize int) []string

Types

type ContextKey

type ContextKey string

ContextKey contains context key

type Password

type Password string

Password describe masked field

func (Password) MarshalJSON

func (p Password) MarshalJSON() ([]byte, error)

MarshalJSON block to show value in json

func (Password) String

func (p Password) String() string

String return hide password value

func (Password) Value

func (p Password) Value() string

Value return exactly password value

type Str

type Str struct {
	Pass Password
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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