util

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputStylePlain = "plain"
	OutputStyleTable = "table"
	OutputStyleJson  = "json"
)

output style

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(path string) *os.File

func FloatToOneString added in v1.0.9

func FloatToOneString(f float64) string

func FloatToTwoString added in v1.0.9

func FloatToTwoString(f float64) string

func IntToString added in v1.0.9

func IntToString(i int64) string

func RenderExplainAnalyze added in v1.0.4

func RenderExplainAnalyze(rows *sql.Rows) (text string, err error)

func RenderJson added in v1.0.9

func RenderJson(headers []string, values [][]string)

func RenderString added in v1.0.9

func RenderString(format string, headers []string, values [][]string)

func RenderTable added in v1.0.9

func RenderTable(headers []string, values [][]string)

func Slice

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

Slice converts string to slice without copy. Use at your own risk.

func String

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

String converts slice to string without copy. Use at your own risk.

Types

type BufAllocator

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

BufAllocator helps you manage multi chunks in one []byte.

func NewBufAllocator

func NewBufAllocator() *BufAllocator

NewBufAllocator creates a NewBufAllocator

func (*BufAllocator) Alloc

func (b *BufAllocator) Alloc(n int) []byte

Alloc allocates a new chunk with the specified size n.

func (*BufAllocator) Reset

func (b *BufAllocator) Reset()

Reset resets the buffer to later reuse

Jump to

Keyboard shortcuts

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