Documentation
¶
Index ¶
- Variables
- func NewMyMariaDBPlugin() *engine.Plugin
- func NewMySQLPlugin() *engine.Plugin
- func NewMySQLSQLBuilder(db *gorm.DB, plugin gorm_plugin.GormPluginFunctions) gorm_plugin.SQLBuilderInterface
- func NormalizeType(typeName string) string
- type MySQLPlugin
- func (p *MySQLPlugin) BuildSkipConflictClause(pkColumns []string) clause.OnConflict
- func (p *MySQLPlugin) CreateSQLBuilder(db *gorm.DB) gorm_plugin.SQLBuilderInterface
- func (p *MySQLPlugin) DB(config *engine.PluginConfig) (*gorm.DB, error)
- func (p *MySQLPlugin) FormatGeometryValue(rawBytes []byte, columnType string) string
- func (p *MySQLPlugin) GetAllSchemasQuery() string
- func (p *MySQLPlugin) GetColumnConstraints(config *engine.PluginConfig, schema string, storageUnit string) (map[string]map[string]any, error)
- func (p *MySQLPlugin) GetCreateTableQuery(db *gorm.DB, schema string, storageUnit string, columns []engine.Record) string
- func (p *MySQLPlugin) GetDatabaseMetadata() *engine.DatabaseMetadata
- func (p *MySQLPlugin) GetDatabases(config *engine.PluginConfig) ([]string, error)
- func (p *MySQLPlugin) GetForeignKeyRelationships(config *engine.PluginConfig, schema string, storageUnit string) (map[string]*engine.ForeignKeyRelationship, error)
- func (p *MySQLPlugin) GetGraphQueryDB(db *gorm.DB, schema string) *gorm.DB
- func (p *MySQLPlugin) GetLastInsertID(db *gorm.DB) (int64, error)
- func (p *MySQLPlugin) GetPlaceholder(index int) string
- func (p *MySQLPlugin) GetPrimaryKeyColQuery() string
- func (p *MySQLPlugin) GetSSLStatus(config *engine.PluginConfig) (*engine.SSLStatus, error)
- func (p *MySQLPlugin) GetStorageUnitExistsQuery() string
- func (p *MySQLPlugin) GetSupportedOperators() map[string]string
- func (p *MySQLPlugin) GetTableInfoQuery() string
- func (p *MySQLPlugin) GetTableNameAndAttributes(rows *sql.Rows) (string, []engine.Record)
- func (p *MySQLPlugin) MarkGeneratedColumns(config *engine.PluginConfig, schema string, storageUnit string, ...) error
- func (p *MySQLPlugin) NormalizeType(typeName string) string
- func (p *MySQLPlugin) RawExecute(config *engine.PluginConfig, query string, params ...any) (*engine.GetRowsResult, error)
- type MySQLSQLBuilder
Constants ¶
This section is empty.
Variables ¶
var AliasMap = map[string]string{
"INTEGER": "INT",
"BOOL": "BOOLEAN",
"DEC": "DECIMAL",
"FIXED": "DECIMAL",
"NUMERIC": "DECIMAL",
"DOUBLE PRECISION": "DOUBLE",
"REAL": "DOUBLE",
"CHARACTER": "CHAR",
"CHARACTER VARYING": "VARCHAR",
}
AliasMap maps MySQL type aliases to their canonical names. All keys and values are UPPERCASE.
var TypeDefinitions = []engine.TypeDefinition{ {ID: "TINYINT", Label: "TINYINT", Category: engine.TypeCategoryNumeric}, {ID: "SMALLINT", Label: "SMALLINT", Category: engine.TypeCategoryNumeric}, {ID: "MEDIUMINT", Label: "MEDIUMINT", Category: engine.TypeCategoryNumeric}, {ID: "INT", Label: "INT", Category: engine.TypeCategoryNumeric}, {ID: "BIGINT", Label: "BIGINT", Category: engine.TypeCategoryNumeric}, {ID: "DECIMAL", Label: "DECIMAL", HasPrecision: true, DefaultPrecision: engine.IntPtr(10), Category: engine.TypeCategoryNumeric}, {ID: "FLOAT", Label: "FLOAT", Category: engine.TypeCategoryNumeric}, {ID: "DOUBLE", Label: "DOUBLE", Category: engine.TypeCategoryNumeric}, {ID: "VARCHAR", Label: "VARCHAR", HasLength: true, DefaultLength: engine.IntPtr(255), Category: engine.TypeCategoryText}, {ID: "CHAR", Label: "CHAR", HasLength: true, DefaultLength: engine.IntPtr(1), Category: engine.TypeCategoryText}, {ID: "TINYTEXT", Label: "TINYTEXT", Category: engine.TypeCategoryText}, {ID: "TEXT", Label: "TEXT", Category: engine.TypeCategoryText}, {ID: "MEDIUMTEXT", Label: "MEDIUMTEXT", Category: engine.TypeCategoryText}, {ID: "LONGTEXT", Label: "LONGTEXT", Category: engine.TypeCategoryText}, {ID: "BINARY", Label: "BINARY", HasLength: true, DefaultLength: engine.IntPtr(1), Category: engine.TypeCategoryBinary}, {ID: "VARBINARY", Label: "VARBINARY", HasLength: true, DefaultLength: engine.IntPtr(255), Category: engine.TypeCategoryBinary}, {ID: "TINYBLOB", Label: "TINYBLOB", Category: engine.TypeCategoryBinary}, {ID: "BLOB", Label: "BLOB", Category: engine.TypeCategoryBinary}, {ID: "MEDIUMBLOB", Label: "MEDIUMBLOB", Category: engine.TypeCategoryBinary}, {ID: "LONGBLOB", Label: "LONGBLOB", Category: engine.TypeCategoryBinary}, {ID: "DATE", Label: "DATE", Category: engine.TypeCategoryDatetime}, {ID: "TIME", Label: "TIME", Category: engine.TypeCategoryDatetime}, {ID: "DATETIME", Label: "DATETIME", Category: engine.TypeCategoryDatetime}, {ID: "TIMESTAMP", Label: "TIMESTAMP", Category: engine.TypeCategoryDatetime}, {ID: "YEAR", Label: "YEAR", Category: engine.TypeCategoryDatetime}, {ID: "BOOLEAN", Label: "BOOL", Category: engine.TypeCategoryBoolean}, {ID: "JSON", Label: "JSON", Category: engine.TypeCategoryJSON}, {ID: "ENUM", Label: "ENUM", Category: engine.TypeCategoryOther}, {ID: "SET", Label: "SET", Category: engine.TypeCategoryOther}, }
TypeDefinitions contains the canonical MySQL types with metadata for UI.
Functions ¶
func NewMyMariaDBPlugin ¶
func NewMySQLPlugin ¶
func NewMySQLSQLBuilder ¶
func NewMySQLSQLBuilder(db *gorm.DB, plugin gorm_plugin.GormPluginFunctions) gorm_plugin.SQLBuilderInterface
NewMySQLSQLBuilder creates a new MySQL-specific SQL builder
func NormalizeType ¶
NormalizeType converts a MySQL type alias to its canonical form.
Types ¶
type MySQLPlugin ¶
type MySQLPlugin struct {
gorm_plugin.GormPlugin
}
func (*MySQLPlugin) BuildSkipConflictClause ¶
func (p *MySQLPlugin) BuildSkipConflictClause(pkColumns []string) clause.OnConflict
BuildSkipConflictClause returns ON DUPLICATE KEY UPDATE pk = pk for MySQL. MySQL's GORM driver can't generate the id=id fallback without schema info when using .Table() with map records, so we provide explicit identity assignments.
func (*MySQLPlugin) CreateSQLBuilder ¶
func (p *MySQLPlugin) CreateSQLBuilder(db *gorm.DB) gorm_plugin.SQLBuilderInterface
CreateSQLBuilder creates a MySQL-specific SQL builder
func (*MySQLPlugin) DB ¶
func (p *MySQLPlugin) DB(config *engine.PluginConfig) (*gorm.DB, error)
func (*MySQLPlugin) FormatGeometryValue ¶
func (p *MySQLPlugin) FormatGeometryValue(rawBytes []byte, columnType string) string
FormatGeometryValue formats MySQL geometry data for display. MySQL stores geometry as WKB with a 4-byte SRID prefix.
func (*MySQLPlugin) GetAllSchemasQuery ¶
func (p *MySQLPlugin) GetAllSchemasQuery() string
func (*MySQLPlugin) GetColumnConstraints ¶
func (p *MySQLPlugin) GetColumnConstraints(config *engine.PluginConfig, schema string, storageUnit string) (map[string]map[string]any, error)
GetColumnConstraints retrieves column constraints for MySQL/MariaDB tables
func (*MySQLPlugin) GetCreateTableQuery ¶
func (*MySQLPlugin) GetDatabaseMetadata ¶
func (p *MySQLPlugin) GetDatabaseMetadata() *engine.DatabaseMetadata
GetDatabaseMetadata returns MySQL/MariaDB metadata for frontend configuration.
func (*MySQLPlugin) GetDatabases ¶
func (p *MySQLPlugin) GetDatabases(config *engine.PluginConfig) ([]string, error)
func (*MySQLPlugin) GetForeignKeyRelationships ¶
func (p *MySQLPlugin) GetForeignKeyRelationships(config *engine.PluginConfig, schema string, storageUnit string) (map[string]*engine.ForeignKeyRelationship, error)
func (*MySQLPlugin) GetGraphQueryDB ¶
func (*MySQLPlugin) GetLastInsertID ¶
func (p *MySQLPlugin) GetLastInsertID(db *gorm.DB) (int64, error)
GetLastInsertID returns the most recently auto-generated ID using MySQL's LAST_INSERT_ID().
func (*MySQLPlugin) GetPlaceholder ¶
func (p *MySQLPlugin) GetPlaceholder(index int) string
func (*MySQLPlugin) GetPrimaryKeyColQuery ¶
func (p *MySQLPlugin) GetPrimaryKeyColQuery() string
func (*MySQLPlugin) GetSSLStatus ¶
func (p *MySQLPlugin) GetSSLStatus(config *engine.PluginConfig) (*engine.SSLStatus, error)
GetSSLStatus queries MySQL/MariaDB to get the actual SSL status of the connection. Checks the Ssl_cipher session variable. Results are cached.
func (*MySQLPlugin) GetStorageUnitExistsQuery ¶
func (p *MySQLPlugin) GetStorageUnitExistsQuery() string
func (*MySQLPlugin) GetSupportedOperators ¶
func (p *MySQLPlugin) GetSupportedOperators() map[string]string
func (*MySQLPlugin) GetTableInfoQuery ¶
func (p *MySQLPlugin) GetTableInfoQuery() string
func (*MySQLPlugin) GetTableNameAndAttributes ¶
func (*MySQLPlugin) MarkGeneratedColumns ¶
func (p *MySQLPlugin) MarkGeneratedColumns(config *engine.PluginConfig, schema string, storageUnit string, columns []engine.Column) error
MarkGeneratedColumns detects MySQL generated columns (VIRTUAL or STORED) and marks them as IsComputed.
func (*MySQLPlugin) NormalizeType ¶
func (p *MySQLPlugin) NormalizeType(typeName string) string
NormalizeType converts MySQL type aliases to their canonical form.
func (*MySQLPlugin) RawExecute ¶
func (p *MySQLPlugin) RawExecute(config *engine.PluginConfig, query string, params ...any) (*engine.GetRowsResult, error)
type MySQLSQLBuilder ¶
type MySQLSQLBuilder struct {
*gorm_plugin.SQLBuilder
}
MySQLSQLBuilder extends the base SQLBuilder with MySQL-specific behavior
func (*MySQLSQLBuilder) GetTableQuery ¶
func (msb *MySQLSQLBuilder) GetTableQuery(schema, table string) *gorm.DB
GetTableQuery creates a GORM query with the appropriate table reference for MySQL/MariaDB