lavax

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StrSize is size of a string variable
	StrSize = int(unsafe.Sizeof(""))
	// SliceSize is size of a slice variable
	SliceSize = int(unsafe.Sizeof([]byte{}))
)

Variables

This section is empty.

Functions

func BtoS

func BtoS(b []byte) (s string)

BtoS converts byte slice to string

func BtoU4

func BtoU4(b []byte) (i []uint32)

BtoU4 converts byte slice to integer slice

func BtoU8

func BtoU8(b []byte) (i []uint64)

BtoU8 converts byte slice to integer slice

func ByteSize

func ByteSize(bytes uint64) string

ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The unit that results in the smallest number greater than or equal to 1 is always chosen.

func CmpB

func CmpB(a, b []byte) int

CmpB returns -1 for a < b, 0 for a = b, and 1 for a > b lexicographically

func CmpS

func CmpS(a, b string) (r int)

CmpS returns -1 for a < b, 0 for a = b, and 1 for a > b lexicographically

func CodeFormat

func CodeFormat(data ...string) string

func Copy

func Copy(x []byte) []byte

Copy creates an identical copy of x

func CopyBytes

func CopyBytes(b []byte) []byte

CopyBytes copies a slice to make it immutable

func CopyString

func CopyString(s string) string

CopyString copies a string to make it immutable

func Cost

func Cost(fn func()) (dur time.Duration, err error)

func DirExists

func DirExists(path string) bool

DirExists function to check if directory exists?

func DotJoin

func DotJoin(str ...string) string

func EqualFieldType

func EqualFieldType(out interface{}, kind reflect.Kind, key string) bool

func EqualFold

func EqualFold(b, s string) (equals bool)

EqualFold the equivalent of strings.EqualFold

func EqualFoldBytes

func EqualFoldBytes(b, s []byte) (equals bool)

EqualFoldBytes the equivalent of bytes.EqualFold

func FileExists

func FileExists(path string) bool

FileExists function to check if file exists?

func FirstNotEmpty

func FirstNotEmpty(fx ...func() string) string

func GetDefault

func GetDefault(names ...string) string

func IfEmpty

func IfEmpty(str string, fx func())

func InsideTest

func InsideTest() bool

InsideTest returns true inside a Go test

func StoB

func StoB(s string) (b []byte)

StoB converts string to byte slice

func StoU4

func StoU4(s string) (i []uint32)

StoU4 converts string to integer slice

func StoU8

func StoU8(s string) (i []uint64)

StoU8 converts string to integer slice

func ToLower

func ToLower(b string) string

ToLower is the equivalent of strings.ToLower

func ToLowerBytes

func ToLowerBytes(b []byte) []byte

ToLowerBytes is the equivalent of bytes.ToLower

func ToUpper

func ToUpper(b string) string

ToUpper is the equivalent of strings.ToUpper

func ToUpperBytes

func ToUpperBytes(b []byte) []byte

ToUpperBytes is the equivalent of bytes.ToUpper

func TransformObject2Param

func TransformObject2Param(object interface{}) (params map[string]string)

func Trim

func Trim(s string, cutset byte) string

Trim is the equivalent of strings.Trim

func TrimBytes

func TrimBytes(b []byte, cutset byte) []byte

TrimBytes is the equivalent of bytes.Trim

func TrimLeft

func TrimLeft(s string, cutset byte) string

TrimLeft is the equivalent of strings.TrimLeft

func TrimLeftBytes

func TrimLeftBytes(b []byte, cutset byte) []byte

TrimLeftBytes is the equivalent of bytes.TrimLeft

func TrimRight

func TrimRight(s string, cutset byte) string

TrimRight is the equivalent of strings.TrimRight

func TrimRightBytes

func TrimRightBytes(b []byte, cutset byte) []byte

TrimRightBytes is the equivalent of bytes.TrimRight

func U4toB

func U4toB(i []uint32) (b []byte)

U4toB converts integer slice to byte slice

func U4toS

func U4toS(i []uint32) (s string)

U4toS converts integer slice to string

func U4toU8

func U4toU8(i []uint32) (k []uint64)

U4toU8 converts uint32 slice to uint64 slice

func U8toB

func U8toB(i []uint64) (b []byte)

U8toB converts integer slice to byte slice

func U8toS

func U8toS(i []uint64) (s string)

U8toS converts integer slice to string

func U8toU4

func U8toU4(i []uint64) (k []uint32)

U8toU4 converts uint64 slice to uint32 slice

func UnsafeBytes

func UnsafeBytes(s string) (bs []byte)

#nosec G103 UnsafeBytes returns a byte pointer without allocation

func UnsafeString

func UnsafeString(b []byte) string

#nosec G103 UnsafeString returns a string pointer without allocation

Types

type Slice

type Slice struct {
	Data unsafe.Pointer
	Len  int
	Cap  int
}

Slice internals from reflect

func BtoSlices

func BtoSlices(b []byte) (ss []Slice)

BtoSlices converts byte slice to Slice list

func U4toSlices

func U4toSlices(i []uint32) (ss []Slice)

U4toSlices converts integer slice to Slice list

func U8toSlices

func U8toSlices(i []uint64) (ss []Slice)

U8toSlices converts integer slice to Slice list

type String

type String struct {
	Data unsafe.Pointer
	Len  int
}

String internals from reflect

func B2Strs

func B2Strs(b []byte) (ss []String)

B2Strs converts byte slice to String slice

func U4toStrs

func U4toStrs(i []uint32) (ss []String)

U4toStrs converts integer slice to String slice

func U8toStrs

func U8toStrs(i []uint64) (ss []String)

U8toStrs converts integer slice to String slice

Jump to

Keyboard shortcuts

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