utils

package
v0.0.0-...-c8733ce Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BoolParseError = errors.New("bad value for bool field") // placeholder not passed to user
View Source
var EOFReader io.Reader = &eofReader{}

Functions

func AsciiCompareFold

func AsciiCompareFold(a, b []byte) int

AsciiCompareFold compares two slices. if lengths do not match, the difference will be discarded.

func BoolFromParameters

func BoolFromParameters(params url.Values, key string, defaultValue bool) bool

func DurationFromParameters

func DurationFromParameters(params url.Values, key string, defaultValue time.Duration) time.Duration

func GetParameter

func GetParameter(parameters url.Values, key string) (string, bool)

func IntegerFromParameters

func IntegerFromParameters(params url.Values, key string, defaultValue int) int

func MergeParams

func MergeParams(a, b map[string][]string) map[string][]string

func MultiStringFromParameters

func MultiStringFromParameters(params url.Values, key string, defaultValue []string) []string

func NewMultiReader

func NewMultiReader(isOpen func() bool, nextReader func() (io.Reader, error)) io.Reader

NewMultiReader returns a Reader that's the logical concatenation of the provided input readers. They're read sequentially. Once all inputs have returned EOF, Read will return EOF. If any of the readers return a non-nil, non-EOF error, Read will return that error.

func ParseBool

func ParseBool(value string) (bool, error)

func ParseTransportParamsFromFlags

func ParseTransportParamsFromFlags(arr []string) (url.Values, error)

func QueryParametersWithoutPrefix

func QueryParametersWithoutPrefix(input url.Values, prefix string) url.Values

func ReadFile

func ReadFile(path string) ([]byte, error)

ReadFile supports reading files at given directions, along base64 and base32 values.

func StrIsFalse

func StrIsFalse(value string) bool

func StrIsTrue

func StrIsTrue(value string) bool

func StringFromParameters

func StringFromParameters(params url.Values, key string, defaultValue string) string

Types

type BufferedConn

type BufferedConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func NewBufferedConn

func NewBufferedConn(conn net.Conn, buf *bytes.Buffer) *BufferedConn

func (*BufferedConn) Buffer

func (c *BufferedConn) Buffer(b []byte) (n int, err error)

Buffer bytes for next call to Read. Used to implement rewinding for connections.

func (*BufferedConn) Read

func (c *BufferedConn) Read(b []byte) (n int, err error)

type Decoder

type Decoder interface {
	Decode(dst, src []byte) (n int, err error)
	DecodedLen(int) int
}

type DynamicMultiReader

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

func (*DynamicMultiReader) Read

func (mr *DynamicMultiReader) Read(p []byte) (n int, err error)

func (*DynamicMultiReader) WriteTo

func (mr *DynamicMultiReader) WriteTo(w io.Writer) (sum int64, err error)

type UndoFunc

type UndoFunc func()

func SetMaxProcs

func SetMaxProcs(logger logging.Logger) UndoFunc

Jump to

Keyboard shortcuts

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