sql

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BitTypeMinBits returns the minimum number of bits for Bit.
	BitTypeMinBits = 1
	// BitTypeMaxBits returns the maximum number of bits for Bit.
	BitTypeMaxBits = 64
)
View Source
const (
	Y        = "Yes"
	N        = "No"
	NoPad    = "NO PAD"
	PadSpace = "PAD SPACE"
)
View Source
const (
	// DateLayout is the layout of the MySQL date format in the representation
	// Go understands.
	DateLayout = "2006-01-02"

	// TimestampDatetimeLayout is the formatting string with the layout of the timestamp
	// using the format of Go "time" package.
	TimestampDatetimeLayout = "2006-01-02 15:04:05.999999"
)
View Source
const (
	// DecimalTypeMaxPrecision returns the maximum precision allowed for the Decimal type.
	DecimalTypeMaxPrecision = 65
	// DecimalTypeMaxScale returns the maximum scale allowed for the Decimal type, assuming the
	// maximum precision is used. For a maximum scale that is relative to the precision of a given
	// decimal type, use its MaximumScale function.
	DecimalTypeMaxScale = 30
)
View Source
const (
	// EnumTypeMinElements returns the minimum number of enumerations for the Enum type.
	EnumTypeMinElements = 1
	// EnumTypeMaxElements returns the maximum number of enumerations for the Enum type.
	EnumTypeMaxElements = 65535
)
View Source
const (
	// Numeric representation of False as defined by MySQL.
	False = int8(0)
	// Numeric representation of True as defined by MySQL.
	True = int8(1)
)
View Source
const (
	CurrentDBSessionVar  = "current_database"
	AutoCommitSessionVar = "autocommit"
)
View Source
const (
	RowCount     = "row_count"
	FoundRows    = "found_rows"
	LastInsertId = "last_insert_id"
)
View Source
const ChecksumKey = "checksum"

ChecksumKey is the key in an index config to store the checksum.

View Source
const IndexBatchSize = uint64(10000)

IndexBatchSize is the number of rows to save at a time when creating indexes.

View Source
const OkResultColumnName = "__ok_result__"

OkResultColumnName should be used as the schema column name for Nodes that return an OkResult

View Source
const (
	// QueryKey to access query in the context.
	QueryKey key = iota
)
View Source
const (
	// SetTypeMaxElements returns the maximum number of elements for the Set type.
	SetTypeMaxElements = 64
)

Variables

