Documentation
¶
Index ¶
- Constants
- func FormatCount(count int64) string
- func IsInsert(query string) bool
- func MakeColumnValues(nColumns int, blockSize int) [][]interface{}
- func NewMatcher(needle string) *wordMatcher
- func NumArgs(query string) int
- func ParamParser(reader *bytes.Reader) string
- func SkipIntegrationTestIfShort(t *testing.T)
- func TransposeMatrix(table [][]interface{}) [][]interface{}
- type InsertQuery
Constants ¶
const AllowMapSQLScript = "set allow_experimental_map_type = 1"
Variables ¶
This section is empty.
Functions ¶
func FormatCount ¶
func MakeColumnValues ¶
func NewMatcher ¶
func NewMatcher(needle string) *wordMatcher
NewMatcher returns matcher for word needle
func ParamParser ¶
func TransposeMatrix ¶
func TransposeMatrix(table [][]interface{}) [][]interface{}
todo: this might be slow, think of another way to "tranpose" TransposeMatrix row values to column values
Types ¶
type InsertQuery ¶
InsertQuery is a insert Query disected e.g. INSERT INTO table VALUES (1); becomes
{
DataFmt: "VALUES",
Query: "INSERT INTO table VALUES",
Values: "(1)"
}
func ParseInsertQuery ¶
func ParseInsertQuery(query string) (*InsertQuery, error)
In this method, we Parse the Insert query into dataFmt (which can be CSV, VALUES, JSON or CSVWITHNAMES), Query (excluding the values but including the format) and the values. This is done by first matching the first part of the insert query with our InsertInto regex: INSERT INTO [db.]table [(c1, c2, c3)]
Then we get the format from the remaining string using the insertFormat regex. This is necessary to ensure that a table, database or column name containing the format key words isn't treated as the format.