-
-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathMongoDBPlugin.swift
More file actions
50 lines (44 loc) · 1.86 KB
/
MongoDBPlugin.swift
File metadata and controls
50 lines (44 loc) · 1.86 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
48
49
50
//
// MongoDBPlugin.swift
// TablePro
//
import Foundation
import TableProPluginKit
final class MongoDBPlugin: NSObject, TableProPlugin, DriverPlugin {
static let pluginName = "MongoDB Driver"
static let pluginVersion = "1.0.0"
static let pluginDescription = "MongoDB support via libmongoc C driver"
static let capabilities: [PluginCapability] = [.databaseDriver]
static let databaseTypeId = "MongoDB"
static let databaseDisplayName = "MongoDB"
static let iconName = "leaf.fill"
static let defaultPort = 27017
static let additionalConnectionFields: [ConnectionField] = [
ConnectionField(id: "mongoAuthSource", label: "Auth Database", placeholder: "admin"),
ConnectionField(id: "mongoReadPreference", label: "Read Preference", placeholder: "primary"),
ConnectionField(id: "mongoWriteConcern", label: "Write Concern", placeholder: "majority")
]
// MARK: - UI/Capability Metadata
static let requiresAuthentication = false
static let urlSchemes: [String] = ["mongodb", "mongodb+srv"]
static let brandColorHex = "#00ED63"
static let queryLanguageName = "MQL"
static let editorLanguage: EditorLanguage = .javascript
static let supportsForeignKeys = false
static let supportsSchemaEditing = false
static let databaseGroupingStrategy: GroupingStrategy = .flat
static let columnTypesByCategory: [String: [String]] = [
"String": ["string", "objectId", "regex"],
"Number": ["int", "long", "double", "decimal"],
"Date": ["date", "timestamp"],
"Binary": ["binData"],
"Boolean": ["bool"],
"Array": ["array"],
"Object": ["object"],
"Null": ["null"],
"Other": ["javascript", "minKey", "maxKey"]
]
func createDriver(config: DriverConnectionConfig) -> any PluginDatabaseDriver {
MongoDBPluginDriver(config: config)
}
}