-
-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathMySQLPlugin.swift
More file actions
47 lines (40 loc) · 1.76 KB
/
MySQLPlugin.swift
File metadata and controls
47 lines (40 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// MySQLPlugin.swift
// MySQLDriverPlugin
//
// MySQL/MariaDB database driver plugin using libmariadb (MariaDB Connector/C)
//
import CMariaDB
import Foundation
import os
import TableProPluginKit
// MARK: - Plugin Entry Point
final class MySQLPlugin: NSObject, TableProPlugin, DriverPlugin {
static let pluginName = "MySQL Driver"
static let pluginVersion = "1.0.0"
static let pluginDescription = "MySQL/MariaDB support via libmariadb"
static let capabilities: [PluginCapability] = [.databaseDriver]
static let databaseTypeId = "MySQL"
static let databaseDisplayName = "MySQL"
static let iconName = "cylinder.fill"
static let defaultPort = 3306
static let additionalConnectionFields: [ConnectionField] = []
static let additionalDatabaseTypeIds: [String] = ["MariaDB"]
// MARK: - UI/Capability Metadata
static let urlSchemes: [String] = ["mysql"]
static let brandColorHex = "#FF9500"
static let systemDatabaseNames: [String] = ["information_schema", "mysql", "performance_schema", "sys"]
static let columnTypesByCategory: [String: [String]] = [
"Integer": ["TINYINT", "SMALLINT", "MEDIUMINT", "INT", "INTEGER", "BIGINT"],
"Float": ["FLOAT", "DOUBLE", "DECIMAL", "NUMERIC", "REAL"],
"String": ["CHAR", "VARCHAR", "TINYTEXT", "TEXT", "MEDIUMTEXT", "LONGTEXT", "ENUM", "SET"],
"Date": ["DATE", "TIME", "DATETIME", "TIMESTAMP", "YEAR"],
"Binary": ["BINARY", "VARBINARY", "TINYBLOB", "BLOB", "MEDIUMBLOB", "LONGBLOB", "BIT"],
"Boolean": ["BOOLEAN", "BOOL"],
"JSON": ["JSON"],
"Spatial": ["GEOMETRY", "POINT", "LINESTRING", "POLYGON"]
]
func createDriver(config: DriverConnectionConfig) -> any PluginDatabaseDriver {
MySQLPluginDriver(config: config)
}
}