util

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

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

output style

Variables

View Source
var StdErrLogger *log.Logger

This logger is goroutine-safe.

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

type SemVersion added in v1.0.11

type SemVersion struct {
	Major int
	Minor int
	Patch int
}

func NewTiDBSemVersion added in v1.0.11

func NewTiDBSemVersion(version string) (SemVersion, bool)

@version is the `SELECT VERSION()` output of TiDB

func (SemVersion) Compare added in v1.0.11

func (s SemVersion) Compare(other SemVersion) int

func (SemVersion) String added in v1.0.11

func (s SemVersion) String() string

Jump to

Keyboard shortcuts

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