util

package
v1.1.0-beta.0...-4ec2b23 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultReaderSize = 16 * 1024

DefaultReaderSize is the default size of bufio.Reader.

Variables

This section is empty.

Functions

func AppendFormatFloat

func AppendFormatFloat(in []byte, fVal float64, prec, bitSize int) []byte

AppendFormatFloat appends a float64 to dst in MySQL format.

func LengthEncodedIntSize

func LengthEncodedIntSize(n uint64) int

LengthEncodedIntSize returns the size of length encoded integer.

func NewCorsHandler

func NewCorsHandler(handler http.Handler, cfg *config.Config) http.Handler

NewCorsHandler creates a new CorsHandler.

func NewTestConfig

func NewTestConfig() *config.Config

NewTestConfig creates a new config for test.

func ParseLengthEncodedBytes

func ParseLengthEncodedBytes(b []byte) ([]byte, bool, int, error)

ParseLengthEncodedBytes parses a length encoded byte slice.

func ParseLengthEncodedInt

func ParseLengthEncodedInt(b []byte) (num uint64, isNull bool, n int)

ParseLengthEncodedInt parses a length encoded integer.

func ParseNullTermString

func ParseNullTermString(b []byte) (str []byte, remain []byte)

ParseNullTermString parses a null terminated string.

Types

type BufferedReadConn

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

BufferedReadConn is a net.Conn compatible structure that reads from bufio.Reader.

func NewBufferedReadConn

func NewBufferedReadConn(conn net.Conn) *BufferedReadConn

NewBufferedReadConn creates a BufferedReadConn.

func (BufferedReadConn) Read

func (conn BufferedReadConn) Read(b []byte) (n int, err error)

Read reads data from the connection.

type CorsHandler

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

CorsHandler adds Cors Header if `cors` config is set.

func (CorsHandler) ServeHTTP

func (h CorsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler interface.

type InputDecoder

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

InputDecoder is used to decode input.

func NewInputDecoder

func NewInputDecoder(chs string) *InputDecoder

NewInputDecoder creates a new InputDecoder.

func (*InputDecoder) DecodeInput

func (i *InputDecoder) DecodeInput(src []byte) []byte

DecodeInput decodes input.

Jump to

Keyboard shortcuts

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