View Source
var (
	// case sensitive colations
	Collation_binary = newCSCollation("binary", CharacterSet_binary)

	// case insensitive collations
	Collation_armscii8_general_ci         = newCollation("armscii8_general_ci", CharacterSet_armscii8)
	Collation_armscii8_bin                = newCollation("armscii8_bin", CharacterSet_armscii8)
	Collation_ascii_general_ci            = newCollation("ascii_general_ci", CharacterSet_ascii)
	Collation_ascii_bin                   = newCollation("ascii_bin", CharacterSet_ascii)
	Collation_big5_chinese_ci             = newCollation("big5_chinese_ci", CharacterSet_big5)
	Collation_big5_bin                    = newCollation("big5_bin", CharacterSet_big5)
	Collation_cp1250_general_ci           = newCollation("cp1250_general_ci", CharacterSet_cp1250)
	Collation_cp1250_czech_cs             = newCollation("cp1250_czech_cs", CharacterSet_cp1250)
	Collation_cp1250_croatian_ci          = newCollation("cp1250_croatian_ci", CharacterSet_cp1250)
	Collation_cp1250_bin                  = newCollation("cp1250_bin", CharacterSet_cp1250)
	Collation_cp1250_polish_ci            = newCollation("cp1250_polish_ci", CharacterSet_cp1250)
	Collation_cp1251_bulgarian_ci         = newCollation("cp1251_bulgarian_ci", CharacterSet_cp1251)
	Collation_cp1251_ukrainian_ci         = newCollation("cp1251_ukrainian_ci", CharacterSet_cp1251)
	Collation_cp1251_bin                  = newCollation("cp1251_bin", CharacterSet_cp1251)
	Collation_cp1251_general_ci           = newCollation("cp1251_general_ci", CharacterSet_cp1251)
	Collation_cp1251_general_cs           = newCollation("cp1251_general_cs", CharacterSet_cp1251)
	Collation_cp1256_general_ci           = newCollation("cp1256_general_ci", CharacterSet_cp1256)
	Collation_cp1256_bin                  = newCollation("cp1256_bin", CharacterSet_cp1256)
	Collation_cp1257_lithuanian_ci        = newCollation("cp1257_lithuanian_ci", CharacterSet_cp1257)
	Collation_cp1257_bin                  = newCollation("cp1257_bin", CharacterSet_cp1257)
	Collation_cp1257_general_ci           = newCollation("cp1257_general_ci", CharacterSet_cp1257)
	Collation_cp850_general_ci            = newCollation("cp850_general_ci", CharacterSet_cp850)
	Collation_cp850_bin                   = newCollation("cp850_bin", CharacterSet_cp850)
	Collation_cp852_general_ci            = newCollation("cp852_general_ci", CharacterSet_cp852)
	Collation_cp852_bin                   = newCollation("cp852_bin", CharacterSet_cp852)
	Collation_cp866_general_ci            = newCollation("cp866_general_ci", CharacterSet_cp866)
	Collation_cp866_bin                   = newCollation("cp866_bin", CharacterSet_cp866)
	Collation_cp932_japanese_ci           = newCollation("cp932_japanese_ci", CharacterSet_cp932)
	Collation_cp932_bin                   = newCollation("cp932_bin", CharacterSet_cp932)
	Collation_dec8_swedish_ci             = newCollation("dec8_swedish_ci", CharacterSet_dec8)
	Collation_dec8_bin                    = newCollation("dec8_bin", CharacterSet_dec8)
	Collation_eucjpms_japanese_ci         = newCollation("eucjpms_japanese_ci", CharacterSet_eucjpms)
	Collation_eucjpms_bin                 = newCollation("eucjpms_bin", CharacterSet_eucjpms)
	Collation_euckr_korean_ci             = newCollation("euckr_korean_ci", CharacterSet_euckr)
	Collation_euckr_bin                   = newCollation("euckr_bin", CharacterSet_euckr)
	Collation_gb18030_chinese_ci          = newCollation("gb18030_chinese_ci", CharacterSet_gb18030)
	Collation_gb18030_bin                 = newCollation("gb18030_bin", CharacterSet_gb18030)
	Collation_gb18030_unicode_520_ci      = newCollation("gb18030_unicode_520_ci", CharacterSet_gb18030)
	Collation_gb2312_chinese_ci           = newCollation("gb2312_chinese_ci", CharacterSet_gb2312)
	Collation_gb2312_bin                  = newCollation("gb2312_bin", CharacterSet_gb2312)
	Collation_gbk_chinese_ci              = newCollation("gbk_chinese_ci", CharacterSet_gbk)
	Collation_gbk_bin                     = newCollation("gbk_bin", CharacterSet_gbk)
	Collation_geostd8_general_ci          = newCollation("geostd8_general_ci", CharacterSet_geostd8)
	Collation_geostd8_bin                 = newCollation("geostd8_bin", CharacterSet_geostd8)
	Collation_greek_general_ci            = newCollation("greek_general_ci", CharacterSet_greek)
	Collation_greek_bin                   = newCollation("greek_bin", CharacterSet_greek)
	Collation_hebrew_general_ci           = newCollation("hebrew_general_ci", CharacterSet_hebrew)
	Collation_hebrew_bin                  = newCollation("hebrew_bin", CharacterSet_hebrew)
	Collation_hp8_english_ci              = newCollation("hp8_english_ci", CharacterSet_hp8)
	Collation_hp8_bin                     = newCollation("hp8_bin", CharacterSet_hp8)
	Collation_keybcs2_general_ci          = newCollation("keybcs2_general_ci", CharacterSet_keybcs2)
	Collation_keybcs2_bin                 = newCollation("keybcs2_bin", CharacterSet_keybcs2)
	Collation_koi8r_general_ci            = newCollation("koi8r_general_ci", CharacterSet_koi8r)
	Collation_koi8r_bin                   = newCollation("koi8r_bin", CharacterSet_koi8r)
	Collation_koi8u_general_ci            = newCollation("koi8u_general_ci", CharacterSet_koi8u)
	Collation_koi8u_bin                   = newCollation("koi8u_bin", CharacterSet_koi8u)
	Collation_latin1_german1_ci           = newCollation("latin1_german1_ci", CharacterSet_latin1)
	Collation_latin1_swedish_ci           = newCollation("latin1_swedish_ci", CharacterSet_latin1)
	Collation_latin1_danish_ci            = newCollation("latin1_danish_ci", CharacterSet_latin1)
	Collation_latin1_german2_ci           = newCollation("latin1_german2_ci", CharacterSet_latin1)
	Collation_latin1_bin                  = newCollation("latin1_bin", CharacterSet_latin1)
	Collation_latin1_general_ci           = newCollation("latin1_general_ci", CharacterSet_latin1)
	Collation_latin1_general_cs           = newCollation("latin1_general_cs", CharacterSet_latin1)
	Collation_latin1_spanish_ci           = newCollation("latin1_spanish_ci", CharacterSet_latin1)
	Collation_latin2_czech_cs             = newCollation("latin2_czech_cs", CharacterSet_latin2)
	Collation_latin2_general_ci           = newCollation("latin2_general_ci", CharacterSet_latin2)
	Collation_latin2_hungarian_ci         = newCollation("latin2_hungarian_ci", CharacterSet_latin2)
	Collation_latin2_croatian_ci          = newCollation("latin2_croatian_ci", CharacterSet_latin2)
	Collation_latin2_bin                  = newCollation("latin2_bin", CharacterSet_latin2)
	Collation_latin5_turkish_ci           = newCollation("latin5_turkish_ci", CharacterSet_latin5)
	Collation_latin5_bin                  = newCollation("latin5_bin", CharacterSet_latin5)
	Collation_latin7_estonian_cs          = newCollation("latin7_estonian_cs", CharacterSet_latin7)
	Collation_latin7_general_ci           = newCollation("latin7_general_ci", CharacterSet_latin7)
	Collation_latin7_general_cs           = newCollation("latin7_general_cs", CharacterSet_latin7)
	Collation_latin7_bin                  = newCollation("latin7_bin", CharacterSet_latin7)
	Collation_macce_general_ci            = newCollation("macce_general_ci", CharacterSet_macce)
	Collation_macce_bin                   = newCollation("macce_bin", CharacterSet_macce)
	Collation_macroman_general_ci         = newCollation("macroman_general_ci", CharacterSet_macroman)
	Collation_macroman_bin                = newCollation("macroman_bin", CharacterSet_macroman)
	Collation_sjis_japanese_ci            = newCollation("sjis_japanese_ci", CharacterSet_sjis)
	Collation_sjis_bin                    = newCollation("sjis_bin", CharacterSet_sjis)
	Collation_swe7_swedish_ci             = newCollation("swe7_swedish_ci", CharacterSet_swe7)
	Collation_swe7_bin                    = newCollation("swe7_bin", CharacterSet_swe7)
	Collation_tis620_thai_ci              = newCollation("tis620_thai_ci", CharacterSet_tis620)
	Collation_tis620_bin                  = newCollation("tis620_bin", CharacterSet_tis620)
	Collation_ucs2_general_ci             = newCollation("ucs2_general_ci", CharacterSet_ucs2)
	Collation_ucs2_bin                    = newCollation("ucs2_bin", CharacterSet_ucs2)
	Collation_ucs2_unicode_ci             = newCollation("ucs2_unicode_ci", CharacterSet_ucs2)
	Collation_ucs2_icelandic_ci           = newCollation("ucs2_icelandic_ci", CharacterSet_ucs2)
	Collation_ucs2_latvian_ci             = newCollation("ucs2_latvian_ci", CharacterSet_ucs2)
	Collation_ucs2_romanian_ci            = newCollation("ucs2_romanian_ci", CharacterSet_ucs2)
	Collation_ucs2_slovenian_ci           = newCollation("ucs2_slovenian_ci", CharacterSet_ucs2)
	Collation_ucs2_polish_ci              = newCollation("ucs2_polish_ci", CharacterSet_ucs2)
	Collation_ucs2_estonian_ci            = newCollation("ucs2_estonian_ci", CharacterSet_ucs2)
	Collation_ucs2_spanish_ci             = newCollation("ucs2_spanish_ci", CharacterSet_ucs2)
	Collation_ucs2_swedish_ci             = newCollation("ucs2_swedish_ci", CharacterSet_ucs2)
	Collation_ucs2_turkish_ci             = newCollation("ucs2_turkish_ci", CharacterSet_ucs2)
	Collation_ucs2_czech_ci               = newCollation("ucs2_czech_ci", CharacterSet_ucs2)
	Collation_ucs2_danish_ci              = newCollation("ucs2_danish_ci", CharacterSet_ucs2)
	Collation_ucs2_lithuanian_ci          = newCollation("ucs2_lithuanian_ci", CharacterSet_ucs2)
	Collation_ucs2_slovak_ci              = newCollation("ucs2_slovak_ci", CharacterSet_ucs2)
	Collation_ucs2_spanish2_ci            = newCollation("ucs2_spanish2_ci", CharacterSet_ucs2)
	Collation_ucs2_roman_ci               = newCollation("ucs2_roman_ci", CharacterSet_ucs2)
	Collation_ucs2_persian_ci             = newCollation("ucs2_persian_ci", CharacterSet_ucs2)
	Collation_ucs2_esperanto_ci           = newCollation("ucs2_esperanto_ci", CharacterSet_ucs2)
	Collation_ucs2_hungarian_ci           = newCollation("ucs2_hungarian_ci", CharacterSet_ucs2)
	Collation_ucs2_sinhala_ci             = newCollation("ucs2_sinhala_ci", CharacterSet_ucs2)
	Collation_ucs2_german2_ci             = newCollation("ucs2_german2_ci", CharacterSet_ucs2)
	Collation_ucs2_croatian_ci            = newCollation("ucs2_croatian_ci", CharacterSet_ucs2)
	Collation_ucs2_unicode_520_ci         = newCollation("ucs2_unicode_520_ci", CharacterSet_ucs2)
	Collation_ucs2_vietnamese_ci          = newCollation("ucs2_vietnamese_ci", CharacterSet_ucs2)
	Collation_ucs2_general_mysql500_ci    = newCollation("ucs2_general_mysql500_ci", CharacterSet_ucs2)
	Collation_ujis_japanese_ci            = newCollation("ujis_japanese_ci", CharacterSet_ujis)
	Collation_ujis_bin                    = newCollation("ujis_bin", CharacterSet_ujis)
	Collation_utf16_general_ci            = newCollation("utf16_general_ci", CharacterSet_utf16)
	Collation_utf16_bin                   = newCollation("utf16_bin", CharacterSet_utf16)
	Collation_utf16_unicode_ci            = newCollation("utf16_unicode_ci", CharacterSet_utf16)
	Collation_utf16_icelandic_ci          = newCollation("utf16_icelandic_ci", CharacterSet_utf16)
	Collation_utf16_latvian_ci            = newCollation("utf16_latvian_ci", CharacterSet_utf16)
	Collation_utf16_romanian_ci           = newCollation("utf16_romanian_ci", CharacterSet_utf16)
	Collation_utf16_slovenian_ci          = newCollation("utf16_slovenian_ci", CharacterSet_utf16)
	Collation_utf16_polish_ci             = newCollation("utf16_polish_ci", CharacterSet_utf16)
	Collation_utf16_estonian_ci           = newCollation("utf16_estonian_ci", CharacterSet_utf16)
	Collation_utf16_spanish_ci            = newCollation("utf16_spanish_ci", CharacterSet_utf16)
	Collation_utf16_swedish_ci            = newCollation("utf16_swedish_ci", CharacterSet_utf16)
	Collation_utf16_turkish_ci            = newCollation("utf16_turkish_ci", CharacterSet_utf16)
	Collation_utf16_czech_ci              = newCollation("utf16_czech_ci", CharacterSet_utf16)
	Collation_utf16_danish_ci             = newCollation("utf16_danish_ci", CharacterSet_utf16)
	Collation_utf16_lithuanian_ci         = newCollation("utf16_lithuanian_ci", CharacterSet_utf16)
	Collation_utf16_slovak_ci             = newCollation("utf16_slovak_ci", CharacterSet_utf16)
	Collation_utf16_spanish2_ci           = newCollation("utf16_spanish2_ci", CharacterSet_utf16)
	Collation_utf16_roman_ci              = newCollation("utf16_roman_ci", CharacterSet_utf16)
	Collation_utf16_persian_ci            = newCollation("utf16_persian_ci", CharacterSet_utf16)
	Collation_utf16_esperanto_ci          = newCollation("utf16_esperanto_ci", CharacterSet_utf16)
	Collation_utf16_hungarian_ci          = newCollation("utf16_hungarian_ci", CharacterSet_utf16)
	Collation_utf16_sinhala_ci            = newCollation("utf16_sinhala_ci", CharacterSet_utf16)
	Collation_utf16_german2_ci            = newCollation("utf16_german2_ci", CharacterSet_utf16)
	Collation_utf16_croatian_ci           = newCollation("utf16_croatian_ci", CharacterSet_utf16)
	Collation_utf16_unicode_520_ci        = newCollation("utf16_unicode_520_ci", CharacterSet_utf16)
	Collation_utf16_vietnamese_ci         = newCollation("utf16_vietnamese_ci", CharacterSet_utf16)
	Collation_utf16le_general_ci          = newCollation("utf16le_general_ci", CharacterSet_utf16le)
	Collation_utf16le_bin                 = newCollation("utf16le_bin", CharacterSet_utf16le)
	Collation_utf32_general_ci            = newCollation("utf32_general_ci", CharacterSet_utf32)
	Collation_utf32_bin                   = newCollation("utf32_bin", CharacterSet_utf32)
	Collation_utf32_unicode_ci            = newCollation("utf32_unicode_ci", CharacterSet_utf32)
	Collation_utf32_icelandic_ci          = newCollation("utf32_icelandic_ci", CharacterSet_utf32)
	Collation_utf32_latvian_ci            = newCollation("utf32_latvian_ci", CharacterSet_utf32)
	Collation_utf32_romanian_ci           = newCollation("utf32_romanian_ci", CharacterSet_utf32)
	Collation_utf32_slovenian_ci          = newCollation("utf32_slovenian_ci", CharacterSet_utf32)
	Collation_utf32_polish_ci             = newCollation("utf32_polish_ci", CharacterSet_utf32)
	Collation_utf32_estonian_ci           = newCollation("utf32_estonian_ci", CharacterSet_utf32)
	Collation_utf32_spanish_ci            = newCollation("utf32_spanish_ci", CharacterSet_utf32)
	Collation_utf32_swedish_ci            = newCollation("utf32_swedish_ci", CharacterSet_utf32)
	Collation_utf32_turkish_ci            = newCollation("utf32_turkish_ci", CharacterSet_utf32)
	Collation_utf32_czech_ci              = newCollation("utf32_czech_ci", CharacterSet_utf32)
	Collation_utf32_danish_ci             = newCollation("utf32_danish_ci", CharacterSet_utf32)
	Collation_utf32_lithuanian_ci         = newCollation("utf32_lithuanian_ci", CharacterSet_utf32)
	Collation_utf32_slovak_ci             = newCollation("utf32_slovak_ci", CharacterSet_utf32)
	Collation_utf32_spanish2_ci           = newCollation("utf32_spanish2_ci", CharacterSet_utf32)
	Collation_utf32_roman_ci              = newCollation("utf32_roman_ci", CharacterSet_utf32)
	Collation_utf32_persian_ci            = newCollation("utf32_persian_ci", CharacterSet_utf32)
	Collation_utf32_esperanto_ci          = newCollation("utf32_esperanto_ci", CharacterSet_utf32)
	Collation_utf32_hungarian_ci          = newCollation("utf32_hungarian_ci", CharacterSet_utf32)
	Collation_utf32_sinhala_ci            = newCollation("utf32_sinhala_ci", CharacterSet_utf32)
	Collation_utf32_german2_ci            = newCollation("utf32_german2_ci", CharacterSet_utf32)
	Collation_utf32_croatian_ci           = newCollation("utf32_croatian_ci", CharacterSet_utf32)
	Collation_utf32_unicode_520_ci        = newCollation("utf32_unicode_520_ci", CharacterSet_utf32)
	Collation_utf32_vietnamese_ci         = newCollation("utf32_vietnamese_ci", CharacterSet_utf32)
	Collation_utf8mb3_general_ci          = newCollation("utf8mb3_general_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_tolower_ci          = newCollation("utf8mb3_tolower_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_bin                 = newCollation("utf8mb3_bin", CharacterSet_utf8mb3)
	Collation_utf8mb3_unicode_ci          = newCollation("utf8mb3_unicode_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_icelandic_ci        = newCollation("utf8mb3_icelandic_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_latvian_ci          = newCollation("utf8mb3_latvian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_romanian_ci         = newCollation("utf8mb3_romanian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_slovenian_ci        = newCollation("utf8mb3_slovenian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_polish_ci           = newCollation("utf8mb3_polish_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_estonian_ci         = newCollation("utf8mb3_estonian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_spanish_ci          = newCollation("utf8mb3_spanish_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_swedish_ci          = newCollation("utf8mb3_swedish_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_turkish_ci          = newCollation("utf8mb3_turkish_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_czech_ci            = newCollation("utf8mb3_czech_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_danish_ci           = newCollation("utf8mb3_danish_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_lithuanian_ci       = newCollation("utf8mb3_lithuanian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_slovak_ci           = newCollation("utf8mb3_slovak_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_spanish2_ci         = newCollation("utf8mb3_spanish2_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_roman_ci            = newCollation("utf8mb3_roman_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_persian_ci          = newCollation("utf8mb3_persian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_esperanto_ci        = newCollation("utf8mb3_esperanto_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_hungarian_ci        = newCollation("utf8mb3_hungarian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_sinhala_ci          = newCollation("utf8mb3_sinhala_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_german2_ci          = newCollation("utf8mb3_german2_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_croatian_ci         = newCollation("utf8mb3_croatian_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_unicode_520_ci      = newCollation("utf8mb3_unicode_520_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_vietnamese_ci       = newCollation("utf8mb3_vietnamese_ci", CharacterSet_utf8mb3)
	Collation_utf8mb3_general_mysql500_ci = newCollation("utf8mb3_general_mysql500_ci", CharacterSet_utf8mb3)
	Collation_utf8mb4_general_ci          = newCollation("utf8mb4_general_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_bin                 = newCollation("utf8mb4_bin", CharacterSet_utf8mb4)
	Collation_utf8mb4_unicode_ci          = newCollation("utf8mb4_unicode_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_icelandic_ci        = newCollation("utf8mb4_icelandic_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_latvian_ci          = newCollation("utf8mb4_latvian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_romanian_ci         = newCollation("utf8mb4_romanian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_slovenian_ci        = newCollation("utf8mb4_slovenian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_polish_ci           = newCollation("utf8mb4_polish_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_estonian_ci         = newCollation("utf8mb4_estonian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_spanish_ci          = newCollation("utf8mb4_spanish_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_swedish_ci          = newCollation("utf8mb4_swedish_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_turkish_ci          = newCollation("utf8mb4_turkish_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_czech_ci            = newCollation("utf8mb4_czech_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_danish_ci           = newCollation("utf8mb4_danish_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_lithuanian_ci       = newCollation("utf8mb4_lithuanian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_slovak_ci           = newCollation("utf8mb4_slovak_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_spanish2_ci         = newCollation("utf8mb4_spanish2_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_roman_ci            = newCollation("utf8mb4_roman_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_persian_ci          = newCollation("utf8mb4_persian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_esperanto_ci        = newCollation("utf8mb4_esperanto_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_hungarian_ci        = newCollation("utf8mb4_hungarian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_sinhala_ci          = newCollation("utf8mb4_sinhala_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_german2_ci          = newCollation("utf8mb4_german2_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_croatian_ci         = newCollation("utf8mb4_croatian_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_unicode_520_ci      = newCollation("utf8mb4_unicode_520_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_vietnamese_ci       = newCollation("utf8mb4_vietnamese_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_0900_ai_ci          = newCollation("utf8mb4_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_de_pb_0900_ai_ci    = newCollation("utf8mb4_de_pb_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_is_0900_ai_ci       = newCollation("utf8mb4_is_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_lv_0900_ai_ci       = newCollation("utf8mb4_lv_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_ro_0900_ai_ci       = newCollation("utf8mb4_ro_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_sl_0900_ai_ci       = newCollation("utf8mb4_sl_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_pl_0900_ai_ci       = newCollation("utf8mb4_pl_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_et_0900_ai_ci       = newCollation("utf8mb4_et_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_es_0900_ai_ci       = newCollation("utf8mb4_es_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_sv_0900_ai_ci       = newCollation("utf8mb4_sv_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_tr_0900_ai_ci       = newCollation("utf8mb4_tr_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_cs_0900_ai_ci       = newCollation("utf8mb4_cs_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_da_0900_ai_ci       = newCollation("utf8mb4_da_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_lt_0900_ai_ci       = newCollation("utf8mb4_lt_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_sk_0900_ai_ci       = newCollation("utf8mb4_sk_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_es_trad_0900_ai_ci  = newCollation("utf8mb4_es_trad_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_la_0900_ai_ci       = newCollation("utf8mb4_la_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_eo_0900_ai_ci       = newCollation("utf8mb4_eo_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_hu_0900_ai_ci       = newCollation("utf8mb4_hu_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_hr_0900_ai_ci       = newCollation("utf8mb4_hr_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_vi_0900_ai_ci       = newCollation("utf8mb4_vi_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_0900_as_cs          = newCollation("utf8mb4_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_de_pb_0900_as_cs    = newCollation("utf8mb4_de_pb_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_is_0900_as_cs       = newCollation("utf8mb4_is_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_lv_0900_as_cs       = newCollation("utf8mb4_lv_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_ro_0900_as_cs       = newCollation("utf8mb4_ro_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_sl_0900_as_cs       = newCollation("utf8mb4_sl_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_pl_0900_as_cs       = newCollation("utf8mb4_pl_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_et_0900_as_cs       = newCollation("utf8mb4_et_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_es_0900_as_cs       = newCollation("utf8mb4_es_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_sv_0900_as_cs       = newCollation("utf8mb4_sv_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_tr_0900_as_cs       = newCollation("utf8mb4_tr_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_cs_0900_as_cs       = newCollation("utf8mb4_cs_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_da_0900_as_cs       = newCollation("utf8mb4_da_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_lt_0900_as_cs       = newCollation("utf8mb4_lt_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_sk_0900_as_cs       = newCollation("utf8mb4_sk_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_es_trad_0900_as_cs  = newCollation("utf8mb4_es_trad_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_la_0900_as_cs       = newCollation("utf8mb4_la_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_eo_0900_as_cs       = newCollation("utf8mb4_eo_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_hu_0900_as_cs       = newCollation("utf8mb4_hu_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_hr_0900_as_cs       = newCollation("utf8mb4_hr_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_vi_0900_as_cs       = newCollation("utf8mb4_vi_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_ja_0900_as_cs       = newCollation("utf8mb4_ja_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_ja_0900_as_cs_ks    = newCollation("utf8mb4_ja_0900_as_cs_ks", CharacterSet_utf8mb4)
	Collation_utf8mb4_0900_as_ci          = newCollation("utf8mb4_0900_as_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_ru_0900_ai_ci       = newCollation("utf8mb4_ru_0900_ai_ci", CharacterSet_utf8mb4)
	Collation_utf8mb4_ru_0900_as_cs       = newCollation("utf8mb4_ru_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_zh_0900_as_cs       = newCollation("utf8mb4_zh_0900_as_cs", CharacterSet_utf8mb4)
	Collation_utf8mb4_0900_bin            = newCollation("utf8mb4_0900_bin", CharacterSet_utf8mb4)

	Collation_utf8_general_ci          = Collation_utf8mb3_general_ci
	Collation_utf8_tolower_ci          = Collation_utf8mb3_tolower_ci
	Collation_utf8_bin                 = Collation_utf8mb3_bin
	Collation_utf8_unicode_ci          = Collation_utf8mb3_unicode_ci
	Collation_utf8_icelandic_ci        = Collation_utf8mb3_icelandic_ci
	Collation_utf8_latvian_ci          = Collation_utf8mb3_latvian_ci
	Collation_utf8_romanian_ci         = Collation_utf8mb3_romanian_ci
	Collation_utf8_slovenian_ci        = Collation_utf8mb3_slovenian_ci
	Collation_utf8_polish_ci           = Collation_utf8mb3_polish_ci
	Collation_utf8_estonian_ci         = Collation_utf8mb3_estonian_ci
	Collation_utf8_spanish_ci          = Collation_utf8mb3_spanish_ci
	Collation_utf8_swedish_ci          = Collation_utf8mb3_swedish_ci
	Collation_utf8_turkish_ci          = Collation_utf8mb3_turkish_ci
	Collation_utf8_czech_ci            = Collation_utf8mb3_czech_ci
	Collation_utf8_danish_ci           = Collation_utf8mb3_danish_ci
	Collation_utf8_lithuanian_ci       = Collation_utf8mb3_lithuanian_ci
	Collation_utf8_slovak_ci           = Collation_utf8mb3_slovak_ci
	Collation_utf8_spanish2_ci         = Collation_utf8mb3_spanish2_ci
	Collation_utf8_roman_ci            = Collation_utf8mb3_roman_ci
	Collation_utf8_persian_ci          = Collation_utf8mb3_persian_ci
	Collation_utf8_esperanto_ci        = Collation_utf8mb3_esperanto_ci
	Collation_utf8_hungarian_ci        = Collation_utf8mb3_hungarian_ci
	Collation_utf8_sinhala_ci          = Collation_utf8mb3_sinhala_ci
	Collation_utf8_german2_ci          = Collation_utf8mb3_german2_ci
	Collation_utf8_croatian_ci         = Collation_utf8mb3_croatian_ci
	Collation_utf8_unicode_520_ci      = Collation_utf8mb3_unicode_520_ci
	Collation_utf8_vietnamese_ci       = Collation_utf8mb3_vietnamese_ci
	Collation_utf8_general_mysql500_ci = Collation_utf8mb3_general_mysql500_ci

	Collation_Default = Collation_utf8mb4_0900_bin
)
View Source
var (
	// ErrConvertingToTime is thrown when a value cannot be converted to a Time
	ErrConvertingToTime = errors.NewKind("value %q can't be converted to time.Time")

	ErrConvertingToTimeOutOfRange = errors.NewKind("value %q is outside of %v range")

	// TimestampDatetimeLayouts hold extra timestamps allowed for parsing. It does
	// not have all the layouts supported by mysql. Missing are two digit year
	// versions of common cases and dates that use non common separators.
	//
	// https://github.com/MariaDB/server/blob/mysql-5.5.36/sql-common/my_time.c#L124
	TimestampDatetimeLayouts = []string{
		"2006-01-02 15:04:05.999999",
		"2006-01-02",
		"2006-1-2",
		"2006-1-2 15:4:5.999999",
		time.RFC3339,
		time.RFC3339Nano,
		"2006-01-02T15:04:05",
		"20060102150405",
		"20060102",
		"2006/01/02",
		"2006-01-02 15:04:05.999999999 -0700 MST",
	}

	// Date is a date with day, month and year.
	Date = MustCreateDatetimeType(sqltypes.Date)
	// Datetime is a date and a time
	Datetime = MustCreateDatetimeType(sqltypes.Datetime)
	// Timestamp is an UNIX timestamp.
	Timestamp = MustCreateDatetimeType(sqltypes.Timestamp)
)
View Source
var (
	ErrConvertingToDecimal   = errors.NewKind("value %v is not a valid Decimal")
	ErrConvertToDecimalLimit = errors.NewKind("value of Decimal is too large for type")
	ErrMarshalNullDecimal    = errors.NewKind("Decimal cannot marshal a null value")
)
View Source
var (
	ErrConvertingToEnum  = errors.NewKind("value %v is not valid for this Enum")
	ErrUnmarshallingEnum = errors.NewKind("value %v is not a marshalled value for this Enum")
)
View Source
var (
	// ErrSyntaxError is returned when a syntax error in vitess is encountered.
	ErrSyntaxError = errors.NewKind("%s")

	// ErrUnsupportedFeature is thrown when a feature is not already supported
	ErrUnsupportedFeature = errors.NewKind("unsupported feature: %s")

	// ErrInvalidSystemVariableValue is returned when a system variable is assigned a value that it does not accept.
	ErrInvalidSystemVariableValue = errors.NewKind("Variable '%s' can't be set to the value of '%v'")

	// ErrSystemVariableCodeFail is returned when failing to encode/decode a system variable.
	ErrSystemVariableCodeFail = errors.NewKind("unable to encode/decode value '%v' for '%s'")

	// ErrInvalidType is thrown when there is an unexpected type at some part of
	// the execution tree.
	ErrInvalidType = errors.NewKind("invalid type: %s")

	// ErrTableAlreadyExists is thrown when someone tries to create a
	// table with a name of an existing one
	ErrTableAlreadyExists = errors.NewKind("table with name %s already exists")

	// ErrTableNotFound is returned when the table is not available from the
	// current scope.
	ErrTableNotFound = errors.NewKind("table not found: %s")

	// ErrColumnNotFound is thrown when a column named cannot be found in scope
	ErrTableColumnNotFound = errors.NewKind("table %q does not have column %q")

	// ErrColumnNotFound is returned when the column does not exist in any
	// table in scope.
	ErrColumnNotFound = errors.NewKind("column %q could not be found in any table in scope")

	// ErrAmbiguousColumnName is returned when there is a column reference that
	// is present in more than one table.
	ErrAmbiguousColumnName = errors.NewKind("ambiguous column name %q, it's present in all these tables: %v")

	// ErrAmbiguousColumnInOrderBy is returned when an order by column is ambiguous
	ErrAmbiguousColumnInOrderBy = errors.NewKind("Column %q in order clause is ambiguous")

	// ErrUnexpectedRowLength is thrown when the obtained row has more columns than the schema
	ErrUnexpectedRowLength = errors.NewKind("expected %d values, got %d")

	// ErrInvalidChildrenNumber is returned when the WithChildren method of a
	// node or expression is called with an invalid number of arguments.
	ErrInvalidChildrenNumber = errors.NewKind("%T: invalid children number, got %d, expected %d")

	// ErrInvalidChildType is returned when the WithChildren method of a
	// node or expression is called with an invalid child type. This error is indicative of a bug.
	ErrInvalidChildType = errors.NewKind("%T: invalid child type, got %T, expected %T")

	// ErrInvalidJSONText is returned when a JSON string cannot be parsed or unmarshalled
	ErrInvalidJSONText = errors.NewKind("Invalid JSON text: %s")

	// ErrDeleteRowNotFound
	ErrDeleteRowNotFound = errors.NewKind("row was not found when attempting to delete")

	// ErrDuplicateAlias should be returned when a query contains a duplicate alias / table name.
	ErrDuplicateAliasOrTable = errors.NewKind("Not unique table/alias: %s")

	// ErrPrimaryKeyViolation is returned when a primary key constraint is violated
	// This is meant to wrap a sql.UniqueKey error, which provides the key string
	ErrPrimaryKeyViolation = errors.NewKind("duplicate primary key given")

	// ErrUniqueKeyViolation is returned when a unique key constraint is violated
	// This is meant to wrap a sql.UniqueKey error, which provides the key string
	ErrUniqueKeyViolation = errors.NewKind("duplicate unique key given")

	// ErrMisusedAlias is returned when a alias is defined and used in the same projection.
	ErrMisusedAlias = errors.NewKind("column %q does not exist in scope, but there is an alias defined in" +
		" this projection with that name. Aliases cannot be used in the same projection they're defined in")

	// ErrInvalidAsOfExpression is returned when an expression for AS OF cannot be used
	ErrInvalidAsOfExpression = errors.NewKind("expression %s cannot be used in AS OF")

	// ErrIncompatibleDefaultType is returned when a provided default cannot be coerced into the type of the column
	ErrIncompatibleDefaultType = errors.NewKind("incompatible type for default value")

	// ErrInvalidTextBlobColumnDefault is returned when a column of type text/blob (or related) has a literal default set.
	ErrInvalidTextBlobColumnDefault = errors.NewKind("text/blob types may only have expression default values")

	// ErrInvalidColumnDefaultFunction is returned when an invalid function is used in a default value.
	ErrInvalidColumnDefaultFunction = errors.NewKind("function `%s` on column `%s` is not valid for usage in a default value")

	// ErrColumnDefaultDatetimeOnlyFunc is returned when a non datetime/timestamp column attempts to declare now/current_timestamp as a default value literal.
	ErrColumnDefaultDatetimeOnlyFunc = errors.NewKind("only datetime/timestamp may declare default values of now()/current_timestamp() without surrounding parentheses")

	// ErrColumnDefaultSubquery is returned when a default value contains a subquery.
	ErrColumnDefaultSubquery = errors.NewKind("default value on column `%s` may not contain subqueries")

	// ErrInvalidDefaultValueOrder is returned when a default value references a column that comes after it and contains a default expression.
	ErrInvalidDefaultValueOrder = errors.NewKind(`default value of column "%s" cannot refer to a column defined after it if those columns have an expression default value`)

	// ErrColumnDefaultReturnedNull is returned when a default expression evaluates to nil but the column is non-nullable.
	ErrColumnDefaultReturnedNull = errors.NewKind(`default value attempted to return null but column is non-nullable`)

	// ErrDropColumnReferencedInDefault is returned when a column cannot be dropped as it is referenced by another column's default value.
	ErrDropColumnReferencedInDefault = errors.NewKind(`cannot drop column "%s" as default value of column "%s" references it`)

	// ErrTriggersNotSupported is returned when attempting to create a trigger on a database that doesn't support them
	ErrTriggersNotSupported = errors.NewKind(`database "%s" doesn't support triggers`)

	// ErrTriggerCreateStatementInvalid is returned when a TriggerDatabase returns a CREATE TRIGGER statement that is invalid
	ErrTriggerCreateStatementInvalid = errors.NewKind(`Invalid CREATE TRIGGER statement: %s`)

	// ErrTriggerDoesNotExist is returned when a trigger does not exist.
	ErrTriggerDoesNotExist = errors.NewKind(`trigger "%s" does not exist`)

	// ErrTriggerTableInUse is returned when trigger execution calls for a table that invoked a trigger being updated by it
	ErrTriggerTableInUse = errors.NewKind("Can't update table %s in stored function/trigger because it is already used by statement which invoked this stored function/trigger")

	// ErrTriggerCannotBeDropped is returned when dropping a trigger would cause another trigger to reference a non-existent trigger.
	ErrTriggerCannotBeDropped = errors.NewKind(`trigger "%s" cannot be dropped as it is referenced by trigger "%s"`)

	// ErrStoredProceduresNotSupported is returned when attempting to create a stored procedure on a database that doesn't support them.
	ErrStoredProceduresNotSupported = errors.NewKind(`database "%s" doesn't support stored procedures`)

	// ErrTriggerDoesNotExist is returned when a stored procedure does not exist.
	ErrStoredProcedureAlreadyExists = errors.NewKind(`stored procedure "%s" already exists`)

	// ErrTriggerDoesNotExist is returned when a stored procedure does not exist.
	ErrStoredProcedureDoesNotExist = errors.NewKind(`stored procedure "%s" does not exist`)

	// ErrProcedureCreateStatementInvalid is returned when a StoredProcedureDatabase returns a CREATE PROCEDURE statement that is invalid.
	ErrProcedureCreateStatementInvalid = errors.NewKind(`Invalid CREATE PROCEDURE statement: %s`)

	// ErrProcedureDuplicateParameterName is returned when a stored procedure has two (or more) parameters with the same name.
	ErrProcedureDuplicateParameterName = errors.NewKind("duplicate parameter name `%s` on stored procedure `%s`")

	// ErrProcedureRecursiveCall is returned when a stored procedure has a CALL statement that refers to itself.
	ErrProcedureRecursiveCall = errors.NewKind("recursive CALL on stored procedure `%s`")

	// ErrProcedureInvalidBodyStatement is returned when a stored procedure has a statement that is invalid inside of procedures.
	ErrProcedureInvalidBodyStatement = errors.NewKind("`%s` statements are invalid inside of stored procedures")

	// ErrCallIncorrectParameterCount is returned when a CALL statement has the incorrect number of parameters.
	ErrCallIncorrectParameterCount = errors.NewKind("`%s` expected `%d` parameters but got `%d`")

	// ErrUnknownSystemVariable is returned when a query references a system variable that doesn't exist
	ErrUnknownSystemVariable = errors.NewKind(`Unknown system variable '%s'`)

	// ErrSystemVariableReadOnly is returned when attempting to set a value to a non-Dynamic system variable.
	ErrSystemVariableReadOnly = errors.NewKind(`Variable '%s' is a read only variable`)

	// ErrSystemVariableSessionOnly is returned when attempting to set a SESSION-only variable using SET GLOBAL.
	ErrSystemVariableSessionOnly = errors.NewKind(`Variable '%s' is a SESSION variable and can't be used with SET GLOBAL`)

	// ErrSystemVariableGlobalOnly is returned when attempting to set a GLOBAL-only variable using SET SESSION.
	ErrSystemVariableGlobalOnly = errors.NewKind(`Variable '%s' is a GLOBAL variable and should be set with SET GLOBAL`)

	// ErrUserVariableNoDefault is returned when attempting to set the default value on a user variable.
	ErrUserVariableNoDefault = errors.NewKind(`User variable '%s' does not have a default value`)

	// ErrInvalidUseOfOldNew is returned when a trigger attempts to make use of OLD or NEW references when they don't exist
	ErrInvalidUseOfOldNew = errors.NewKind("There is no %s row in on %s trigger")

	// ErrInvalidUpdateOfOldRow is returned when a trigger attempts to assign to an old row's value with SET
	ErrInvalidUpdateOfOldRow = errors.NewKind("Updating of old row is not allowed in trigger")

	// ErrInvalidUpdateInAfterTrigger is returned when a trigger attempts to assign to a new row in an AFTER trigger
	ErrInvalidUpdateInAfterTrigger = errors.NewKind("Updating of new row is not allowed in after trigger")

	// ErrUnboundPreparedStatementVariable is returned when a query is executed without a binding for one its variables.
	ErrUnboundPreparedStatementVariable = errors.NewKind(`unbound variable "%s" in query`)

	// ErrTruncateReferencedFromForeignKey is returned when a table is referenced in a foreign key and TRUNCATE is called on it.
	ErrTruncateReferencedFromForeignKey = errors.NewKind("cannot truncate table %s as it is referenced in foreign key %s on table %s")

	// ErrInvalidColTypeDefinition is returned when a column type-definition has argument violations.
	ErrInvalidColTypeDefinition = errors.NewKind("column %s type definition is invalid: %s")

	// ErrCannotCreateDatabaseExists is returned when a CREATE DATABASE is called on a table that already exists.
	ErrCannotCreateDatabaseExists = errors.NewKind("can't create database %s; database exists")

	// ErrCannotDropDatabaseDoesntExist is returned when a DROP DATABASE is callend when a table is dropped that doesn't exist.
	ErrCannotDropDatabaseDoesntExist = errors.NewKind("can't drop database %s; database doesn't exist")

	// ErrInvalidConstraintFunctionsNotSupported is returned when a CONSTRAINT CHECK is called with a sub-function expression.
	ErrInvalidConstraintFunctionsNotSupported = errors.NewKind("Invalid constraint expression, functions not supported: %s")

	// ErrInvalidConstraintSubqueryNotSupported is returned when a CONSTRAINT CHECK is called with a sub-query expression.
	ErrInvalidConstraintSubqueryNotSupported = errors.NewKind("Invalid constraint expression, sub-queries not supported: %s")

	ErrCheckConstraintViolatedFmtStr = "Check constraint %q violated"

	// ErrCheckConstraintViolated is returned when a CONSTRAINT CHECK is called with a sub-query expression.
	ErrCheckConstraintViolated = errors.NewKind(ErrCheckConstraintViolatedFmtStr)

	// ErrColumnCountMismatch is returned when a view, derived table or common table expression has a declared column
	// list with a different number of columns than the schema of the table.
	ErrColumnCountMismatch = errors.NewKind("In definition of view, derived table or common table expression, SELECT list and column names list have different column counts")

	// ErrUuidUnableToParse is returned when a UUID is unable to be parsed.
	ErrUuidUnableToParse = errors.NewKind("unable to parse '%s' to UUID: %s")

	// ErrLoadDataCannotOpen is returned when a LOAD DATA operation is unable to open the file specified.
	ErrLoadDataCannotOpen = errors.NewKind("LOAD DATA is unable to open file: %s")

	// ErrLoadDataCharacterLength is returned when a symbol is of the wrong character length for a LOAD DATA operation.
	ErrLoadDataCharacterLength = errors.NewKind("%s must be 1 character long")

	// ErrJSONObjectAggNullKey is returned when JSON_OBJECTAGG is run on a table with NULL keys
	ErrJSONObjectAggNullKey = errors.NewKind("JSON documents may not contain NULL member names")

	// ErrDeclareOrderInvalid is returned when a DECLARE statement is at an invalid location.
	ErrDeclareOrderInvalid = errors.NewKind("DECLARE may only exist at the beginning of a BEGIN/END block")

	// ErrDeclareConditionNotFound is returned when SIGNAL/RESIGNAL references a non-existent DECLARE CONDITION.
	ErrDeclareConditionNotFound = errors.NewKind("condition %s does not exist")

	// ErrDeclareConditionDuplicate is returned when a DECLARE CONDITION statement with the same name was declared in the current scope.
	ErrDeclareConditionDuplicate = errors.NewKind("duplicate condition '%s'")

	// ErrSignalOnlySqlState is returned when SIGNAL/RESIGNAL references a DECLARE CONDITION for a MySQL error code.
	ErrSignalOnlySqlState = errors.NewKind("SIGNAL/RESIGNAL can only use a condition defined with SQLSTATE")

	// ErrExpectedSingleRow is returned when a subquery executed in normal queries or aggregation function returns
	// more than 1 row without an attached IN clause.
	ErrExpectedSingleRow = errors.NewKind("the subquery returned more than 1 row")

	// ErrUnknownConstraint is returned when a DROP CONSTRAINT statement refers to a constraint that doesn't exist
	ErrUnknownConstraint = errors.NewKind("Constraint %q does not exist")

	// ErrInsertIntoNonNullableDefaultNullColumn is returned when an INSERT excludes a field which is non-nullable and has no default/autoincrement.
	ErrInsertIntoNonNullableDefaultNullColumn = errors.NewKind("Field '%s' doesn't have a default value")

	// ErrAlterTableNotSupported is thrown when the table doesn't support ALTER TABLE statements
	ErrAlterTableNotSupported = errors.NewKind("table %s cannot be altered")

	// ErrPartitionNotFound is thrown when a partition key on a table is not found
	ErrPartitionNotFound = errors.NewKind("partition not found %q")

	// ErrInsertIntoNonNullableProvidedNull is called when a null value is inserted into a non-nullable column
	ErrInsertIntoNonNullableProvidedNull = errors.NewKind("column name '%v' is non-nullable but attempted to set a value of null")

	// ErrForeignKeyChildViolation is called when a rows is added but there is no parent row, and a foreign key constraint fails. Add the parent row first.
	ErrForeignKeyChildViolation = errors.NewKind("cannot add or update a child row - Foreign key violation on fk: `%s`, table: `%s`, referenced table: `%s`, key: `%s`")

	// ErrForeignKeyParentViolation is called when a parent row that is deleted has children, and a foreign key constraint fails. Delete the children first.
	ErrForeignKeyParentViolation = errors.NewKind("cannot delete or update a parent row - Foreign key violation on fk: `%s`, table: `%s`, referenced table: `%s`, key: `%s`")

	// ErrForeignKeyColumnCountMismatch is called when the declared column and referenced column counts do not match.
	ErrForeignKeyColumnCountMismatch = errors.NewKind("the foreign key must reference an equivalent number of columns")

	// ErrForeignKeyNotResolved is called when an add or update is attempted on a foreign key that has not been resolved yet.
	ErrForeignKeyNotResolved = errors.NewKind("cannot add or update a child row: a foreign key constraint fails (`%s`, CONSTRAINT `%s` FOREIGN KEY (`%s`) REFERENCES `%s` (`%s`))")

	// ErrDuplicateEntry is returns when a duplicate entry is placed on an index such as a UNIQUE or a Primary Key.
	ErrDuplicateEntry = errors.NewKind("Duplicate entry for key '%s'")

	// ErrInvalidArgument is returned when an argument to a function is invalid.
	ErrInvalidArgument = errors.NewKind("Incorrect arguments to %s")

	// ErrSavepointDoesNotExist is returned when a RELEASE SAVEPOINT or ROLLBACK TO SAVEPOINT statement references a
	// non-existent savepoint identifier
	ErrSavepointDoesNotExist = errors.NewKind("SAVEPOINT %s does not exist")

	// ErrTableCreatedNotFound is thrown when an integrator attempts to create a temporary tables without temporary table
	// support.
	ErrTemporaryTableNotSupported = errors.NewKind("database does not support temporary tables")

	// ErrInvalidSyntax is returned for syntax errors that aren't picked up by the parser, e.g. the wrong type of
	// expression used in part of statement.
	ErrInvalidSyntax = errors.NewKind("Invalid syntax: %s")

	// ErrTableCopyingNotSupported is returned when a table invokes the TableCopierDatabase interface's
	// CopyTableData method without supporting the interface
	ErrTableCopyingNotSupported = errors.NewKind("error: Table copying not supported")

	// ErrMultiplePrimaryKeysDefined is returned when a table invokes CreatePrimaryKey with a primary key already
	// defined.
	ErrMultiplePrimaryKeysDefined = errors.NewKind("error: Multiple primary keys defined")

	// ErrWrongAutoKey is returned when a table invokes DropPrimaryKey without first removing the auto increment property
	// (if it exists) on it.
	ErrWrongAutoKey = errors.NewKind("error: incorrect table definition: there can be only one auto column and it must be defined as a key")

	// ErrKeyColumnDoesNotExist is returned when a table invoked CreatePrimaryKey with a non-existent column.
	ErrKeyColumnDoesNotExist = errors.NewKind("error: key column '%s' doesn't exist in table")

	// ErrCantDropFieldOrKey is returned when a table invokes DropPrimaryKey on a keyless table.
	ErrCantDropFieldOrKey = errors.NewKind("error: can't drop '%s'; check that column/key exists")

	// ErrCantDropIndex is return when a table can't drop an index due to a foreign key relationship.
	ErrCantDropIndex = errors.NewKind("error: can't drop index '%s': needed in a foreign key constraint")

	// ErrImmutableDatabaseProvider is returned when attempting to edit an immutable database databaseProvider.
	ErrImmutableDatabaseProvider = errors.NewKind("error: can't modify database databaseProvider")

	// ErrInvalidValue is returned when a given value does not match what is expected.
	ErrInvalidValue = errors.NewKind(`error: '%v' is not a valid value for '%v'`)

	// ErrInvalidValueType is returned when a given value's type does not match what is expected.
	ErrInvalidValueType = errors.NewKind(`error: '%T' is not a valid value type for '%v'`)

	// ErrFunctionNotFound is thrown when a function is not found
	ErrFunctionNotFound = errors.NewKind("function: '%s' not found")

	// ErrInvalidArgumentNumber is returned when the number of arguments to call a
	// function is different from the function arity.
	ErrInvalidArgumentNumber = errors.NewKind("function '%s' expected %v arguments, %v received")

	// ErrDatabaseNotFound is thrown when a database is not found
	ErrDatabaseNotFound = errors.NewKind("database not found: %s")

	// ErrNoDatabaseSelected is thrown when a database is not selected and the query requires one
	ErrNoDatabaseSelected = errors.NewKind("no database selected")

	// ErrAsOfNotSupported is thrown when an AS OF query is run on a database that can't support it
	ErrAsOfNotSupported = errors.NewKind("AS OF not supported for database %s")

	// ErrIncompatibleAsOf is thrown when an AS OF clause is used in an incompatible manner, such as when using an AS OF
	// expression with a view when the view definition has its own AS OF expressions.
	ErrIncompatibleAsOf = errors.NewKind("incompatible use of AS OF: %s")

	// ErrPidAlreadyUsed is returned when the pid is already registered.
	ErrPidAlreadyUsed = errors.NewKind("pid %d is already in use")

	// ErrInvalidOperandColumns is returned when the columns in the left
	// operand and the elements of the right operand don't match. Also
	// returned for invalid number of columns in projections, filters,
	// joins, etc.
	ErrInvalidOperandColumns = errors.NewKind("operand should have %d columns, but has %d")

	// ErrReadOnlyTransaction is returned when a write query is executed in a READ ONLY transaction.
	ErrReadOnlyTransaction = errors.NewKind("cannot execute statement in a READ ONLY transaction")

	// ErrExistingView is returned when a CREATE VIEW statement uses a name that already exists
	ErrExistingView = errors.NewKind("the view %s.%s already exists")

	// ErrViewDoesNotExist is returned when a DROP VIEW statement drops a view that does not exist
	ErrViewDoesNotExist = errors.NewKind("the view %s.%s does not exist")
)
View Source
var (
	// ErrIndexIDAlreadyRegistered is the error returned when there is already
	// an index with the same ID.
	ErrIndexIDAlreadyRegistered = errors.NewKind("an index with id %q has already been registered")

	// ErrIndexExpressionAlreadyRegistered is the error returned when there is
	// already an index with the same expression.
	ErrIndexExpressionAlreadyRegistered = errors.NewKind("there is already an index registered for the expressions: %s")

	// ErrIndexNotFound is returned when the index could not be found.
	ErrIndexNotFound = errors.NewKind("index %q	was not found")

	// ErrIndexDeleteInvalidStatus is returned when the index trying to delete
	// does not have a ready or outdated state.
	ErrIndexDeleteInvalidStatus = errors.NewKind("can't delete index %q because it's not ready for removal")
)
View Source
var (
	ErrOutOfRange = errors.NewKind("%v out of range for %v")

	// Boolean is a synonym for TINYINT
	Boolean = Int8
	// Int8 is an integer of 8 bits
	Int8 = MustCreateNumberType(sqltypes.Int8)
	// Uint8 is an unsigned integer of 8 bits
	Uint8 = MustCreateNumberType(sqltypes.Uint8)
	// Int16 is an integer of 16 bits
	Int16 = MustCreateNumberType(sqltypes.Int16)
	// Uint16 is an unsigned integer of 16 bits
	Uint16 = MustCreateNumberType(sqltypes.Uint16)
	// Int24 is an integer of 24 bits.
	Int24 = MustCreateNumberType(sqltypes.Int24)
	// Uint24 is an unsigned integer of 24 bits.
	Uint24 = MustCreateNumberType(sqltypes.Uint24)
	// Int32 is an integer of 32 bits.
	Int32 = MustCreateNumberType(sqltypes.Int32)
	// Uint32 is an unsigned integer of 32 bits.
	Uint32 = MustCreateNumberType(sqltypes.Uint32)
	// Int64 is an integer of 64 bytes.
	Int64 = MustCreateNumberType(sqltypes.Int64)
	// Uint64 is an unsigned integer of 64 bits.
	Uint64 = MustCreateNumberType(sqltypes.Uint64)
	// Float32 is a floating point number of 32 bits.
	Float32 = MustCreateNumberType(sqltypes.Float32)
	// Float64 is a floating point number of 64 bits.
	Float64 = MustCreateNumberType(sqltypes.Float64)
)
View Source
var (
	ErrConvertingToSet   = errors.NewKind("value %v is not valid for this set")
	ErrDuplicateEntrySet = errors.NewKind("duplicate entry: %v")
	ErrInvalidSetValue   = errors.NewKind("value %v was not found in the set")
	ErrTooLargeForSet    = errors.NewKind(`value "%v" is too large for this set`)
)
View Source
var (
	// ErrLengthTooLarge is thrown when a string's length is too large given the other parameters.
	ErrLengthTooLarge    = errors.NewKind("length is %v but max allowed is %v")
	ErrLengthBeyondLimit = errors.NewKind("string is too large for column")
	ErrBinaryCollation   = errors.NewKind("binary types must have the binary collation")

	TinyText   = MustCreateStringWithDefaults(sqltypes.Text, tinyTextBlobMax/Collation_Default.CharacterSet().MaxLength())
	Text       = MustCreateStringWithDefaults(sqltypes.Text, textBlobMax/Collation_Default.CharacterSet().MaxLength())
	MediumText = MustCreateStringWithDefaults(sqltypes.Text, mediumTextBlobMax/Collation_Default.CharacterSet().MaxLength())
	LongText   = MustCreateStringWithDefaults(sqltypes.Text, longTextBlobMax)
	TinyBlob   = MustCreateBinary(sqltypes.Blob, tinyTextBlobMax)
	Blob       = MustCreateBinary(sqltypes.Blob, textBlobMax)
	MediumBlob = MustCreateBinary(sqltypes.Blob, mediumTextBlobMax)
	LongBlob   = MustCreateBinary(sqltypes.Blob, longTextBlobMax)
)
View Source
var (
	// ErrNodeNotWritten is returned when the children are printed before the node.
	ErrNodeNotWritten = errors.New("treeprinter: a child was written before the node")
	// ErrNodeAlreadyWritten is returned when the node has already been written.
	ErrNodeAlreadyWritten = errors.New("treeprinter: node already written")
	// ErrChildrenAlreadyWritten is returned when the children have already been written.
	ErrChildrenAlreadyWritten = errors.New("treeprinter: children already written")
)
View Source
var (
	// ErrNotTuple is returned when the value is not a tuple.
	ErrNotTuple = errors.NewKind("value of type %T is not a tuple")

	// ErrInvalidColumnNumber is returned when a tuple has an invalid number of
	// arguments.
	ErrInvalidColumnNumber = errors.NewKind("tuple should contain %d column(s), but has %d")

	ErrInvalidBaseType = errors.NewKind("%v is not a valid %v base type")

	// ErrNotArray is returned when the value is not an array.
	ErrNotArray = errors.NewKind("value of type %T is not an array")

	// ErrConvertToSQL is returned when Convert failed.
	// It makes an error less verbose comparing to what spf13/cast returns.
	ErrConvertToSQL = errors.NewKind("incompatible conversion to SQL type: %s")
)
View Source
var CollationToMySQLVals = map[string]mysqlCollationRow{}/* 272 elements not displayed */
View Source
var Collations = map[string]Collation{}
View Source
var ErrCharacterSetNotSupported = errors.NewKind("Unknown character set: %v")
View Source
var ErrCollationNotSupported = errors.NewKind("Unknown collation: %v")
View Source
var ErrConvertingToJSON = errors.NewKind("value %v is not valid JSON")
View Source
var ErrKeyNotFound = errors.NewKind("memory: key %d not found in cache")

ErrKeyNotFound is returned when the key could not be found in the cache.

View Source
var ErrLockDoesNotExist = errors.NewKind("Lock '%s' does not exist.")

ErrLockDoesNotExist is the kind of error returned when a named lock does not exist and the operation does not created it

View Source
var ErrLockNotOwned = errors.NewKind("Operation '%s' failed as the lock '%s' has a different owner.")

ErrLockNotOwned is the kind of error returned when attempting an operation against a lock that the given context does not own.

View Source
var ErrLockTimeout = errors.NewKind("Timeout acquiring lock '%s'.")

ErrLockTimeout is the kind of error returned when acquiring a lock takes longer than the user specified timeout

View Source
var ErrNoAutoIncrementCol = fmt.Errorf("this table has no AUTO_INCREMENT columns")
View Source
var ErrNoMemoryAvailable = errors.NewKind("no memory available")

ErrNoMemoryAvailable is returned when there is no more available memory.

View Source
var ErrNotGenerator = errors.NewKind("cannot convert value of type %T to a generator")

ErrNotGenerator is returned when the value cannot be converted to a generator.

View Source
var ErrUnableSort = errors.NewKind("unable to sort")

ErrUnableSort is thrown when something happens on sorting

View Source
var (
	// ErrUnexpectedType is thrown when a received type is not the expected
	ErrUnexpectedType = errors.NewKind("value at %d has unexpected type: %s")
)
View Source
var OkResultColumnType = Int64

OkResultColumnType should be used as the schema column type for Nodes that return an OkResult

View Source
var OkResultSchema = Schema{
	{
		Name: OkResultColumnName,
		Type: OkResultColumnType,
	},
}

OkResultSchema should be used as the schema of Nodes that return an OkResult

View Source
var SupportedCharsets = []CharacterSet{
	CharacterSet_utf8mb4,
}
View Source
var SupportedEngines = []Engine{
	{Name: "InnoDB", /* contains filtered or unexported fields */},
}
View Source
var SystemVariables = &globalSystemVariables{&sync.RWMutex{}, make(map[string]interface{})}

SystemVariables is the collection of system variables for this process.

Functions

func AreComparable

func AreComparable(types ...Type) bool

AreComparable returns whether the given types are either the same or similar enough that values can meaningfully be compared across all permutations. Int8 and Int64 are comparable types, where as VarChar and Int64 are not. In the case of the latter example, not all possible values of a VarChar are comparable to an Int64, while this is true for the former example.

func CastSQLError

func CastSQLError(err error) (*mysql.SQLError, bool)

func ConvertToBool

func ConvertToBool(v interface{}) (bool, error)

func DBTableIter

func DBTableIter(ctx *Context, db Database, cb func(Table) (cont bool, err error)) error

DBTableIter iterates over all tables returned by db.GetTableNames() calling cb for each one until all tables have been processed, or an error is returned from the callback, or the cont flag is false when returned from the callback.

func DebugString

func DebugString(nodeOrExpression interface{}) string

DebugString returns a debug string for the Node or Expression given.

func Dispose

func Dispose(i interface{})

func ErrIfMismatchedColumns

func ErrIfMismatchedColumns(t1, t2 Type) error

ErrIfMismatchedColumns returns an operand error if the number of columns in t1 is not equal to the number of columns in t2. If the number of columns is equal, and both types are tuple types, it recurses into each subtype, asserting that those subtypes are structurally identical as well.

func ErrIfMismatchedColumnsInTuple

func ErrIfMismatchedColumnsInTuple(t1, t2 Type) error

ErrIfMismatchedColumnsInTuple returns an operand error is t2 is not a tuple type whose subtypes are structurally identical to t1.

func EvaluateCondition

func EvaluateCondition(ctx *Context, cond Expression, row Row) (interface{}, error)

EvaluateCondition evaluates a condition, which is an expression whose value will be nil or coerced boolean.

func FormatRow

func FormatRow(row Row) string

FormatRow returns a formatted string representing this row's values

func GetTableNameInsensitive

func GetTableNameInsensitive(tblName string, tableNames []string) (string, bool)

GetTableNameInsensitive implements a case insensitive search of a slice of table names. It looks for exact matches first. If no exact matches are found then any table matching the name case insensitively should be returned. If there is more than one table that matches a case insensitive comparison the resolution strategy is not defined.

func HasAvailableMemory

func HasAvailableMemory(r Reporter) bool

HasAvailableMemory reports whether more memory is available to the program if it hasn't reached the max memory limit.

func HasDefaultValue

func HasDefaultValue(ctx *Context, s Session, key string) (bool, interface{})

HasDefaultValue checks if session variable value is the default one.

func HashOf

func HashOf(v Row) (uint64, error)

HashOf returns a hash of the given value to be used as key in a cache.

func Inspect

func Inspect(expr Expression, f func(expr Expression) bool)

Inspect traverses the plan in depth-first order: It starts by calling f(expr); expr must not be nil. If f returns true, Inspect invokes f recursively for each of the children of expr, followed by a call of f(nil).

func IsArray

func IsArray(t Type) bool

IsArray returns whether the given type is an array.

func IsBlob

func IsBlob(t Type) bool

IsBlob checks if t is BINARY, VARBINARY, or BLOB

func IsDecimal

func IsDecimal(t Type) bool

IsDecimal checks if t is a DECIMAL type.

func IsFalse

func IsFalse(val interface{}) bool

IsFalse coerces EvaluateCondition interface{} response to boolean

func IsFloat

func IsFloat(t Type) bool

IsFloat checks if t is float type.

func IsInteger

func IsInteger(t Type) bool

IsInteger checks if t is an integer type.

func IsJSON

func IsJSON(t Type) bool

func IsKeyless

func IsKeyless(s Schema) bool

func IsNull

func IsNull(ex Expression) bool

IsNull returns true if expression is nil or is Null Type, otherwise false.

func IsNumber

func IsNumber(t Type) bool

IsNumber checks if t is a number type

func IsOkResult

func IsOkResult(row Row) bool

IsOkResult returns whether the given row represents an OkResult.

func IsOkResultSchema

func IsOkResultSchema(schema Schema) bool

func IsSigned

func IsSigned(t Type) bool

IsSigned checks if t is a signed type.

func IsText

func IsText(t Type) bool

IsText checks if t is a text type.

func IsTextBlob

func IsTextBlob(t Type) bool

IsTextBlob checks if t is one of the TEXTs or BLOBs.

func IsTextOnly

func IsTextOnly(t Type) bool

IsTextOnly checks if t is CHAR, VARCHAR, or one of the TEXTs.

func IsTime

func IsTime(t Type) bool

IsTime checks if t is a timestamp, date or datetime

func IsTrue

func IsTrue(val interface{}) bool

IsTrue coerces EvaluateCondition interface{} response to boolean

func IsTuple

func IsTuple(t Type) bool

IsTuple checks if t is a tuple type. Note that tupleType instances with just 1 value are not considered as a tuple, but a parenthesized value.

func IsUnsigned

func IsUnsigned(t Type) bool

IsUnsigned checks if t is an unsigned type.

func MustConvert

func MustConvert(val interface{}, err error) interface{}

func NewMapCache

func NewMapCache() mapCache

func NewUniqueKeyErr

func NewUniqueKeyErr(keyStr string, isPK bool, existing Row) error

func NumColumns

func NumColumns(t Type) int

NumColumns returns the number of columns in a type. This is one for all types, except tuples.

func NumericUnaryValue

func NumericUnaryValue(t Type) interface{}

func RunWithNowFunc

func RunWithNowFunc(nowFunc func() time.Time, fn func() error) error

func TypesEqual

func TypesEqual(a, b Type) bool

TypesEqual compares two Types and returns whether they are equivalent.

func ValidateTime

func ValidateTime(t time.Time) interface{}

ValidateTime receives a time and returns either that time or nil if it's not a valid time.

func Walk

func Walk(v Visitor, expr Expression)

Walk traverses the expression tree in depth-first order. It starts by calling v.Visit(expr); expr must not be nil. If the visitor returned by v.Visit(expr) is not nil, Walk is invoked recursively with the returned visitor for each children of the expr, followed by a call of v.Visit(nil) to the returned visitor.

func WalkWithNode

func WalkWithNode(v NodeVisitor, n Node, expr Expression)

WalkWithNode traverses the expression tree in depth-first order. It starts by calling v.Visit(node, expr); expr must not be nil. If the visitor returned by v.Visit(node, expr) is not nil, Walk is invoked recursively with the returned visitor for each children of the expr, followed by a call of v.Visit(nil, nil) to the returned visitor.

Types

type Aggregation

type Aggregation interface {
	Expression
	// NewBuffer creates a new aggregation buffer and returns it as a Row.
	NewBuffer() (AggregationBuffer, error)
}

Aggregation implements an aggregation expression, where an aggregation buffer is created for each grouping (NewBuffer). Rows for the grouping should be fed to the buffer with |Update| and the buffer should be eval'd with |Eval|. Calling |Eval| directly on an Aggregation expression is typically an error.

type AggregationBuffer

type AggregationBuffer interface {
	Disposable

	// Eval the given buffer.
	Eval(*Context) (interface{}, error)
	// Update the given buffer with the given row.
	Update(ctx *Context, row Row) error
}

type AlterableTable

type AlterableTable interface {
	Table
	// AddColumn adds a column to this table as given. If non-nil, order specifies where in the schema to add the column.
	AddColumn(ctx *Context, column *Column, order *ColumnOrder) error
	// DropColumn drops the column with the name given.
	DropColumn(ctx *Context, columnName string) error
	// ModifyColumn modifies the column with the name given, replacing with the new column definition provided (which may
	// include a name change). If non-nil, order specifies where in the schema to move the column.
	ModifyColumn(ctx *Context, columnName string, column *Column, order *ColumnOrder) error
}

AlterableTable should be implemented by tables that can receive ALTER TABLE statements to modify their schemas.

type AscendIndex

type AscendIndex interface {
	// AscendGreaterOrEqual returns an IndexLookup for keys that are greater
	// or equal to the given keys.
	AscendGreaterOrEqual(keys ...interface{}) (IndexLookup, error)
	// AscendLessThan returns an IndexLookup for keys that are less than the
	// given keys.
	AscendLessThan(keys ...interface{}) (IndexLookup, error)
	// AscendRange returns an IndexLookup for keys that are within the given
	// range.
	AscendRange(greaterOrEqual, lessThan []interface{}) (IndexLookup, error)
}

AscendIndex is an index that is sorted in ascending order.

type AutoIncrementSetter

type AutoIncrementSetter interface {
	// SetAutoIncrementValue sets a new AUTO_INCREMENT value.
	SetAutoIncrementValue(*Context, interface{}) error
	// Close finalizes the set operation, persisting the result.
	Closer
}

AutoIncrementSetter provides support for altering a table's AUTO_INCREMENT sequence, eg 'ALTER TABLE t AUTO_INCREMENT = 10;'

type AutoIncrementTable

type AutoIncrementTable interface {
	Table
	// PeekNextAutoIncrementValue returns the expected next AUTO_INCREMENT value but does not require
	// implementations to update their state.
	PeekNextAutoIncrementValue(*Context) (interface{}, error)
	// GetNextAutoIncrementValue gets the next AUTO_INCREMENT value. In the case that a table with an autoincrement
	// column is passed in a row with the autoinc column failed, the next auto increment value must
	// update its internal state accordingly and use the insert val at runtime.
	//Implementations are responsible for updating their state to provide the correct values.
	GetNextAutoIncrementValue(ctx *Context, insertVal interface{}) (interface{}, error)
	// AutoIncrementSetter returns an AutoIncrementSetter.
	AutoIncrementSetter(*Context) AutoIncrementSetter
}

AutoIncrementTable is a table that supports AUTO_INCREMENT. Getter and Setter methods access the table's AUTO_INCREMENT sequence. These methods should only be used for tables with and AUTO_INCREMENT column in their schema.

type BaseSession

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

BaseSession is the basic session type.

func (*BaseSession) AddLock

func (s *BaseSession) AddLock(lockName string) error

AddLock adds a lock to the set of locks owned by this user which will need to be released if this session terminates

func (*BaseSession) Address

func (s *BaseSession) Address() string

Address returns the server address.

func (*BaseSession) ClearWarnings

func (s *BaseSession) ClearWarnings()

ClearWarnings cleans up session warnings

func (*BaseSession) Client

func (s *BaseSession) Client() Client

Client returns session's client information.

func (*BaseSession) CommitTransaction

func (s *BaseSession) CommitTransaction(*Context, string, Transaction) error

CommitTransaction commits the current transaction for the current database.

func (*BaseSession) DelLock

func (s *BaseSession) DelLock(lockName string) error

DelLock removes a lock from the set of locks owned by this user

func (*BaseSession) GetAllSessionVariables

func (s *BaseSession) GetAllSessionVariables() map[string]interface{}

GetAllSessionVariables implements the Session interface.

func (*BaseSession) GetCurrentDatabase

func (s *BaseSession) GetCurrentDatabase() string

GetCurrentDatabase gets the current database for this session

func (*BaseSession) GetIgnoreAutoCommit

func (s *BaseSession) GetIgnoreAutoCommit() bool

func (*BaseSession) GetIndexRegistry

func (s *BaseSession) GetIndexRegistry() *IndexRegistry

func (*BaseSession) GetLastQueryInfo

func (s *BaseSession) GetLastQueryInfo(key string) int64

func (*BaseSession) GetLogger

func (s *BaseSession) GetLogger() *logrus.Entry

func (*BaseSession) GetQueriedDatabase

func (s *BaseSession) GetQueriedDatabase() string

GetQueriedDatabase implements the Session interface.

func (*BaseSession) GetSessionVariable

func (s *BaseSession) GetSessionVariable(ctx *Context, sysVarName string) (interface{}, error)

GetSessionVariable implements the Session interface.

func (*BaseSession) GetTransaction

func (s *BaseSession) GetTransaction() Transaction

func (*BaseSession) GetUserVariable

func (s *BaseSession) GetUserVariable(ctx *Context, varName string) (Type, interface{}, error)

GetUserVariable implements the Session interface.

func (*BaseSession) GetViewRegistry

func (s *BaseSession) GetViewRegistry() *ViewRegistry

func (*BaseSession) ID

func (s *BaseSession) ID() uint32

ID implements the Session interface.

func (*BaseSession) IterLocks

func (s *BaseSession) IterLocks(cb func(name string) error) error

IterLocks iterates through all locks owned by this user

func (*BaseSession) SetCurrentDatabase

func (s *BaseSession) SetCurrentDatabase(dbName string)

SetCurrentDatabase sets the current database for this session

func (*BaseSession) SetIgnoreAutoCommit

func (s *BaseSession) SetIgnoreAutoCommit(ignore bool)

func (*BaseSession) SetIndexRegistry

func (s *BaseSession) SetIndexRegistry(reg *IndexRegistry)

func (*BaseSession) SetLastQueryInfo

func (s *BaseSession) SetLastQueryInfo(key string, value int64)

func (*BaseSession) SetLogger

func (s *BaseSession) SetLogger(logger *logrus.Entry)

func (*BaseSession) SetQueriedDatabase

func (s *BaseSession) SetQueriedDatabase(dbName string)

SetQueriedDatabase implements the Session interface.

func (*BaseSession) SetSessionVariable

func (s *BaseSession) SetSessionVariable(ctx *Context, sysVarName string, value interface{}) error

SetSessionVariable implements the Session interface.

func (*BaseSession) SetTransaction

func (s *BaseSession) SetTransaction(tx Transaction)

func (*BaseSession) SetUserVariable

func (s *BaseSession) SetUserVariable(ctx *Context, varName string, value interface{}) error

SetUserVariable implements the Session interface.

func (*BaseSession) SetViewRegistry

func (s *BaseSession) SetViewRegistry(reg *ViewRegistry)

func (*BaseSession) Warn

func (s *BaseSession) Warn(warn *Warning)

Warn stores the warning in the session.

func (*BaseSession) WarningCount

func (s *BaseSession) WarningCount() uint16

WarningCount returns a number of session warnings

func (*BaseSession) Warnings

func (s *BaseSession) Warnings() []*Warning

Warnings returns a copy of session warnings (from the most recent - the last one) The function implements sql.Session interface

type BitType

type BitType interface {
	Type
	NumberOfBits() uint8
}

Represents the BIT type. https://dev.mysql.com/doc/refman/8.0/en/bit-type.html

func CreateBitType

func CreateBitType(numOfBits uint8) (BitType, error)

CreateBitType creates a BitType.

func MustCreateBitType

func MustCreateBitType(numOfBits uint8) BitType

MustCreateBitType is the same as CreateBitType except it panics on errors.

type Catalog

type Catalog interface {
	// AllDatabases returns all databases known to this catalog
	AllDatabases() []Database

	// HasDB returns whether a db with the name given exists, case-insensitive
	HasDB(db string) bool

	// Database returns the database with the name given, case-insensitive, or an error if it doesn't exist
	Database(db string) (Database, error)

	// CreateDatabase creates a new database, or returns an error if the operation isn't supported or fails.
	CreateDatabase(ctx *Context, dbName string) error

	// RemoveDatabase removes the  database named, or returns an error if the operation isn't supported or fails.
	RemoveDatabase(ctx *Context, dbName string) error

	// Table returns the table with the name given in the db with the name given
	Table(ctx *Context, dbName, tableName string) (Table, Database, error)

	// TableAsOf returns the table with the name given in the db with the name given, as of the given marker
	TableAsOf(ctx *Context, dbName, tableName string, asOf interface{}) (Table, Database, error)

	// Function returns the function with the name given, or sql.ErrFunctionNotFound if it doesn't exist
	Function(name string) (Function, error)

	// RegisterFunction registers the functions given, adding them to the built-in functions.
	// Integrators with custom functions should typically use the FunctionProvider interface to register their functions.
	RegisterFunction(fns ...Function)

	// LockTable locks the table named
	LockTable(ctx *Context, table string)

	// UnlockTables unlocks all tables locked by the session id given
	UnlockTables(ctx *Context, id uint32) error
}

type CharacterSet

type CharacterSet string

CharacterSet represents the character set of a string.

const (
	CharacterSet_armscii8 CharacterSet = "armscii8"
	CharacterSet_ascii    CharacterSet = "ascii"
	CharacterSet_big5     CharacterSet = "big5"
	CharacterSet_binary   CharacterSet = "binary"
	CharacterSet_cp1250   CharacterSet = "cp1250"
	CharacterSet_cp1251   CharacterSet = "cp1251"
	CharacterSet_cp1256   CharacterSet = "cp1256"
	CharacterSet_cp1257   CharacterSet = "cp1257"
	CharacterSet_cp850    CharacterSet = "cp850"
	CharacterSet_cp852    CharacterSet = "cp852"
	CharacterSet_cp866    CharacterSet = "cp866"
	CharacterSet_cp932    CharacterSet = "cp932"
	CharacterSet_dec8     CharacterSet = "dec8"
	CharacterSet_eucjpms  CharacterSet = "eucjpms"
	CharacterSet_euckr    CharacterSet = "euckr"
	CharacterSet_gb18030  CharacterSet = "gb18030"
	CharacterSet_gb2312   CharacterSet = "gb2312"
	CharacterSet_gbk      CharacterSet = "gbk"
	CharacterSet_geostd8  CharacterSet = "geostd8"
	CharacterSet_greek    CharacterSet = "greek"
	CharacterSet_hebrew   CharacterSet = "hebrew"
	CharacterSet_hp8      CharacterSet = "hp8"
	CharacterSet_keybcs2  CharacterSet = "keybcs2"
	CharacterSet_koi8r    CharacterSet = "koi8r"
	CharacterSet_koi8u    CharacterSet = "koi8u"
	CharacterSet_latin1   CharacterSet = "latin1"
	CharacterSet_latin2   CharacterSet = "latin2"
	CharacterSet_latin5   CharacterSet = "latin5"
	CharacterSet_latin7   CharacterSet = "latin7"
	CharacterSet_macce    CharacterSet = "macce"
	CharacterSet_macroman CharacterSet = "macroman"
	CharacterSet_sjis     CharacterSet = "sjis"
	CharacterSet_swe7     CharacterSet = "swe7"
	CharacterSet_tis620   CharacterSet = "tis620"
	CharacterSet_ucs2     CharacterSet = "ucs2"
	CharacterSet_ujis     CharacterSet = "ujis"
	CharacterSet_utf16    CharacterSet = "utf16"
	CharacterSet_utf16le  CharacterSet = "utf16le"
	CharacterSet_utf32    CharacterSet = "utf32"
	CharacterSet_utf8                  = CharacterSet_utf8mb3
	CharacterSet_utf8mb3  CharacterSet = "utf8mb3"
	CharacterSet_utf8mb4  CharacterSet = "utf8mb4"
)

Character sets and collations were obtained from a fresh install of MySQL 8.0.17. The character sets were obtained by running `SHOW CHARACTER SET;`. The collations were obtained by running `SHOW COLLATION;`. utf8mb3 is not listed from the above commands, and was obtained from: https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-sets.html

func ParseCharacterSet

func ParseCharacterSet(str string) (CharacterSet, error)

ParseCharacterSet takes in a string representing a CharacterSet and returns the result if a match is found, or an error if not.

func (CharacterSet) BinaryCollation

func (cs CharacterSet) BinaryCollation() Collation

func (CharacterSet) DefaultCollation

func (cs CharacterSet) DefaultCollation() Collation

DefaultCollation returns the default Collation for this CharacterSet.

func (CharacterSet) Description

func (cs CharacterSet) Description() string

Description returns the plain-English description for the CharacterSet.

func (CharacterSet) MaxLength

func (cs CharacterSet) MaxLength() int64

MaxLength returns the maximum size of a single character in the CharacterSet.

func (CharacterSet) String

func (cs CharacterSet) String() string

String returns the string representation of the CharacterSet.

type CheckAlterableTable

type CheckAlterableTable interface {
	Table
	// CreateCheck creates an check constraint for this table, using the provided parameters.
	// Returns an error if the constraint name already exists.
	CreateCheck(ctx *Context, check *CheckDefinition) error
	// DropCheck removes a check constraint from the database.
	DropCheck(ctx *Context, chName string) error
}

CheckAlterableTable represents a table that supports check constraints.

type CheckConstraint

type CheckConstraint struct {
	Name     string
	Expr     Expression
	Enforced bool
}

CheckConstraint declares a boolean-eval constraint.

func (CheckConstraint) DebugString

func (c CheckConstraint) DebugString() string

type CheckConstraints

type CheckConstraints []*CheckConstraint

func (CheckConstraints) FromExpressions

func (checks CheckConstraints) FromExpressions(exprs []Expression) (CheckConstraints, error)

FromExpressions takes a slice of sql.Expression in the same order as these constraints, and returns a new slice of constraints with the expressions given, holding names and other properties constant.

func (CheckConstraints) ToExpressions

func (checks CheckConstraints) ToExpressions() []Expression

ToExpressions returns the check expressions in these constrains as a slice of sql.Expression

type CheckDefinition

type CheckDefinition struct {
	Name            string // The name of this check. Check names in a database are unique.
	CheckExpression string // String serialization of the check expression
	Enforced        bool   // Whether this constraint is enforced
}

CheckDefinition defines a trigger. Integrators are not expected to parse or understand the trigger definitions, but must store and return them when asked.

type CheckTable

type CheckTable interface {
	Table
	// GetChecks returns the check constraints on this table.
	GetChecks(ctx *Context) ([]CheckDefinition, error)
}

CheckTable is a table that can declare its check constraints.

type Checksumable

type Checksumable interface {
	// Checksum returns a checksum and an error if there was any problem
	// computing or obtaining the checksum.
	Checksum() (string, error)
}

Checksumable provides the checksum of some data.

type Client

type Client struct {
	// User of the session.
	User string
	// Address of the client.
	Address string
	// Capabilities of the client
	Capabilities uint32
}

Client holds session user information.

type Closer

type Closer interface {
	Close(*Context) error
}

type Collation

type Collation struct {
	Name        string
	CharSet     CharacterSet
	Compare     func(as, bs string) int
	LikeMatcher func(likeStr string) (regex.DisposableMatcher, error)
}

Collation represents the collation of a string.

func ParseCollation

func ParseCollation(characterSetStr *string, collationStr *string, binaryAttribute bool) (Collation, error)

ParseCollation takes in an optional character set and collation, along with the binary attribute if present, and returns a valid collation or error. A nil character set and collation will return the default collation.

func (Collation) CharacterSet

func (c Collation) CharacterSet() CharacterSet

CharacterSet returns the CharacterSet belonging to this Collation.

func (Collation) Equals

func (c Collation) Equals(other Collation) bool

Equals returns true if two collations are equal, false otherwise

func (Collation) ID

func (c Collation) ID() int64

ID returns the id of the Collation.

func (Collation) IsCompiled

func (c Collation) IsCompiled() string

IsCompiled returns string specifying id collation is compiled.

func (Collation) IsDefault

func (c Collation) IsDefault() string

IsDefault returns string specifying id collation is default.

func (Collation) PadSpace

func (c Collation) PadSpace() string

PadSpace returns pad space of the collation.

func (Collation) SortLen

func (c Collation) SortLen() int64

SortLen returns sort len of the collation.

func (Collation) String

func (c Collation) String() string

String returns the string representation of the Collation.

func (Collation) WorksWithCharacterSet

func (c Collation) WorksWithCharacterSet(cs CharacterSet) bool

WorksWithCharacterSet returns whether the Collation is valid for the given CharacterSet.

type Column

type Column struct {
	// Name is the name of the column.
	Name string
	// Type is the data type of the column.
	Type Type
	// Default contains the default value of the column or nil if it was not explicitly defined. A nil instance is valid, thus calls do not error.
	Default *ColumnDefaultValue
	// AutoIncrement is true if the column auto-increments.
	AutoIncrement bool
	// Nullable is true if the column can contain NULL values, or false
	// otherwise.
	Nullable bool
	// Source is the name of the table this column came from.
	Source string
	// PrimaryKey is true if the column is part of the primary key for its table.
	PrimaryKey bool
	// Comment contains the string comment for this column.
	Comment string
	// Extra contains any additional information to put in the `extra` column under `information_schema.columns`.
	Extra string
}

Column is the definition of a table column. As SQL:2016 puts it:

A column is a named component of a table. It has a data type, a default,
and a nullability characteristic.

func (*Column) Check

func (c *Column) Check(v interface{}) bool

Check ensures the value is correct for this column.

func (*Column) DebugString

func (c *Column) DebugString() string

func (*Column) Equals

func (c *Column) Equals(c2 *Column) bool

Equals checks whether two columns are equal.

type ColumnDefaultValue

type ColumnDefaultValue struct {
	Expression // the expression representing this default value
	// contains filtered or unexported fields
}

ColumnDefaultValue is an expression representing the default value of a column. May represent both a default literal and a default expression. A nil pointer of this type represents an implicit default value and is thus valid, so all method calls will return without error.

func NewColumnDefaultValue

func NewColumnDefaultValue(expr Expression, outType Type, representsLiteral bool, mayReturnNil bool) (*ColumnDefaultValue, error)

NewColumnDefaultValue returns a new ColumnDefaultValue expression.

func (*ColumnDefaultValue) Children

func (e *ColumnDefaultValue) Children() []Expression

Children implements sql.Expression

func (*ColumnDefaultValue) Eval

func (e *ColumnDefaultValue) Eval(ctx *Context, r Row) (interface{}, error)

Eval implements sql.Expression

func (*ColumnDefaultValue) IsLiteral

func (e *ColumnDefaultValue) IsLiteral() bool

IsLiteral returns whether this expression represents a literal default value (otherwise it's an expression default value).

func (*ColumnDefaultValue) IsNullable

func (e *ColumnDefaultValue) IsNullable() bool

IsNullable implements sql.Expression

func (*ColumnDefaultValue) Resolved

func (e *ColumnDefaultValue) Resolved() bool

Resolved implements sql.Expression

func (*ColumnDefaultValue) String

func (e *ColumnDefaultValue) String() string

String implements sql.Expression

func (*ColumnDefaultValue) Type

func (e *ColumnDefaultValue) Type() Type

Type implements sql.Expression

func (*ColumnDefaultValue) WithChildren

func (e *ColumnDefaultValue) WithChildren(children ...Expression) (Expression, error)

WithChildren implements sql.Expression

func (*ColumnDefaultValue) WithType

func (e *ColumnDefaultValue) WithType(outType Type) (*ColumnDefaultValue, error)

WithType returns a new default value that converts all resulting values from the internal expression into the given type. If the internal expression results in a value that cannot be converted to the given type, then an error is returned.

type ColumnOrder

type ColumnOrder struct {
	First       bool   // True if this column should come first
	AfterColumn string // Set to the name of the column after which this column should appear
}

ColumnOrder is used in ALTER TABLE statements to change the order of inserted / modified columns.

type CommentedNode

type CommentedNode interface {
	Node
	WithComment(string) Node
	Comment() string
}

CommentedNode allows comments to be set and retrieved on it

type Context

type Context struct {
	context.Context
	Session
	Memory      *MemoryManager
	ProcessList ProcessList
	// contains filtered or unexported fields
}

Context of the query execution.

func NewContext

func NewContext(
	ctx context.Context,
	opts ...ContextOption,
) *Context

NewContext creates a new query context. Options can be passed to configure the context. If some aspect of the context is not configure, the default value will be used. By default, the context will have an empty base session, a noop tracer and a memory manager using the process reporter.

func NewEmptyContext

func NewEmptyContext() *Context

NewEmptyContext returns a default context with default values.

func (*Context) ApplyOpts

func (c *Context) ApplyOpts(opts ...ContextOption)

Applys the options given to the context. Mostly for tests, not safe for use after construction of the context.

func (*Context) Error

func (c *Context) Error(code int, msg string, args ...interface{})

Error adds an error as warning to the session.

func (*Context) NewErrgroup

func (c *Context) NewErrgroup() (*errgroup.Group, *Context)

func (*Context) NewSubContext

func (c *Context) NewSubContext() (*Context, context.CancelFunc)

NewSubContext creates a new sub-context with the current context as parent. Returns the resulting context.CancelFunc as well as the new *sql.Context, which be used to cancel the new context before the parent is finished.

func (*Context) Pid

func (c *Context) Pid() uint64

Pid returns the process id associated with this context.

func (*Context) Query

func (c *Context) Query() string

Query returns the query string associated with this context.

func (*Context) QueryTime

func (c *Context) QueryTime() time.Time

QueryTime returns the time.Time when the context associated with this query was created

func (*Context) RootSpan

func (c *Context) RootSpan() opentracing.Span

RootSpan returns the root span, if any.

func (*Context) Span

func (c *Context) Span(
	opName string,
	opts ...opentracing.StartSpanOption,
) (opentracing.Span, *Context)

Span creates a new tracing span with the given context. It will return the span and a new context that should be passed to all children of this span.

func (*Context) Warn

func (c *Context) Warn(code int, msg string, args ...interface{})

Warn adds a warning to the session.

func (*Context) WithContext

func (c *Context) WithContext(ctx context.Context) *Context

WithContext returns a new context with the given underlying context.

func (*Context) WithCurrentDB

func (c *Context) WithCurrentDB(db string) *Context

type ContextOption

type ContextOption func(*Context)

ContextOption is a function to configure the context.

func WithMemoryManager

func WithMemoryManager(m *MemoryManager) ContextOption

WithMemoryManager adds the given memory manager to the context.

func WithPid

func WithPid(pid uint64) ContextOption

WithPid adds the given pid to the context.

func WithProcessList

func WithProcessList(p ProcessList) ContextOption

func WithQuery

func WithQuery(q string) ContextOption

WithQuery adds the given query to the context.

func WithRootSpan

func WithRootSpan(s opentracing.Span) ContextOption

WithRootSpan sets the root span of the context.

func WithSession

func WithSession(s Session) ContextOption

WithSession adds the given session to the context.

func WithTracer

func WithTracer(t opentracing.Tracer) ContextOption

WithTracer adds the given tracer to the context.

type CreateFunc0Args

type CreateFunc0Args func() Expression

type CreateFunc1Args

type CreateFunc1Args func(e1 Expression) Expression

type CreateFunc2Args

type CreateFunc2Args func(e1, e2 Expression) Expression

type CreateFunc3Args

type CreateFunc3Args func(e1, e2, e3 Expression) Expression

type CreateFunc4Args

type CreateFunc4Args func(e1, e2, e3, e4 Expression) Expression

type CreateFunc5Args

type CreateFunc5Args func(e1, e2, e3, e4, e5 Expression) Expression

type CreateFunc6Args

type CreateFunc6Args func(e1, e2, e3, e4, e5, e6 Expression) Expression

type CreateFunc7Args

type CreateFunc7Args func(e1, e2, e3, e4, e5, e6, e7 Expression) Expression

type CreateFuncNArgs

type CreateFuncNArgs func(args ...Expression) (Expression, error)

type Database

type Database interface {
	Nameable

	// GetTableInsensitive retrieves a table by its case insensitive name.  Implementations should look for exact
	// (case-sensitive matches) first.  If no exact matches are found then any table matching the name case insensitively
	// should be returned.  If there is more than one table that matches a case insensitive comparison the resolution
	// strategy is not defined.
	GetTableInsensitive(ctx *Context, tblName string) (Table, bool, error)

	// GetTableNames returns the table names of every table in the database. It does not return the names of temporary
	// tables
	GetTableNames(ctx *Context) ([]string, error)
}

Database represents the database.

type DatabaseProvider

type DatabaseProvider interface {
	// Database gets a Database from the provider.
	Database(name string) (Database, error)

	// HasDatabase checks if the Database exists in the provider.
	HasDatabase(name string) bool

	// AllDatabases returns a slice of all Databases in the provider.
	AllDatabases() []Database
}

DatabaseProvider is a collection of Database.

func NewDatabaseProvider

func NewDatabaseProvider(dbs ...Database) DatabaseProvider

type Databaser

type Databaser interface {
	// Database the current database.
	Database() Database
	// WithDatabase returns a new node instance with the database replaced with
	// the one given as parameter.
	WithDatabase(Database) (Node, error)
}

Databaser is a node that contains a reference to a database.

type DatetimeType

type DatetimeType interface {
	Type
	ConvertWithoutRangeCheck(v interface{}) (time.Time, error)
	MaximumTime() time.Time
	MinimumTime() time.Time
}

Represents DATE, DATETIME, and TIMESTAMP. https://dev.mysql.com/doc/refman/8.0/en/datetime.html

func CreateDatetimeType

func CreateDatetimeType(baseType query.Type) (DatetimeType, error)

CreateDatetimeType creates a Type dealing with all temporal types that are not TIME nor YEAR.

func MustCreateDatetimeType

func MustCreateDatetimeType(baseType query.Type) DatetimeType

MustCreateDatetimeType is the same as CreateDatetimeType except it panics on errors.

type DebugStringer

type DebugStringer interface {
	// DebugString prints a debug string of the node in question.
	DebugString() string
}

DebugStringer is shared by implementors of Node and Expression, and is used for debugging the analyzer. It allows a node or expression to be printed in greater detail than its default String() representation.

type DecimalType

type DecimalType interface {
	Type
	ConvertToDecimal(v interface{}) (decimal.NullDecimal, error)
	ExclusiveUpperBound() decimal.Decimal
	MaximumScale() uint8
	Precision() uint8
	Scale() uint8
}

func CreateDecimalType

func CreateDecimalType(precision uint8, scale uint8) (DecimalType, error)

CreateDecimalType creates a DecimalType.

func MustCreateDecimalType

func MustCreateDecimalType(precision uint8, scale uint8) DecimalType

MustCreateDecimalType is the same as CreateDecimalType except it panics on errors.

type DeletableTable

type DeletableTable interface {
	Table
	// Deleter returns a RowDeleter for this table. The RowDeleter will get one call to Delete for each row to be deleted,
	// and will end with a call to Close() to finalize the delete operation.
	Deleter(*Context) RowDeleter
}

DeleteableTable is a table that can process the deletion of rows

type DescendIndex

type DescendIndex interface {
	// DescendGreater returns an IndexLookup for keys that are greater
	// than the given keys.
	DescendGreater(keys ...interface{}) (IndexLookup, error)
	// DescendLessOrEqual returns an IndexLookup for keys that are less than or
	// equal to the given keys.
	DescendLessOrEqual(keys ...interface{}) (IndexLookup, error)
	// DescendRange returns an IndexLookup for keys that are within the given
	// range.
	DescendRange(lessOrEqual, greaterThan []interface{}) (IndexLookup, error)
}

DescendIndex is an index that is sorted in descending order.

type Disposable

type Disposable interface {
	// Dispose the contents.
	Dispose()
}

Disposable objects can erase all their content when they're no longer in use. Expressions and Nodes that implement Disposable will have Dispose called on them as a final stage of query execution. This can be used to clean up cached memory that wouldn't get caught via the normal garbage collection process.

type DisposeFunc

type DisposeFunc func()

DisposeFunc is a function to completely erase a cache and remove it from the manager.

type DriverIndex

type DriverIndex interface {
	Index
	// Driver ID of the index.
	Driver() string
}

An indexed managed by a driver, as opposed to natively by a DB table.

type DriverIndexLookup

type DriverIndexLookup interface {
	IndexLookup

	// Values returns the values in the subset of the index. These are used to populate the index via the driver.
	Values(Partition) (IndexValueIter, error)

	// Indexes returns the IDs of all indexes involved in this lookup.
	Indexes() []string
}

DriverIndexLookup is a subset of an index. More specific interfaces can be implemented to grant more capabilities to the index lookup.

type DriverIndexableTable

type DriverIndexableTable interface {
	IndexAddressableTable
	// IndexKeyValues returns an iterator over partitions and ultimately the rows of the table to compute the value of an
	// index for every row in this table. Used when creating an index for access through an IndexDriver.
	IndexKeyValues(*Context, []string) (PartitionIndexKeyValueIter, error)
}

DriverIndexableTable represents a table that supports being indexed and receiving indexes to be able to speed up its execution.

type EmptyProcessList

type EmptyProcessList struct{}

EmptyProcessList is a no-op implementation of ProcessList suitable for use in tests or other installations that don't require a process list

func (EmptyProcessList) AddPartitionProgress

func (e EmptyProcessList) AddPartitionProgress(pid uint64, tableName, partitionName string, total int64)

func (EmptyProcessList) AddProcess

func (e EmptyProcessList) AddProcess(ctx *Context, query string) (*Context, error)

func (EmptyProcessList) AddTableProgress

func (e EmptyProcessList) AddTableProgress(pid uint64, name string, total int64)

func (EmptyProcessList) Done

func (e EmptyProcessList) Done(pid uint64)

func (EmptyProcessList) Kill

func (e EmptyProcessList) Kill(connID uint32)

func (EmptyProcessList) Processes

func (e EmptyProcessList) Processes() []Process

func (EmptyProcessList) RemovePartitionProgress

func (e EmptyProcessList) RemovePartitionProgress(pid uint64, tableName, partitionName string)

func (EmptyProcessList) RemoveTableProgress

func (e EmptyProcessList) RemoveTableProgress(pid uint64, name string)

func (EmptyProcessList) UpdatePartitionProgress

func (e EmptyProcessList) UpdatePartitionProgress(pid uint64, tableName, partitionName string, delta int64)

func (EmptyProcessList) UpdateTableProgress

func (e EmptyProcessList) UpdateTableProgress(pid uint64, name string, delta int64)

type Engine

type Engine struct {
	Name string
	// contains filtered or unexported fields
}

Engine represents a sql engine.

func (Engine) Comment

func (e Engine) Comment() string

Comment returns a brief description of the storage engine.

func (Engine) Savepoints

func (e Engine) Savepoints() string

Savepoints returns whether the storage engine supports savepoints.

func (Engine) String

func (e Engine) String() string

String returns the string representation of the Engine.

func (Engine) Support

func (e Engine) Support() string

Support returns the server's level of support for the storage engine,

func (Engine) Transactions

func (e Engine) Transactions() string

Transactions returns whether the storage engine supports transactions.

func (Engine) XA

func (e Engine) XA() string

XA returns whether the storage engine supports XA transactions.

type EnumType

type EnumType interface {
	Type
	At(index int) (string, bool)
	CharacterSet() CharacterSet
	Collation() Collation
	ConvertToIndex(v interface{}) (int, error)
	IndexOf(v string) int
	//TODO: move this out of go-mysql-server and into the Dolt layer
	Marshal(v interface{}) (int64, error)
	NumberOfElements() uint16
	Unmarshal(v int64) (string, error)
	Values() []string
}

Represents the ENUM type. https://dev.mysql.com/doc/refman/8.0/en/enum.html

func CreateEnumType

func CreateEnumType(values []string, collation Collation) (EnumType, error)

CreateEnumType creates a EnumType.

func MustCreateEnumType

func MustCreateEnumType(values []string, collation Collation) EnumType

MustCreateEnumType is the same as CreateEnumType except it panics on errors.

type Expression

type Expression interface {
	Resolvable
	fmt.Stringer
	// Type returns the expression type.
	Type() Type
	// IsNullable returns whether the expression can be null.
	IsNullable() bool
	// Eval evaluates the given row and returns a result.
	Eval(ctx *Context, row Row) (interface{}, error)
	// Children returns the children expressions of this expression.
	Children() []Expression
	// WithChildren returns a copy of the expression with children replaced.
	// It will return an error if the number of children is different than
	// the current number of children. They must be given in the same order
	// as they are returned by Children.
	WithChildren(children ...Expression) (Expression, error)
}

Expression is a combination of one or more SQL expressions.

func NillaryWithChildren

func NillaryWithChildren(expr Expression, children ...Expression) (Expression, error)

NillaryWithChildren is a common implementation of expression.WithChildren for expressions with no children.

type Expressioner

type Expressioner interface {
	// Expressions returns the list of expressions contained by the node.
	Expressions() []Expression
	// WithExpressions returns a copy of the node with expressions replaced.
	// It will return an error if the number of expressions is different than
	// the current number of expressions. They must be given in the same order
	// as they are returned by Expressions.
	WithExpressions(...Expression) (Node, error)
}

Expressioner is a node that contains expressions.

type FilteredTable

type FilteredTable interface {
	Table
	HandledFilters(filters []Expression) []Expression
	WithFilters(ctx *Context, filters []Expression) Table
}

FilteredTable is a table that can produce a specific RowIter that's more optimized given the filters.

type ForeignKeyAlterableTable

type ForeignKeyAlterableTable interface {
	Table
	// CreateForeignKey creates an index for this table, using the provided parameters.
	// Returns an error if the foreign key name already exists.
	CreateForeignKey(ctx *Context, fkName string, columns []string, referencedTable string, referencedColumns []string,
		onUpdate, onDelete ForeignKeyReferenceOption) error
	// DropForeignKey removes a foreign key from the database.
	DropForeignKey(ctx *Context, fkName string) error
}

ForeignKeyAlterableTable represents a table that supports foreign key modification operations.

type ForeignKeyConstraint

type ForeignKeyConstraint struct {
	Name              string
	Columns           []string
	ReferencedTable   string
	ReferencedColumns []string
	OnUpdate          ForeignKeyReferenceOption
	OnDelete          ForeignKeyReferenceOption
}

ForeignKeyConstraint declares a constraint between the columns of two tables.

func (*ForeignKeyConstraint) DebugString

func (f *ForeignKeyConstraint) DebugString() string

type ForeignKeyReferenceOption

type ForeignKeyReferenceOption string

ForeignKeyReferenceOption is the behavior for this foreign key with the relevant action is performed on the foreign table.

const (
	ForeignKeyReferenceOption_DefaultAction ForeignKeyReferenceOption = "DEFAULT" // No explicit action was specified
	ForeignKeyReferenceOption_Restrict      ForeignKeyReferenceOption = "RESTRICT"
	ForeignKeyReferenceOption_Cascade       ForeignKeyReferenceOption = "CASCADE"
	ForeignKeyReferenceOption_NoAction      ForeignKeyReferenceOption = "NO ACTION"
	ForeignKeyReferenceOption_SetNull       ForeignKeyReferenceOption = "SET NULL"
	ForeignKeyReferenceOption_SetDefault    ForeignKeyReferenceOption = "SET DEFAULT"
)

type ForeignKeyTable

type ForeignKeyTable interface {
	Table
	// GetForeignKeys returns the foreign key constraints on this table.
	GetForeignKeys(ctx *Context) ([]ForeignKeyConstraint, error)
}

ForeignKeyTable is a table that can declare its foreign key constraints.

type Freeable

type Freeable interface {
	// Free the memory.
	Free()
}

Freeable objects can free their memory.

type Function

type Function interface {
	// NewInstance returns a new instance of the function to evaluate against rows
	NewInstance([]Expression) (Expression, error)
	// FunctionName returns the name of this function
	FunctionName() string
	// contains filtered or unexported methods
}

Function is a function defined by the user that can be applied in a SQL query.

type Function0

type Function0 struct {
	Name string
	Fn   CreateFunc0Args
}

Function0 is a function with 0 arguments.

func NewFunction0

func NewFunction0(name string, fn func() Expression) Function0

func (Function0) FunctionName

func (fn Function0) FunctionName() string

func (Function0) NewInstance

func (fn Function0) NewInstance(args []Expression) (Expression, error)

type Function1

type Function1 struct {
	Name string
	Fn   CreateFunc1Args
}

Function1 is a function with 1 argument.

func (Function1) FunctionName

func (fn Function1) FunctionName() string

func (Function1) NewInstance

func (fn Function1) NewInstance(args []Expression) (Expression, error)

type Function2

type Function2 struct {
	Name string
	Fn   CreateFunc2Args
}

Function2 is a function with 2 arguments.

func (Function2) FunctionName

func (fn Function2) FunctionName() string

func (Function2) NewInstance

func (fn Function2) NewInstance(args []Expression) (Expression, error)

type Function3

type Function3 struct {
	Name string
	Fn   CreateFunc3Args
}

Function3 is a function with 3 arguments.

func (Function3) FunctionName

func (fn Function3) FunctionName() string

func (Function3) NewInstance

func (fn Function3) NewInstance(args []Expression) (Expression, error)

type Function4

type Function4 struct {
	Name string
	Fn   CreateFunc4Args
}

Function4 is a function with 4 arguments.

func (Function4) FunctionName

func (fn Function4) FunctionName() string

func (Function4) NewInstance

func (fn Function4) NewInstance(args []Expression) (Expression, error)

type Function5

type Function5 struct {
	Name string
	Fn   CreateFunc5Args
}

Function5 is a function with 5 arguments.

func (Function5) FunctionName

func (fn Function5) FunctionName() string

func (Function5) NewInstance

func (fn Function5) NewInstance(args []Expression) (Expression, error)

type Function6

type Function6 struct {
	Name string
	Fn   CreateFunc6Args
}

Function6 is a function with 6 arguments.

func (Function6) FunctionName

func (fn Function6) FunctionName() string

func (Function6) NewInstance

func (fn Function6) NewInstance(args []Expression) (Expression, error)

type Function7

type Function7 struct {
	Name string
	Fn   CreateFunc7Args
}

Function7 is a function with 7 arguments.

func (Function7) FunctionName

func (fn Function7) FunctionName() string

func (Function7) NewInstance

func (fn Function7) NewInstance(args []Expression) (Expression, error)

type FunctionExpression

type FunctionExpression interface {
	Expression
	FunctionName() string
}

FunctionExpression is an Expression that represents a function.

type FunctionN

type FunctionN struct {
	Name string
	Fn   CreateFuncNArgs
}

FunctionN is a function with variable number of arguments. This function is expected to return ErrInvalidArgumentNumber if the arity does not match, since the check has to be done in the implementation.

func (FunctionN) FunctionName

func (fn FunctionN) FunctionName() string

func (FunctionN) NewInstance

func (fn FunctionN) NewInstance(args []Expression) (Expression, error)

type FunctionProvider

type FunctionProvider interface {
	// Function returns the function with the name provided, case-insensitive
	Function(name string) (Function, error)
}

FunctionProvider is an extension of DatabaseProvider that allows custom functions to be provided

type Generator

type Generator interface {
	// Next value in the generator.
	Next() (interface{}, error)
	// Close the generator and dispose resources.
	Close() error
}

Generator will generate a set of values for a given row.

func NewArrayGenerator

func NewArrayGenerator(array []interface{}) Generator

NewArrayGenerator creates a generator for a given array.

func ToGenerator

func ToGenerator(v interface{}) (Generator, error)

ToGenerator converts a value to a generator if possible.

type Index

type Index interface {
	// Get returns an IndexLookup for the given key in the index.
	Get(key ...interface{}) (IndexLookup, error)
	// Has checks if the given key is present in the index.
	Has(partition Partition, key ...interface{}) (bool, error)
	// ID returns the identifier of the index.
	ID() string
	// Database returns the database name this index belongs to.
	Database() string
	// Table returns the table name this index belongs to.
	Table() string
	// Expressions returns the indexed expressions. If the result is more than
	// one expression, it means the index has multiple columns indexed. If it's
	// just one, it means it may be an expression or a column.
	Expressions() []string
	// IsUnique returns whether this index is unique
	IsUnique() bool
	// Comment returns the comment for this index
	Comment() string
	// IndexType returns the type of this index, e.g. BTREE
	IndexType() string
	// IsGenerated returns whether this index was generated. Generated indexes
	// are used for index access, but are not displayed (such as with SHOW INDEXES).
	IsGenerated() bool
}

Index is the basic representation of an index. It can be extended with more functionality by implementing more specific interfaces.

type IndexAddressableTable

type IndexAddressableTable interface {
	Table
	// WithIndexLookup returns a version of the table that will return only the rows specified by the given IndexLookup,
	// which was in turn created by a call to Index.Get() for a set of keys for this table.
	WithIndexLookup(IndexLookup) Table
}

IndexAddressableTable is a table that can restrict its row iteration to only the rows that match a given index lookup.

type IndexAlterableTable

type IndexAlterableTable interface {
	Table
	// CreateIndex creates an index for this table, using the provided parameters.
	// Returns an error if the index name already exists, or an index with the same columns already exists.
	CreateIndex(ctx *Context, indexName string, using IndexUsing, constraint IndexConstraint, columns []IndexColumn, comment string) error
	// DropIndex removes an index from this table, if it exists.
	// Returns an error if the removal failed or the index does not exist.
	DropIndex(ctx *Context, indexName string) error
	// RenameIndex renames an existing index to another name that is not already taken by another index on this table.
	RenameIndex(ctx *Context, fromIndexName string, toIndexName string) error
}

IndexAlterableTable represents a table that supports index modification operations.

type IndexColumn

type IndexColumn struct {
	Name string
	// Length represents the index prefix length. If zero, then no length was specified.
	Length int64
}

IndexColumn is the column by which to add to an index.

type IndexConstraint

type IndexConstraint byte

IndexConstraint represents any constraints that should be applied to the index.

const (
	IndexConstraint_None IndexConstraint = iota
	IndexConstraint_Unique
	IndexConstraint_Fulltext
	IndexConstraint_Spatial
	IndexConstraint_Primary
)

type IndexDriver

type IndexDriver interface {
	// ID returns the unique name of the driver.
	ID() string
	// Create a new index. If exprs is more than one expression, it means the
	// index has multiple columns indexed. If it's just one, it means it may
	// be an expression or a column.
	Create(db, table, id string, expressions []Expression, config map[string]string) (DriverIndex, error)
	// LoadAll loads all indexes for given db and table.
	LoadAll(ctx *Context, db, table string) ([]DriverIndex, error)
	// Save the given index for all partitions.
	Save(*Context, DriverIndex, PartitionIndexKeyValueIter) error
	// Delete the given index for all partitions in the iterator.
	Delete(DriverIndex, PartitionIter) error
}

IndexDriver manages the coordination between the indexes and their representation on disk.

type IndexKeyValueIter

type IndexKeyValueIter interface {
	// Next returns the next tuple of index key values. The length of the
	// returned slice will be the same as the number of columns used to
	// create this iterator. The second returned parameter is a repo's location.
	Next() ([]interface{}, []byte, error)
	Closer
}

IndexKeyValueIter is an iterator of index key values, that is, a tuple of the values that will be index keys.

type IndexLookup

type IndexLookup interface {
	fmt.Stringer
}

IndexLookup is the implementation-specific definition of an index lookup, created by calls to Index.Get(). The IndexLookup must contain all necessary information to retrieve exactly the rows in the table specified by key(s) specified in Index.Get(). Implementors are responsible for all semantics of correctly returning rows that match an index lookup. By default, only a single index can be used for a given table access. Implementors can implement the Mergeable interface to optionally allow IndexLookups to be merged with others.

type IndexRegistry

type IndexRegistry struct {
	// Root path where all the data of the indexes is stored on disk.
	Root string
	// contains filtered or unexported fields
}

IndexRegistry keeps track of all driver-provided indexes in the engine.

func NewIndexRegistry

func NewIndexRegistry() *IndexRegistry

NewIndexRegistry returns a new Index Registry.

func (*IndexRegistry) AddIndex

func (r *IndexRegistry) AddIndex(
	idx DriverIndex,
) (created chan<- struct{}, ready <-chan struct{}, err error)

AddIndex adds the given index to the registry. The added index will be marked as creating, so nobody can register two indexes with the same expression or id while the other is still being created. When something is sent through the returned channel, it means the index has finished its creation and will be marked as ready. Another channel is returned to notify the user when the index is ready.

func (*IndexRegistry) CanRemoveIndex

func (r *IndexRegistry) CanRemoveIndex(idx Index) bool

CanRemoveIndex returns whether the given index is ready to be removed.

func (*IndexRegistry) CanUseIndex

func (r *IndexRegistry) CanUseIndex(idx Index) bool

CanUseIndex returns whether the given index is ready to use or not.

func (*IndexRegistry) DefaultIndexDriver

func (r *IndexRegistry) DefaultIndexDriver() IndexDriver

DefaultIndexDriver returns the default index driver, which is the only driver when there is 1 driver in the registry. If there are more than 1 drivers in the registry, this will return the empty string, as there is no clear default driver.

func (*IndexRegistry) DeleteIndex

func (r *IndexRegistry) DeleteIndex(db, id string, force bool) (<-chan struct{}, error)

DeleteIndex deletes an index from the registry by its id. First, it marks the index for deletion but does not remove it, so queries that are using it may still do so. The returned channel will send a message when the index can be deleted from disk. If force is true, it will delete the index even if it's not ready for usage. Only use that parameter if you know what you're doing.

func (*IndexRegistry) ExpressionsWithIndexes

func (r *IndexRegistry) ExpressionsWithIndexes(
	db string,
	exprs ...Expression,
) [][]Expression

ExpressionsWithIndexes finds all the combinations of expressions with matching indexes. This only matches multi-column indexes.

func (*IndexRegistry) HasIndexes

func (r *IndexRegistry) HasIndexes() bool

HasIndexes returns whether the index registry has any registered indexes. Not thread safe, so the answer is approximate in the face of drivers and indexes being added and removed.

func (*IndexRegistry) Index

func (r *IndexRegistry) Index(db, id string) DriverIndex

Index returns the index with the given id. It may return nil if the index is not found.

func (*IndexRegistry) IndexByExpression

func (r *IndexRegistry) IndexByExpression(ctx *Context, db string, expr ...Expression) Index

IndexByExpression returns an index by the given expression. It will return nil if the index is not found. If more than one expression is given, all of them must match for the index to be matched.

func (*IndexRegistry) IndexDriver

func (r *IndexRegistry) IndexDriver(id string) IndexDriver

IndexDriver returns the IndexDriver with the given ID.

func (*IndexRegistry) IndexesByTable

func (r *IndexRegistry) IndexesByTable(db, table string) []DriverIndex

IndexesByTable returns a slice of all the indexes existing on the given table.

func (*IndexRegistry) LoadIndexes

func (r *IndexRegistry) LoadIndexes(ctx *Context, dbs []Database) error

LoadIndexes creates load functions for all indexes for all dbs, tables and drivers. These functions are called as needed by the query

func (*IndexRegistry) MarkOutdated

func (r *IndexRegistry) MarkOutdated(idx Index)

MarkOutdated sets the index status as outdated. This method is not thread safe and should not be used directly except for testing.

func (*IndexRegistry) RegisterIndexDriver

func (r *IndexRegistry) RegisterIndexDriver(driver IndexDriver)

RegisterIndexDriver registers a new index driver.

func (*IndexRegistry) ReleaseIndex

func (r *IndexRegistry) ReleaseIndex(idx Index)

ReleaseIndex releases an index after it's been used.

type IndexStatus

type IndexStatus byte

IndexStatus represents the current status in which the index is.

const (
	// IndexNotReady means the index is not ready to be used.
	IndexNotReady IndexStatus = iota
	// IndexReady means the index can be used.
	IndexReady
	// IndexOutdated means the index is loaded but will not be used because the
	// contents in it are outdated.
	IndexOutdated
)

func (IndexStatus) IsUsable

func (s IndexStatus) IsUsable() bool

IsUsable returns whether the index can be used or not based on the status.

func (IndexStatus) String

func (s IndexStatus) String() string

type IndexUsing

type IndexUsing byte

IndexUsing is the desired storage type.

const (
	IndexUsing_Default IndexUsing = iota
	IndexUsing_BTree
	IndexUsing_Hash
)

type IndexValueIter

type IndexValueIter interface {
	// Next returns the next value (repo's location) - see IndexKeyValueIter.
	Next() ([]byte, error)
	Closer
}

IndexValueIter is an iterator of index values.

type IndexedTable

type IndexedTable interface {
	IndexAddressableTable
	// GetIndexes returns all indexes on this table.
	GetIndexes(ctx *Context) ([]Index, error)
}

IndexedTable represents a table that has one or more native indexes on its columns, and can use those indexes to speed up execution of queries that reference those columns. Unlike DriverIndexableTable, IndexedTable doesn't need a separate index driver to function.

type InsertableTable

type InsertableTable interface {
	Table
	// Inserter returns an Inserter for this table. The Inserter will get one call to Insert() for each row to be
	// inserted, and will end with a call to Close() to finalize the insert operation.
	Inserter(*Context) RowInserter
}

InsertableTable is a table that can process insertion of new rows.

type JSONDocument

type JSONDocument struct {
	Val interface{}
}

func MustJSON

func MustJSON(s string) JSONDocument

func (JSONDocument) Compare

func (doc JSONDocument) Compare(ctx *Context, v JSONValue) (int, error)

func (JSONDocument) Contains

func (doc JSONDocument) Contains(ctx *Context, candidate JSONValue) (val interface{}, err error)

Contains returns nil in case of a nil value for either the doc.Val or candidate. Otherwise it returns a bool

func (JSONDocument) Extract

func (doc JSONDocument) Extract(ctx *Context, path string) (JSONValue, error)

func (JSONDocument) Keys

func (doc JSONDocument) Keys(ctx *Context, path string) (val JSONValue, err error)

func (JSONDocument) Overlaps

func (doc JSONDocument) Overlaps(ctx *Context, val SearchableJSONValue) (ok bool, err error)

func (JSONDocument) Search

func (doc JSONDocument) Search(ctx *Context) (path string, err error)

func (JSONDocument) ToString

func (doc JSONDocument) ToString(_ *Context) (string, error)

func (JSONDocument) Unmarshall

func (doc JSONDocument) Unmarshall(_ *Context) (JSONDocument, error)

type JSONValue

type JSONValue interface {
	// Unmarshall converts a JSONValue to a JSONDocument
	Unmarshall(ctx *Context) (val JSONDocument, err error)
	// Compare compares two JSONValues. It maintains the same return value
	// semantics as Type.Compare()
	Compare(ctx *Context, v JSONValue) (cmp int, err error)
	// ToString marshalls a JSONValue to a valid JSON-encoded string.
	ToString(ctx *Context) (string, error)
}

JSONValue is an integrator specific implementation of a JSON field value.

func ConcatenateJSONValues

func ConcatenateJSONValues(ctx *Context, vals ...JSONValue) (JSONValue, error)

type JsonType

type JsonType interface {
	Type
}
var JSON JsonType = jsonType{}

type KeyValueCache

type KeyValueCache interface {
	// Put a new value in the cache.
	Put(uint64, interface{}) error
	// Get the value with the given key.
	Get(uint64) (interface{}, error)
	// Size returns the number of elements in the cache.
	Size() int
}

KeyValueCache is a cache of key value pairs.

type LikeMatcher

type LikeMatcher interface {
	CreateMatcher(likeStr string) (regex.DisposableMatcher, error)
}

type LockState

type LockState int

LockState represents the different states a lock can be in

const (
	// LockDoesNotExist is the state where a lock has never been created
	LockDoesNotExist LockState = iota
	// LockInUse is the state where a lock has been acquired by a user
	LockInUse
	// LockFree is the state where a lock has been created, but is not currently owned by any user
	LockFree
)

type LockSubsystem

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

LockSubsystem manages reentrant named locks

func NewLockSubsystem

func NewLockSubsystem() *LockSubsystem

NewLockSubsystem creates a LockSubsystem object

func (*LockSubsystem) GetLockState

func (ls *LockSubsystem) GetLockState(name string) (state LockState, owner uint32)

GetLockState returns the LockState and owner ID for a lock with a given name.

func (*LockSubsystem) Lock

func (ls *LockSubsystem) Lock(ctx *Context, name string, timeout time.Duration) error

Lock attempts to acquire a lock with a given name for the Id associated with the given ctx.Session within the given timeout

func (*LockSubsystem) ReleaseAll

func (ls *LockSubsystem) ReleaseAll(ctx *Context) (int, error)

ReleaseAll releases all locks the ID associated with the given ctx.Session, and returns the number of locks that were succeessfully released.

func (*LockSubsystem) Unlock

func (ls *LockSubsystem) Unlock(ctx *Context, name string) error

Unlock releases a lock with a given name for the ID associated with the given ctx.Session

type Lockable

type Lockable interface {
	Nameable
	// Lock locks the table either for reads or writes. Any session clients can
	// read while the table is locked for read, but not write.
	// When the table is locked for write, nobody can write except for the
	// session client that requested the lock.
	Lock(ctx *Context, write bool) error
	// Unlock releases the lock for the current session client. It blocks until
	// all reads or writes started during the lock are finished.
	// Context may be nil if the unlock it's because the connection was closed.
	// The id will always be provided, since in some cases context is not
	// available.
	Unlock(ctx *Context, id uint32) error
}

Lockable should be implemented by tables that can be locked and unlocked.

type MemoryManager

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

MemoryManager is in charge of keeping track and managing all the components that operate in memory. There should only be one instance of a memory manager running at the same time in each process.

func NewMemoryManager

func NewMemoryManager(r Reporter) *MemoryManager

NewMemoryManager creates a new manager with the given memory reporter. If nil is given, then the Process reporter will be used by default.

func (*MemoryManager) Free

func (m *MemoryManager) Free()

Free the memory of all freeable caches.

func (*MemoryManager) HasAvailable

func (m *MemoryManager) HasAvailable() bool

HasAvailable reports whether the memory manager has any available memory.

func (*MemoryManager) NewHistoryCache

func (m *MemoryManager) NewHistoryCache() (KeyValueCache, DisposeFunc)

NewHistoryCache returns an empty history cache and a function to dispose it when it's no longer needed.

func (*MemoryManager) NewLRUCache

func (m *MemoryManager) NewLRUCache(size uint) (KeyValueCache, DisposeFunc)

NewLRUCache returns an empty LRU cache and a function to dispose it when it's no longer needed.

func (*MemoryManager) NewRowsCache

func (m *MemoryManager) NewRowsCache() (RowsCache, DisposeFunc)

NewRowsCache returns an empty rows cache and a function to dispose it when it's no longer needed.

func (*MemoryManager) NumCaches

func (m *MemoryManager) NumCaches() int

type MergeableIndexLookup

type MergeableIndexLookup interface {
	IndexLookup
	// IsMergeable checks whether the current IndexLookup can be merged with the given one. If true, then all other
	// methods in the interface are expected to return a new IndexLookup that represents the given set operation of the
	// two operands.
	IsMergeable(IndexLookup) bool
	// Intersection returns a new IndexLookup with the intersection of the current IndexLookup and the ones given.
	Intersection(...IndexLookup) (IndexLookup, error)
	// Union returns a new IndexLookup with the union of the current IndexLookup and the ones given.
	Union(...IndexLookup) (IndexLookup, error)
}

MergeableIndexLookup is a specialization of IndexLookup that allows IndexLookups to be merged together. This allows multiple indexes to be used for a single table access, if the implementor can support it via merging the lookups of the two indexes.

type MutableDatabaseProvider

type MutableDatabaseProvider interface {
	DatabaseProvider

	// CreateDatabase creates a database and adds it to the provider's collection.
	CreateDatabase(ctx *Context, name string) error

	// DropDatabase removes a database from the provider's collection.
	DropDatabase(ctx *Context, name string) error
}

type Nameable

type Nameable interface {
	// Name returns the name.
	Name() string
}

Nameable is something that has a name.

type NegateIndex

type NegateIndex interface {
	// Not returns an IndexLookup for keys that are not equal
	// to the given keys.
	Not(keys ...interface{}) (IndexLookup, error)
}

NegateIndex is an index that supports retrieving negated values.

type Node

type Node interface {
	Resolvable
	fmt.Stringer
	// Schema of the node.
	Schema() Schema
	// Children nodes.
	Children() []Node
	// RowIter produces a row iterator from this node. The current row being evaluated is provided, as well the context
	// of the query.
	RowIter(ctx *Context, row Row) (RowIter, error)
	// WithChildren returns a copy of the node with children replaced.
	// It will return an error if the number of children is different than
	// the current number of children. They must be given in the same order
	// as they are returned by Children.
	WithChildren(...Node) (Node, error)
}

Node is a node in the execution plan tree.

type NodeVisitor

type NodeVisitor interface {
	// Visit method is invoked for each expr encountered by Walk. If the result Visitor is not nil, Walk visits each of
	// the children of the expr with that visitor, followed by a call of Visit(nil, nil) to the returned visitor.
	Visit(node Node, expression Expression) NodeVisitor
}

NodeVisitor visits expressions in an expression tree. Like Visitor, but with the added context of the node in which an expression is embedded. See WalkExpressionsWithNode in the plan package.

type NonDeterministicExpression

type NonDeterministicExpression interface {
	Expression
	// IsNonDeterministic returns whether this expression returns a non-deterministic result. An expression is
	// non-deterministic if it can return different results on subsequent evaluations.
	IsNonDeterministic() bool
}

NonDeterministicExpression allows a way for expressions to declare that they are non-deterministic, which will signal the engine to not cache their results when this would otherwise appear to be safe.

type NullOrdering

type NullOrdering byte

NullOrdering represents how to order based on null values.

const (
	// NullsFirst puts the null values before any other values.
	NullsFirst NullOrdering = iota
	// NullsLast puts the null values after all other values.
	NullsLast NullOrdering = 2
)

type NullType

type NullType interface {
	Type
}
var (
	Null NullType = nullType{}

	// ErrValueNotNil is thrown when a value that was expected to be nil, is not
	ErrValueNotNil = errors.NewKind("value not nil: %#v")
)

type NumberType

type NumberType interface {
	Type
	IsSigned() bool
	IsFloat() bool
}

Represents all integer and floating point types. https://dev.mysql.com/doc/refman/8.0/en/integer-types.html https://dev.mysql.com/doc/refman/8.0/en/floating-point-types.html

func CreateNumberType

func CreateNumberType(baseType query.Type) (NumberType, error)

CreateNumberType creates a NumberType.

func MustCreateNumberType

func MustCreateNumberType(baseType query.Type) NumberType

MustCreateNumberType is the same as CreateNumberType except it panics on errors.

type OkResult

type OkResult struct {
	RowsAffected uint64       // Number of rows affected by this operation
	InsertID     uint64       // Inserted ID, if any, or -1 if not
	Info         fmt.Stringer // Human-readable status string for extra status info, echoed verbatim to clients.
}

OkResult is a representation of the OK packet MySQL sends for non-select queries such as UPDATE, INSERT, etc. It can be returned as the only element in the row for a Node that doesn't select anything. See https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html

func GetOkResult

func GetOkResult(row Row) OkResult

GetOkResult extracts the OkResult from the row given

func NewOkResult

func NewOkResult(rowsAffected int) OkResult

NewOkResult returns a new OkResult with the given number of rows affected.

type OpaqueNode

type OpaqueNode interface {
	Node
	// Opaque reports whether the node is opaque or not.
	Opaque() bool
}

OpaqueNode is a node that doesn't allow transformations to its children and acts a a black box.

type Partition

type Partition interface {
	Key() []byte
}

Partition represents a partition from a SQL table.

type PartitionCounter

type PartitionCounter interface {
	// PartitionCount returns the number of partitions.
	PartitionCount(*Context) (int64, error)
}

PartitionCounter can return the number of partitions.

type PartitionIndexKeyValueIter

type PartitionIndexKeyValueIter interface {
	// Next returns the next partition and the IndexKeyValueIter for that
	// partition.
	Next() (Partition, IndexKeyValueIter, error)
	Closer
}

PartitionIndexKeyValueIter is an iterator of partitions that will return the partition and the IndexKeyValueIter of that partition.

type PartitionIter

type PartitionIter interface {
	Closer
	Next() (Partition, error)
}

PartitionIter is an iterator that retrieves partitions.

type PartitionProgress

type PartitionProgress struct {
	Progress
}

PartitionProgress keeps track of a partition progress

func (PartitionProgress) String

func (p PartitionProgress) String() string

type PrimaryKeyAlterableTable

type PrimaryKeyAlterableTable interface {
	Table
	// CreatePrimaryKey creates a primary key for this table, using the provided parameters.
	// Returns an error if the new primary key set is not compatible with the current table data.
	CreatePrimaryKey(ctx *Context, columns []IndexColumn) error
	// DropPrimaryKey drops a primary key on a table. Returns an error if that table does not have a key.
	DropPrimaryKey(ctx *Context) error
}

PrimaryKeyAlterableTable represents a table that supports primary key changes.

type Process

type Process struct {
	Pid        uint64
	Connection uint32
	User       string
	Query      string
	Progress   map[string]TableProgress
	StartedAt  time.Time
	Kill       context.CancelFunc
}

Process represents a process in the SQL server.

func (*Process) Done

func (p *Process) Done()

Done needs to be called when this process has finished.

func (*Process) Seconds

func (p *Process) Seconds() uint64

Seconds returns the number of seconds this process has been running.

type ProcessList

type ProcessList interface {
	// Processes returns the list of current running processes
	Processes() []Process

	// AddProcess adds a new process to the list and returns a new context that can be used to cancel it
	AddProcess(ctx *Context, query string) (*Context, error)

	// Kill terminates all queries for a given connection id
	Kill(connID uint32)

	// Done removes the finished process with the given pid from the process list
	Done(pid uint64)

	// UpdateTableProgress updates the progress of the table with the given name for the
	// process with the given pid.
	UpdateTableProgress(pid uint64, name string, delta int64)

	// UpdatePartitionProgress updates the progress of the table partition with the
	// given name for the process with the given pid.
	UpdatePartitionProgress(pid uint64, tableName, partitionName string, delta int64)

	// AddTableProgress adds a new item to track progress from to the process with
	// the given pid. If the pid does not exist, it will do nothing.
	AddTableProgress(pid uint64, name string, total int64)

	// AddPartitionProgress adds a new item to track progress from to the process with
	// the given pid. If the pid or the table does not exist, it will do nothing.
	AddPartitionProgress(pid uint64, tableName, partitionName string, total int64)

	// RemoveTableProgress removes an existing item tracking progress from the
	// process with the given pid, if it exists.
	RemoveTableProgress(pid uint64, name string)

	// RemovePartitionProgress removes an existing partition tracking progress from the
	// process with the given pid, if it exists.
	RemovePartitionProgress(pid uint64, tableName, partitionName string)
}

type Progress

type Progress struct {
	Name  string
	Done  int64
	Total int64
}

Progress between done items and total items

type ProjectedTable

type ProjectedTable interface {
	Table
	WithProjection(colNames []string) Table
}

ProjectedTable is a table that can produce a specific RowIter that's more optimized given the columns that are projected.

type ReadOnlyDatabase

type ReadOnlyDatabase interface {
	Database

	// IsReadOnly returns whether this database is read-only.
	IsReadOnly() bool
}

type ReplaceableTable

type ReplaceableTable interface {
	Table
	// Replacer returns a RowReplacer for this table. The RowReplacer will have Insert and optionally Delete called once
	// for each row, followed by a call to Close() when all rows have been processed.
	Replacer(ctx *Context) RowReplacer
}

Replacer allows rows to be replaced through a Delete (if applicable) then Insert.

type Reporter

type Reporter interface {
	// MaxMemory returns the maximum number of memory allowed in bytes.
	MaxMemory() uint64
	// UsedMemory returns the memory in use in bytes.
	UsedMemory() uint64
}

Reporter is a component that gives information about the memory usage.

var ProcessMemory Reporter = new(processReporter)

ProcessMemory is a reporter for the memory used by the process and the maximum amount of memory allowed controlled by the MAX_MEMORY environment variable.

type Resolvable

type Resolvable interface {
	// Resolved returns whether the node is resolved.
	Resolved() bool
}

Resolvable is something that can be resolved or not.

type Row

type Row []interface{}

Row is a tuple of values.

func NewRow

func NewRow(values ...interface{}) Row

NewRow creates a row from the given values.

func NodeToRows

func NodeToRows(ctx *Context, n Node) ([]Row, error)

NodeToRows converts a node to a slice of rows.

func RowIterToRows

func RowIterToRows(ctx *Context, i RowIter) ([]Row, error)

RowIterToRows converts a row iterator to a slice of rows.

func (Row) Append

func (r Row) Append(r2 Row) Row

Append appends all the values in r2 to this row and returns the result

func (Row) Copy

func (r Row) Copy() Row

Copy creates a new row with the same values as the current one.

func (Row) Equals

func (r Row) Equals(row Row, schema Schema) (bool, error)

Equals checks whether two rows are equal given a schema.

type RowDeleter

type RowDeleter interface {
	TableEditor
	// Delete deletes the given row. Returns ErrDeleteRowNotFound if the row was not found. Delete will be called once for
	// each row to process for the delete operation, which may involve many rows. After all rows have been processed,
	// Close is called.
	Delete(*Context, Row) error
	// Close finalizes the delete operation, persisting the result.
	Closer
}

RowDeleter is a delete cursor that can delete one or more rows from a table.

type RowInserter

type RowInserter interface {
	TableEditor
	// Insert inserts the row given, returning an error if it cannot. Insert will be called once for each row to process
	// for the insert operation, which may involve many rows. After all rows in an operation have been processed, Close
	// is called.
	Insert(*Context, Row) error
	// Close finalizes the insert operation, persisting its result.
	Closer
}

RowInserter is an insert cursor that can insert one or more values to a table.

type RowIter

type RowIter interface {
	// Next retrieves the next row. It will return io.EOF if it's the last row.
	// After retrieving the last row, Close will be automatically closed.
	Next() (Row, error)
	Closer
}

RowIter is an iterator that produces rows.

func NewSpanIter

func NewSpanIter(span opentracing.Span, iter RowIter) RowIter

NewSpanIter creates a RowIter executed in the given span. Currently inactive, returns the iter returned unaltered.

func RowsToRowIter

func RowsToRowIter(rows ...Row) RowIter

RowsToRowIter creates a RowIter that iterates over the given rows.

type RowReplacer

type RowReplacer interface {
	TableEditor
	// Insert inserts the row given, returning an error if it cannot. Insert will be called once for each row to process
	// for the replace operation, which may involve many rows. After all rows in an operation have been processed, Close
	// is called.
	Insert(*Context, Row) error
	// Delete deletes the given row. Returns ErrDeleteRowNotFound if the row was not found. Delete will be called once for
	// each row to process for the delete operation, which may involve many rows. After all rows have been processed,
	// Close is called.
	Delete(*Context, Row) error
	// Close finalizes the replace operation, persisting the result.
	Closer
}

RowReplacer is a combination of RowDeleter and RowInserter. TODO: We can't embed those interfaces because go 1.13 doesn't allow for overlapping interfaces (they both declare

Close). Go 1.14 fixes this problem, but we aren't ready to drop support for 1.13 yet.

type RowUpdater

type RowUpdater interface {
	TableEditor
	// Update the given row. Provides both the old and new rows.
	Update(ctx *Context, old Row, new Row) error
	// Close finalizes the update operation, persisting the result.
	Closer
}

RowUpdater is an update cursor that can update one or more rows in a table.

type RowsCache

type RowsCache interface {
	// Add a new row to the cache. If there is no memory available, it will try to
	// free some memory. If after that there is still no memory available, it
	// will return an error and erase all the content of the cache.
	Add(Row) error
	// Get all rows.
	Get() []Row
}

RowsCache is a cache of rows.

type Schema

type Schema []*Column

Schema is the definition of a table.

func (Schema) CheckRow

func (s Schema) CheckRow(row Row) error

CheckRow checks the row conforms to the schema.

func (Schema) Contains

func (s Schema) Contains(column string, source string) bool

Contains returns whether the schema contains a column with the given name.

func (Schema) Equals

func (s Schema) Equals(s2 Schema) bool

Equals checks whether the given schema is equal to this one.

func (Schema) HasAutoIncrement

func (s Schema) HasAutoIncrement() bool

HasAutoIncrement returns true if the schema has an auto increment column.

func (Schema) IndexOf

func (s Schema) IndexOf(column, source string) int

IndexOf returns the index of the given column in the schema or -1 if it's not present.

type SearchableJSONValue

type SearchableJSONValue interface {
	JSONValue

	// Contains is value-specific implementation of JSON_Contains()
	Contains(ctx *Context, candidate JSONValue) (val interface{}, err error)
	// Extract is value-specific implementation of JSON_Extract()
	Extract(ctx *Context, path string) (val JSONValue, err error)
	// Keys is value-specific implementation of JSON_Keys()
	Keys(ctx *Context, path string) (val JSONValue, err error)
	// Overlaps is value-specific implementation of JSON_Overlaps()
	Overlaps(ctx *Context, val SearchableJSONValue) (ok bool, err error)
	// Search is value-specific implementation of JSON_Search()
	Search(ctx *Context) (path string, err error)
}

SearchableJSONValue is JSONValue supporting in-place access operations. The query engine can utilize these optimized access methods improve performance by minimizing the need to unmarshall a JSONValue into a JSONDocument.

type Session

type Session interface {
	// Address of the server.
	Address() string
	// Client returns the user of the session.
	Client() Client
	// SetSessionVariable sets the given system variable to the value given for this session.
	SetSessionVariable(ctx *Context, sysVarName string, value interface{}) error
	// SetUserVariable sets the given user variable to the value given for this session, or creates it for this session.
	SetUserVariable(ctx *Context, varName string, value interface{}) error
	// GetSessionVariable returns this session's value of the system variable with the given name.
	GetSessionVariable(ctx *Context, sysVarName string) (interface{}, error)
	// GetUserVariable returns this session's value of the user variable with the given name, along with its most
	// appropriate type.
	GetUserVariable(ctx *Context, varName string) (Type, interface{}, error)
	// GetAllSessionVariables returns a copy of all session variable values.
	GetAllSessionVariables() map[string]interface{}
	// GetCurrentDatabase gets the current database for this session
	GetCurrentDatabase() string
	// SetCurrentDatabase sets the current database for this session
	SetCurrentDatabase(dbName string)
	// CommitTransaction commits the current transaction for this session for the current database
	CommitTransaction(ctx *Context, dbName string, transaction Transaction) error
	// ID returns the unique ID of the connection.
	ID() uint32
	// Warn stores the warning in the session.
	Warn(warn *Warning)
	// Warnings returns a copy of session warnings (from the most recent).
	Warnings() []*Warning
	// ClearWarnings cleans up session warnings.
	ClearWarnings()
	// WarningCount returns a number of session warnings
	WarningCount() uint16
	// AddLock adds a lock to the set of locks owned by this user which will need to be released if this session terminates
	AddLock(lockName string) error
	// DelLock removes a lock from the set of locks owned by this user
	DelLock(lockName string) error
	// IterLocks iterates through all locks owned by this user
	IterLocks(cb func(name string) error) error
	// SetLastQueryInfo sets session-level query info for the key given, applying to the query just executed.
	SetLastQueryInfo(key string, value int64)
	// GetLastQueryInfo returns the session-level query info for the key given, for the query most recently executed.
	GetLastQueryInfo(key string) int64
	// GetTransaction returns the active transaction, if any
	GetTransaction() Transaction
	// SetTransaction sets the session's transaction
	SetTransaction(tx Transaction)
	// SetIgnoreAutoCommit instructs the session to ignore the value of the @@autocommit variable, or consider it again
	SetIgnoreAutoCommit(ignore bool)
	// GetIgnoreAutoCommit returns whether this session should ignore the @@autocommit variable
	GetIgnoreAutoCommit() bool
	// GetLogger returns the logger for this session, useful if clients want to log messages with the same format / output
	// as the running server. Clients should instantiate their own global logger with formatting options, and session
	// implementations should return the logger to be used for the running server.
	GetLogger() *logrus.Entry
	// SetLogger sets the logger to use for this session, which will always be an extension of the one returned by
	// GetLogger, extended with session information
	SetLogger(*logrus.Entry)
	// GetIndexRegistry returns the index registry for this session
	GetIndexRegistry() *IndexRegistry
	// GetViewRegistry returns the view registry for this session
	GetViewRegistry() *ViewRegistry
	// SetIndexRegistry sets the index registry for this session. Integrators should set an index registry in the event
	// they are using an index driver.
	SetIndexRegistry(*IndexRegistry)
	// SetViewRegistry sets the view registry for this session. Integrators should set a view registry if their database
	// doesn't implement ViewDatabase and they want views created to persist across sessions.
	SetViewRegistry(*ViewRegistry)
}

Session holds the session data.

func NewBaseSession

func NewBaseSession() Session

NewBaseSession creates a new empty session.

func NewSession

func NewSession(server string, client Client, id uint32) Session

NewSession creates a new session with data.

type SetType

type SetType interface {
	Type
	CharacterSet() CharacterSet
	Collation() Collation
	//TODO: move this out of go-mysql-server and into the Dolt layer
	Marshal(v interface{}) (uint64, error)
	NumberOfElements() uint16
	Unmarshal(bits uint64) (string, error)
	Values() []string
}

Represents the SET type. https://dev.mysql.com/doc/refman/8.0/en/set.html

func CreateSetType

func CreateSetType(values []string, collation Collation) (SetType, error)

CreateSetType creates a SetType.

func MustCreateSetType

func MustCreateSetType(values []string, collation Collation) SetType

MustCreateSetType is the same as CreateSetType except it panics on errors.

type SortField

type SortField struct {
	// Column to order by.
	Column Expression
	// Order type.
	Order SortOrder
	// NullOrdering defining how nulls will be ordered.
	NullOrdering NullOrdering
}

SortField is a field by which a query will be sorted.

func (SortField) DebugString

func (s SortField) DebugString() string

func (SortField) String

func (s SortField) String() string

type SortFields

type SortFields []SortField

func (SortFields) FromExpressions

func (sf SortFields) FromExpressions(exprs []Expression) SortFields

func (SortFields) ToExpressions

func (sf SortFields) ToExpressions() []Expression

type SortOrder

type SortOrder byte

SortOrder represents the order of the sort (ascending or descending).

const (
	// Ascending order.
	Ascending SortOrder = 1
	// Descending order.
	Descending SortOrder = 2
)

func (SortOrder) String

func (s SortOrder) String() string

type StatisticsTable

type StatisticsTable interface {
	Table
	// NumRows returns the unfiltered count of rows contained in the table
	NumRows(*Context) (uint64, error)
	// DataLength returns the length of the data file (varies by engine).
	DataLength(ctx *Context) (uint64, error)
}

StatisticsTable is a table that can provide information about its number of rows and other facts to improve query planning performance.

type StoredProcedureDatabase

type StoredProcedureDatabase interface {
	Database

	// GetStoredProcedures returns all StoredProcedureDetails for the database.
	GetStoredProcedures(ctx *Context) ([]StoredProcedureDetails, error)

	// SaveStoredProcedure stores the given StoredProcedureDetails to the database. The integrator should verify that
	// the name of the new stored procedure is unique amongst existing stored procedures.
	SaveStoredProcedure(ctx *Context, spd StoredProcedureDetails) error

	// DropStoredProcedure removes the StoredProcedureDetails with the matching name from the database.
	DropStoredProcedure(ctx *Context, name string) error
}

StoredProcedureDatabase is a database that supports the creation and execution of stored procedures. The engine will handle all parsing and execution logic for stored procedures. Integrators only need to store and retrieve StoredProcedureDetails, while verifying that all stored procedures have a unique name without regard to case-sensitivity.

type StoredProcedureDetails

type StoredProcedureDetails struct {
	Name            string    // The name of this stored procedure. Names must be unique within a database.
	CreateStatement string    // The CREATE statement for this stored procedure.
	CreatedAt       time.Time // The time that the stored procedure was created.
	ModifiedAt      time.Time // The time of the last modification to the stored procedure.
}

StoredProcedureDetails are the details of the stored procedure. Integrators only need to store and retrieve the given details for a stored procedure, as the engine handles all parsing and processing.

type StringType

type StringType interface {
	Type
	CharacterSet() CharacterSet
	Collation() Collation
	MaxCharacterLength() int64
	MaxByteLength() int64
}

StringType represents all string types, including VARCHAR and BLOB. https://dev.mysql.com/doc/refman/8.0/en/char.html https://dev.mysql.com/doc/refman/8.0/en/binary-varbinary.html https://dev.mysql.com/doc/refman/8.0/en/blob.html

func CreateBinary

func CreateBinary(baseType query.Type, lengthHint int64) (StringType, error)

CreateBinary creates a StringType with a binary collation and character set of the given size.

func CreateLongText

func CreateLongText(collation Collation) StringType

CreateLongText creates a LONGTEXT with the given collation.

func CreateMediumText

func CreateMediumText(collation Collation) StringType

CreateMediumText creates a MEDIUMTEXT with the given collation.

func CreateString

func CreateString(baseType query.Type, length int64, collation Collation) (StringType, error)

CreateString creates a StringType.

func CreateStringWithDefaults

func CreateStringWithDefaults(baseType query.Type, length int64) (StringType, error)

CreateStringWithDefaults creates a StringType with the default character set and collation of the given size.

func CreateText

func CreateText(collation Collation) StringType

CreateText creates a TEXT with the given collation.

func CreateTinyText

func CreateTinyText(collation Collation) StringType

CreateTinyText creates a TINYTEXT with the given collation.

func MustCreateBinary

func MustCreateBinary(baseType query.Type, lengthHint int64) StringType

MustCreateBinary is the same as CreateBinary except it panics on errors.

func MustCreateString

func MustCreateString(baseType query.Type, length int64, collation Collation) StringType

MustCreateString is the same as CreateString except it panics on errors.

func MustCreateStringWithDefaults

func MustCreateStringWithDefaults(baseType query.Type, length int64) StringType

MustCreateStringWithDefaults creates a StringType with the default CharacterSet and Collation.

type SystemVariable

type SystemVariable struct {
	// Name is the name of the system variable.
	Name string
	// Scope defines the scope of the system variable, which is either Global, Session, or Both.
	Scope SystemVariableScope
	// Dynamic defines whether the variable may be written to during runtime. Variables with this set to `false` will
	// return an error if a user attempts to set a value.
	Dynamic bool
	// SetVarHintApplies defines if the variable may be set for a single query using SET_VAR().
	// https://dev.mysql.com/doc/refman/8.0/en/optimizer-hints.html#optimizer-hints-set-var
	SetVarHintApplies bool
	// Type defines the type of the system variable. This may be a special type not accessible to standard MySQL operations.
	Type Type
	// Default defines the default value of the system variable.
	Default interface{}
}

SystemVariable represents a system variable.

type SystemVariableScope

type SystemVariableScope byte

SystemVariableScope represents the scope of a system variable.

const (
	// SystemVariableScope_Global is set when the system variable exists only in the global context.
	SystemVariableScope_Global SystemVariableScope = iota
	// SystemVariableScope_Session is set when the system variable exists only in the session context.
	SystemVariableScope_Session
	// SystemVariableScope_Both is set when the system variable exists in both the global and session contexts.
	SystemVariableScope_Both
)

func (SystemVariableScope) String

func (s SystemVariableScope) String() string

String returns the scope as an uppercase string.

type SystemVariableType

type SystemVariableType interface {
	Type
	// EncodeValue returns the given value as a string for storage.
	EncodeValue(interface{}) (string, error)
	// DecodeValue returns the original value given to EncodeValue from the given string. This is different from `Convert`,
	// as the encoded value may technically be an "illegal" value according to the type rules.
	DecodeValue(string) (interface{}, error)
}

SystemVariableType represents a SQL type specifically (and only) used in system variables. Assigning any non-system variables a SystemVariableType will cause errors.

func NewSystemBoolType

func NewSystemBoolType(varName string) SystemVariableType

NewSystemBoolType returns a new systemBoolType.

func NewSystemDoubleType

func NewSystemDoubleType(varName string, lowerbound, upperbound float64) SystemVariableType

NewSystemDoubleType returns a new systemDoubleType.

func NewSystemEnumType

func NewSystemEnumType(varName string, values ...string) SystemVariableType

NewSystemEnumType returns a new systemEnumType.

func NewSystemIntType

func NewSystemIntType(varName string, lowerbound, upperbound int64, negativeOne bool) SystemVariableType

NewSystemIntType returns a new systemIntType.

func NewSystemSetType

func NewSystemSetType(varName string, values ...string) SystemVariableType

NewSystemSetType returns a new systemSetType.

func NewSystemStringType

func NewSystemStringType(varName string) SystemVariableType

NewSystemStringType returns a new systemStringType.

func NewSystemUintType

func NewSystemUintType(varName string, lowerbound, upperbound uint64) SystemVariableType

NewSystemUintType returns a new systemUintType.

type Table

type Table interface {
	Nameable
	String() string
	Schema() Schema
	Partitions(*Context) (PartitionIter, error)
	PartitionRows(*Context, Partition) (RowIter, error)
}

Table represents the backend of a SQL table.

func GetTableInsensitive

func GetTableInsensitive(tblName string, tables map[string]Table) (Table, bool)

GetTableInsensitive implements a case insensitive map lookup for tables keyed off of the table name. Looks for exact matches first. If no exact matches are found then any table matching the name case insensitively should be returned. If there is more than one table that matches a case insensitive comparison the resolution strategy is not defined.

type TableCopierDatabase

type TableCopierDatabase interface {
	// CopyTableData copies the sourceTable data to the destinationTable and returns the number of rows copied.
	CopyTableData(ctx *Context, sourceTable string, destinationTable string) (uint64, error)
}

TableCopierDatabase is a database that can copy a source table's data (without preserving indexed, fks, etc.) into another destination table.

type TableCreator

type TableCreator interface {
	// Creates the table with the given name and schema. If a table with that name already exists, must return
	// sql.ErrTableAlreadyExists.
	CreateTable(ctx *Context, name string, schema Schema) error
}

TableCreator should be implemented by databases that can create new tables.

type TableDropper

type TableDropper interface {
	DropTable(ctx *Context, name string) error
}

TableDropper should be implemented by databases that can drop tables.

type TableEditor

type TableEditor interface {
	// StatementBegin is called before the first operation of a statement. Integrators should mark the state of the data
	// in some way that it may be returned to in the case of an error.
	StatementBegin(ctx *Context)
	// DiscardChanges is called if a statement encounters an error, and all current changes since the statement beginning
	// should be discarded.
	DiscardChanges(ctx *Context, errorEncountered error) error
	// StatementComplete is called after the last operation of the statement, indicating that it has successfully completed.
	// The mark set in StatementBegin may be removed, and a new one should be created on the next StatementBegin.
	StatementComplete(ctx *Context) error
}

TableEditor is the base interface for sub interfaces that can update rows in a table during an INSERT, REPLACE, UPDATE, or DELETE statement.

type TableProgress

type TableProgress struct {
	Progress
	PartitionsProgress map[string]PartitionProgress
}

TableProgress keeps track of a table progress, and for each of its partitions

func NewTableProgress

func NewTableProgress(name string, total int64) TableProgress

func (TableProgress) String

func (p TableProgress) String() string

type TableRenamer

type TableRenamer interface {
	// Renames a table from oldName to newName as given. If a table with newName already exists, must return
	// sql.ErrTableAlreadyExists.
	RenameTable(ctx *Context, oldName, newName string) error
}

TableRenamer should be implemented by databases that can rename tables.

type TableRowIter

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

TableRowIter is an iterator over the partitions in a table.

func NewTableRowIter

func NewTableRowIter(ctx *Context, table Table, partitions PartitionIter) *TableRowIter

NewTableRowIter returns a new iterator over the rows in the partitions of the table given.

func (*TableRowIter) Close

func (i *TableRowIter) Close(ctx *Context) error

func (*TableRowIter) Next

func (i *TableRowIter) Next() (Row, error)

type TableWrapper

type TableWrapper interface {
	// Underlying returns the underlying table.
	Underlying() Table
}

TableWrapper is a node that wraps the real table. This is needed because wrappers cannot implement some methods the table may implement.

type Tableable

type Tableable interface {
	// Table returns the table name.
	Table() string
}

Tableable is something that has a table.

type TemporaryTable

type TemporaryTable interface {
	IsTemporary() bool
}

type TemporaryTableCreator

type TemporaryTableCreator interface {
	Database
	// Creates the table with the given name and schema. If a temporary table with that name already exists, must
	// return sql.ErrTableAlreadyExists
	CreateTemporaryTable(ctx *Context, name string, schema Schema) error
}

TemporaryTableCreator is a database that can create temporary tables that persist only as long as the session. Note that temporary tables with the same name as persisted tables take precedence in most SQL operations.

type TemporaryTableDatabase

type TemporaryTableDatabase interface {
	GetAllTemporaryTables(ctx *Context) ([]Table, error)
}

TemporaryTableDatabase is a database that can query the session (which manages the temporary table state) to retrieve the name of all temporary tables.

type TimeType

type TimeType interface {
	Type
	ConvertToTimeDuration(v interface{}) (time.Duration, error)
	//TODO: move this out of go-mysql-server and into the Dolt layer
	Marshal(v interface{}) (int64, error)
	Unmarshal(v int64) string
}

Represents the TIME type. https://dev.mysql.com/doc/refman/8.0/en/time.html

var (
	Time TimeType = timespanType{}

	ErrConvertingToTimeType = errors.NewKind("value %v is not a valid Time")
)

type Transaction

type Transaction interface {
	fmt.Stringer
	IsReadOnly() bool
}

Transaction is an opaque type implemented by an integrator to record necessary information at the start of a transaction. Active transactions will be recorded in the session.

type TransactionCharacteristic

type TransactionCharacteristic int
const (
	ReadWrite TransactionCharacteristic = iota
	ReadOnly
)

type TransactionDatabase

type TransactionDatabase interface {
	Database

	// StartTransaction starts a new transaction and returns it
	StartTransaction(ctx *Context, tCharacteristic TransactionCharacteristic) (Transaction, error)

	// CommitTransaction commits the transaction given
	CommitTransaction(ctx *Context, tx Transaction) error

	// Rollback restores the database to the state recorded in the transaction given
	Rollback(ctx *Context, transaction Transaction) error

	// CreateSavepoint records a savepoint for the transaction given with the name given. If the name is already in use
	// for this transaction, the new savepoint replaces the old one.
	CreateSavepoint(ctx *Context, transaction Transaction, name string) error

	// RollbackToSavepoint restores the database to the state named by the savepoint
	RollbackToSavepoint(ctx *Context, transaction Transaction, name string) error

	// ReleaseSavepoint removes the savepoint named from the transaction given
	ReleaseSavepoint(ctx *Context, transaction Transaction, name string) error
}

TransactionDatabase is a Database that can BEGIN, ROLLBACK and COMMIT transactions, as well as create SAVEPOINTS and restore to them.

type TransformExprFunc

type TransformExprFunc func(Expression) (Expression, error)

TransformExprFunc is a function that given an expression will return that expression as is or transformed along with an error, if any.

type TransformNodeFunc

type TransformNodeFunc func(Node) (Node, error)

TransformNodeFunc is a function that given a node will return that node as is or transformed along with an error, if any.

type TreePrinter

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

TreePrinter is a printer for tree nodes.

func NewTreePrinter

func NewTreePrinter() *TreePrinter

NewTreePrinter creates a new tree printer.

func (*TreePrinter) String

func (p *TreePrinter) String() string

String returns the output of the printed tree.

func (*TreePrinter) WriteChildren

func (p *TreePrinter) WriteChildren(children ...string) error

WriteChildren writes a children of the tree.

func (*TreePrinter) WriteNode

func (p *TreePrinter) WriteNode(format string, args ...interface{}) error

WriteNode writes the main node.

type TriggerDatabase

type TriggerDatabase interface {
	Database

	// GetTriggers returns all trigger definitions for the database
	GetTriggers(ctx *Context) ([]TriggerDefinition, error)

	// CreateTrigger is called when an integrator is asked to create a trigger. The create trigger statement string is
	// provided to store, along with the name of the trigger.
	CreateTrigger(ctx *Context, definition TriggerDefinition) error

	// DropTrigger is called when a trigger should no longer be stored. The name has already been validated.
	// Returns ErrTriggerDoesNotExist if the trigger was not found.
	DropTrigger(ctx *Context, name string) error
}

TriggerDatabase is a Database that supports the creation and execution of triggers. The engine handles all parsing and execution logic for triggers. Integrators are not expected to parse or understand the trigger definitions, but must store and return them when asked.

type TriggerDefinition

type TriggerDefinition struct {
	Name            string // The name of this trigger. Trigger names in a database are unique.
	CreateStatement string // The text of the statement to create this trigger.
}

TriggerDefinition defines a trigger. Integrators are not expected to parse or understand the trigger definitions, but must store and return them when asked.

type TruncateableTable

type TruncateableTable interface {
	Table
	// Truncate removes all rows from the table. If the table also implements DeletableTable and it is determined that
	// truncate would be equivalent to a DELETE which spans the entire table, then this function will be called instead.
	// Returns the number of rows that were removed.
	Truncate(*Context) (int, error)
}

TruncateableTable is a table that can process the deletion of all rows.

type Type

type Type interface {
	// Compare returns an integer comparing two values.
	// The result will be 0 if a==b, -1 if a < b, and +1 if a > b.
	Compare(interface{}, interface{}) (int, error)
	// Convert a value of a compatible type to a most accurate type.
	Convert(interface{}) (interface{}, error)
	// Promote will promote the current type to the largest representing type of the same kind, such as Int8 to Int64.
	Promote() Type
	// SQL returns the sqltypes.Value for the given value.
	SQL(interface{}) (sqltypes.Value, error)
	// Type returns the query.Type for the given Type.
	Type() query.Type
	// Zero returns the golang zero value for this type
	Zero() interface{}
	fmt.Stringer
}

Type represents a SQL type.

func ApproximateTypeFromValue

func ApproximateTypeFromValue(val interface{}) Type

ApproximateTypeFromValue returns the closest matching type to the given value. For example, an int16 will return SMALLINT.

func ColumnTypeToType

func ColumnTypeToType(ct *sqlparser.ColumnType) (Type, error)

ColumnTypeToType gets the column type using the column definition.

func CreateArray

func CreateArray(underlying Type) Type

CreateArray returns a new CreateArray type of the given underlying type.

func CreateTuple

func CreateTuple(types ...Type) Type

CreateTuple returns a new tuple type with the given element types.

func UnderlyingType

func UnderlyingType(t Type) Type

UnderlyingType returns the underlying type of an array if the type is an array, or the type itself in any other case.

type TypedValue

type TypedValue struct {
	Typ   Type
	Value interface{}
}

TypedValue is a value along with its type.

type UniqueKeyError

type UniqueKeyError struct {
	IsPK     bool
	Existing Row
	// contains filtered or unexported fields
}

func (UniqueKeyError) Error

func (ue UniqueKeyError) Error() string

type UnresolvedDatabase

type UnresolvedDatabase string

UnresolvedDatabase is a database which has not been resolved yet.

func (UnresolvedDatabase) GetTableInsensitive

func (UnresolvedDatabase) GetTableInsensitive(ctx *Context, tblName string) (Table, bool, error)

func (UnresolvedDatabase) GetTableNames

func (UnresolvedDatabase) GetTableNames(ctx *Context) ([]string, error)

func (UnresolvedDatabase) Name

func (d UnresolvedDatabase) Name() string

Name returns the database name.

func (UnresolvedDatabase) Tables

func (UnresolvedDatabase) Tables() map[string]Table

Tables returns the tables in the database.

type UpdatableTable

type UpdatableTable interface {
	Table
	// Updater returns a RowUpdater for this table. The RowUpdater will have Update called once for each row to be
	// updated, followed by a call to Close() when all rows have been processed.
	Updater(ctx *Context) RowUpdater
}

UpdateableTable is a table that can process updates of existing rows via update statements.

type VersionedDatabase

type VersionedDatabase interface {
	Database

	// GetTableInsensitiveAsOf retrieves a table by its case-insensitive name with the same semantics as
	// Database.GetTableInsensitive, but at a particular revision of the database. Implementors must choose which types
	// of expressions to accept as revision names.
	GetTableInsensitiveAsOf(ctx *Context, tblName string, asOf interface{}) (Table, bool, error)

	// GetTableNamesAsOf returns the table names of every table in the database as of the revision given. Implementors
	// must choose which types of expressions to accept as revision names.
	GetTableNamesAsOf(ctx *Context, asOf interface{}) ([]string, error)
}

VersionedDatabase is a Database that can return tables as they existed at different points in time. The engine supports queries on historical table data via the AS OF construct introduced in SQL 2011.

type View

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

View is the parsed version of ViewDefinition Not meant to be used externally

func NewView

func NewView(name string, definition Node, textDefinition string) *View

NewView creates a View with the specified name and definition.

func (*View) Definition

func (v *View) Definition() Node

Definition returns the definition of the view.

func (*View) Name

func (v *View) Name() string

Name returns the name of the view.

func (*View) TextDefinition

func (v *View) TextDefinition() string

TextDefinition returns the text definition of the view as originally defined.

type ViewDatabase

type ViewDatabase interface {
	// CreateView persists the definition a view with the name and select statement given. If a view with that name
	// already exists, should return ErrExistingView
	CreateView(ctx *Context, name string, selectStatement string) error

	// DropView deletes the view named from persistent storage. If the view doesn't exist, should return
	// ErrViewDoesNotExist
	DropView(ctx *Context, name string) error

	// GetView returns the textual definition of the view with the name given, or false if it doesn't exist.
	GetView(ctx *Context, viewName string) (string, bool, error)

	// AllViews returns the definitions of all views in the database
	AllViews(ctx *Context) ([]ViewDefinition, error)
}

ViewDatabase is implemented by databases that persist view definitions

type ViewDefinition

type ViewDefinition struct {
	Name           string
	TextDefinition string
}

ViewDefinition is the named textual definition of a view

type ViewKey

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

ViewKey is the key used to store view definitions

func NewViewKey

func NewViewKey(databaseName, viewName string) ViewKey

NewViewKey creates a ViewKey ensuring both names are lowercase.

type ViewRegistry

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

ViewRegistry stores session-local views for databases that don't implement view storage. Each session gets a new view registry by default. Integrators that want views to persist across sessions should either implement sql.ViewDatabase, or construct their sessions to reuse the same ViewRegistry for each session.

func NewViewRegistry

func NewViewRegistry() *ViewRegistry

NewViewRegistry creates an empty ViewRegistry.

func (*ViewRegistry) Delete

func (r *ViewRegistry) Delete(databaseName, viewName string) error

Delete deletes the view specified by the pair {databaseName, viewName}, returning an error if it does not exist.

func (*ViewRegistry) Exists

func (r *ViewRegistry) Exists(databaseName, viewName string) bool

Exists returns whether the specified key is already registered

func (*ViewRegistry) Register

func (r *ViewRegistry) Register(database string, view *View) error

Register adds the view specified by the pair {database, view.Name()}, returning an error if there is already an element with that key.

func (*ViewRegistry) View

func (r *ViewRegistry) View(databaseName, viewName string) (*View, error)

View returns a pointer to the view specified by the pair {databaseName, viewName}, returning an error if it does not exist.

func (*ViewRegistry) ViewsInDatabase

func (r *ViewRegistry) ViewsInDatabase(databaseName string) (views []*View)

ViewsInDatabase returns an array of all the views registered under the specified database.

type Visitor

type Visitor interface {
	// Visit method is invoked for each expr encountered by Walk.
	// If the result Visitor is not nil, Walk visits each of the children
	// of the expr with that visitor, followed by a call of Visit(nil)
	// to the returned visitor.
	Visit(expr Expression) Visitor
}

Visitor visits expressions in an expression tree.

type Warning

type Warning struct {
	Level   string
	Message string
	Code    int
}

Warning stands for mySQL warning record.

type Window

type Window struct {
	PartitionBy []Expression
	OrderBy     SortFields
}

A Window specifies the window parameters of a window function

func NewWindow

func NewWindow(partitionBy []Expression, orderBy []SortField) *Window

func (*Window) DebugString

func (w *Window) DebugString() string

func (*Window) FromExpressions

func (w *Window) FromExpressions(children []Expression) (*Window, error)

FromExpressions returns copy of this window with the given expressions taken to stand in for the partition and order by fields. An error is returned if the lengths or types of these expressions are incompatible with this window.

func (*Window) String

func (w *Window) String() string

func (*Window) ToExpressions

func (w *Window) ToExpressions() []Expression

ToExpressions converts the PartitionBy and OrderBy expressions to a single slice of expressions suitable for manipulation by analyzer rules.

type WindowAggregation

type WindowAggregation interface {
	Expression
	// Window returns this expression's window
	Window() *Window
	// WithWindow returns a version of this window aggregation with the window given
	WithWindow(window *Window) (WindowAggregation, error)
	// NewBuffer creates a new buffer and returns it as a Row. This buffer will be provided for all further operations.
	NewBuffer() Row
	// Add updates the aggregation with the input row given. Implementors must keep track of rows added in order so
	// that they can later be retrieved by EvalRow(int)
	Add(ctx *Context, buffer, row Row) error
	// Finish gives aggregations that need to final computation once all rows have been added (like sorting their
	// inputs) a chance to do before iteration begins
	Finish(ctx *Context, buffer Row) error
	// EvalRow returns the value of the expression for the row with the index given
	EvalRow(i int, buffer Row) (interface{}, error)
}

WindowAggregation implements a window aggregation expression. A WindowAggregation is similar to an Aggregation, except that it returns a result row for every input row, as opposed to as single for the entire result set. Every WindowAggregation is expected to track its input rows in the order received, and to return the value for the row index given on demand.

type YearType

type YearType interface {
	Type
}

Represents the YEAR type. https://dev.mysql.com/doc/refman/8.0/en/year.html

var (
	Year YearType = yearType{}

	ErrConvertingToYear = errors.NewKind("value %v is not a valid Year")
)

Jump to

Keyboard shortcuts

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