utils

package
v0.0.0-...-50a15a0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FloatFormat = 'f'
)

Variables

View Source
var (
	TimeFormat = "2006-01-02T15:04:05-07:00"
)

Functions

func Base64ToByte

func Base64ToByte(b string) ([]byte, error)

func BytesToBase64

func BytesToBase64(b []byte) string

func BytesToString

func BytesToString(b []byte) string

func CopyString

func CopyString(s string) string

func GRPCStatus2HTTPStatus

func GRPCStatus2HTTPStatus(code codes.Code) int

func Getenv

func Getenv(key, default_ string) string

func ParseUint64

func ParseUint64(val string) (uint64, error)

func SplitString

func SplitString(str string) []string

func Str2Uint32

func Str2Uint32(val string, default_ uint32) uint32

func Str2Uint64

func Str2Uint64(val string, default_ uint64) uint64

func StringToBytes

func StringToBytes(s string) []byte

func ToSnakeCase

func ToSnakeCase(input string) string

ToSnakeCase converts the provided string to snake_case. Based on https://gist.github.com/stoewer/fbe273b711e6a06315d19552dd4d33e6

func Wrap

func Wrap(message string, err error) error

Wrap is a simple wrapper around fmt.Errorf that wraps errors.

func Wrapf

func Wrapf(err error, message string, a ...interface{}) error

Wrapf is a simple wrapper around fmt.Errorf that wraps errors. Wrapf allows you to send a format and args instead of just a message.

Types

type Map

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

func NewMap

func NewMap(values ...string) Map

func (*Map) Add

func (m *Map) Add(value string)

func (*Map) Adds

func (m *Map) Adds(values ...string)

func (*Map) Exists

func (m *Map) Exists(value string) bool

Jump to

Keyboard shortcuts

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