data

package
v0.0.0-...-54a784d Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForeachSQLQuery

func ForeachSQLQuery(loader IteratorLoader, f func(Query) error) error

ForeachSQLQuery reads a query log file and calls the provided function for each normal SQL query in the log. If the query log contains directives, they will be read and queries will be skipped as necessary.

Types

type CmdType

type CmdType int
const (
	QueryT CmdType = iota
	Error
	Skip
	Unknown
	Comment
	CommentWithCommand
	EmptyLine
	SkipIfBelowVersion
	VExplain
	WaitForAuthoritative
	VitessOnly
	MysqlOnly
	Reference
	UsageCount
)

func FindType

func FindType(cmdName string) CmdType

func (CmdType) String

func (cmd CmdType) String() string

type IteratorLoader

type IteratorLoader interface {
	// Next returns the next query in the log file. The boolean return value is false if there are no more queries.
	Next() (Query, bool)

	// Close closes the iterator. If any errors have been accumulated, they are returned here.
	Close() error
}

type Loader

type Loader interface {
	Load(filename string) IteratorLoader
}

type MySQLLogLoader

type MySQLLogLoader struct{}

func (MySQLLogLoader) Load

func (MySQLLogLoader) Load(fileName string) IteratorLoader

type Query

type Query struct {
	FirstWord  string
	Query      string
	Line       int
	Type       CmdType
	UsageCount int

	// These fields are only set if the log file is a slow query log
	QueryTime, LockTime    float64
	RowsSent, RowsExamined int
	Timestamp              int64
}

type SlowQueryLogLoader

type SlowQueryLogLoader struct{}

func (SlowQueryLogLoader) Load

func (SlowQueryLogLoader) Load(filename string) IteratorLoader

type VtGateLogLoader

type VtGateLogLoader struct {
	NeedsBindVars bool
}

func (VtGateLogLoader) Load

func (vll VtGateLogLoader) Load(fileName string) IteratorLoader

Jump to

Keyboard shortcuts

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