types

package
v0.0.0-...-dfd9850 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByLog

type ByLog []*Log

ByLog implement sort interface for log

func (ByLog) Len

func (a ByLog) Len() int

func (ByLog) Less

func (a ByLog) Less(i, j int) bool

func (ByLog) Swap

func (a ByLog) Swap(i, j int)

type BySQL

type BySQL []string

BySQL implement sort interface for string

func (BySQL) Len

func (a BySQL) Len() int

func (BySQL) Less

func (a BySQL) Less(i, j int) bool

func (BySQL) Swap

func (a BySQL) Swap(i, j int)

type Duration

type Duration struct {
	time.Duration
}

Duration wrapper

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText implement time.ParseDuration function for Duration

type Generator

type Generator interface {
	// ReloadSchema function read raw scheme
	// For each record
	// record[0] dbname
	// record[1] table name
	// record[2] table type
	// record[3] column name
	// record[4] column type
	ReloadSchema([][5]string) error
	// SetDB set operation database
	// the generated SQLs after this will be under this database
	SetDB(db string)
	// SetStable is a trigger for whether generate random or some database-basicinfo-dependent data
	// eg. SetStable(true) will disable both rand() and user() functions since they both make unstable result in different database
	SetStable(stable bool)
	// SetHint can control if hints would be generated or not
	SetHint(hint bool)
	// SelectStmt generate select SQL
	SelectStmt() string
	// InsertStmt generate insert SQL
	InsertStmt() string
	// UpdateStmt generate update SQL
	UpdateStmt() string
	// CreateTableStmt generate create table SQL
	CreateTableStmt() string
}

Generator interface to unify the usage of sqlsmith and sqlspider

type Log

type Log struct {
	Time  time.Time
	Node  int
	SQL   *SQL
	State string
}

Log line struct

func (*Log) GetNode

func (l *Log) GetNode() int

GetNode get executor id

func (*Log) GetSQL

func (l *Log) GetSQL() *SQL

GetSQL get SQL struct

func (*Log) GetTime

func (l *Log) GetTime() time.Time

GetTime get log time

type Order

type Order struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Order for log executor orders

func NewOrder

func NewOrder() *Order

NewOrder create Order

func (*Order) GetHistroy

func (o *Order) GetHistroy() []int

GetHistroy get copied history slice

func (*Order) Has

func (o *Order) Has(i int) bool

Has given value in order list

func (*Order) Next

func (o *Order) Next() bool

Next is for walking through

func (*Order) Push

func (o *Order) Push(id int)

Push push a history, will move the id to end of

func (*Order) Reset

func (o *Order) Reset()

Reset history

func (*Order) Start

func (o *Order) Start()

Start reset index

func (*Order) Val

func (o *Order) Val() int

Val return value for current index

type SQL

type SQL struct {
	SQLType  SQLType
	SQLStmt  string
	SQLTable string
	// ExecTime is for avoid lock watched interference before time out
	// useful for sleep statement
	ExecTime int
}

SQL struct

type SQLType

type SQLType int

SQLType enums for SQL types

const (
	SQLTypeUnknown SQLType = iota
	SQLTypeReloadSchema
	SQLTypeDMLSelect
	SQLTypeDMLSelectForUpdate
	SQLTypeDMLUpdate
	SQLTypeDMLInsert
	SQLTypeDMLDelete
	SQLTypeDDLCreateTable
	SQLTypeDDLAlterTable
	SQLTypeDDLCreateIndex
	SQLTypeTxnBegin
	SQLTypeTxnCommit
	SQLTypeTxnRollback
	SQLTypeExec
	SQLTypeExit
	SQLTypeSleep
	SQLTypeCreateDatabase
	SQLTypeDropDatabase
)

SQLTypeDMLSelect

func (SQLType) String

func (t SQLType) String() string

Jump to

Keyboard shortcuts

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