Repository navigation
Expand file tree
/
Copy pathtypes.go
More file actions
223 lines (191 loc) · 6.86 KB
/
Copy pathtypes.go
File metadata and controls
223 lines (191 loc) · 6.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
package gpa
import "time"
// =====================================
// Core Types and Constants
// =====================================
// Config represents database connection configuration
type Config struct {
// Connection details
Driver string `json:"driver" yaml:"driver"`
ConnectionURL string `json:"connection_url" yaml:"connection_url"`
Host string `json:"host" yaml:"host"`
Port int `json:"port" yaml:"port"`
Database string `json:"database" yaml:"database"`
Username string `json:"username" yaml:"username"`
Password string `json:"password" yaml:"password"`
// Connection pool settings
MaxOpenConns int `json:"max_open_conns" yaml:"max_open_conns"`
MaxIdleConns int `json:"max_idle_conns" yaml:"max_idle_conns"`
ConnMaxLifetime time.Duration `json:"conn_max_lifetime" yaml:"conn_max_lifetime"`
ConnMaxIdleTime time.Duration `json:"conn_max_idle_time" yaml:"conn_max_idle_time"`
// Additional options
Options map[string]interface{} `json:"options" yaml:"options"`
// SSL/TLS configuration
SSL SSLConfig `json:"ssl" yaml:"ssl"`
}
// SSLConfig represents SSL/TLS configuration
type SSLConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
Mode string `json:"mode" yaml:"mode"`
CertFile string `json:"cert_file" yaml:"cert_file"`
KeyFile string `json:"key_file" yaml:"key_file"`
CAFile string `json:"ca_file" yaml:"ca_file"`
}
// ProviderInfo contains information about the provider
type ProviderInfo struct {
Name string
Version string
DatabaseType DatabaseType
Features []Feature
}
// DatabaseType represents the type of database
type DatabaseType string
const (
DatabaseTypeSQL DatabaseType = "sql"
DatabaseTypeDocument DatabaseType = "document"
DatabaseTypeKV DatabaseType = "key-value"
DatabaseTypeGraph DatabaseType = "graph"
DatabaseTypeMemory DatabaseType = "memory"
)
// Feature represents a database feature
type Feature string
const (
FeatureTransactions Feature = "transactions"
FeatureIndexes Feature = "indexes"
FeatureTTL Feature = "ttl"
FeatureAtomicOps Feature = "atomic_ops"
FeatureFullText Feature = "full_text_search"
FeatureGeoSpatial Feature = "geospatial"
FeatureGeospatial Feature = "geospatial"
FeatureSubQueries Feature = "subqueries"
FeatureJoins Feature = "joins"
FeatureJSONQueries Feature = "json_queries"
FeatureIndexing Feature = "indexing"
FeatureAggregation Feature = "aggregation"
FeatureFullTextSearch Feature = "full_text_search"
FeaturePubSub Feature = "pub_sub"
FeatureStreaming Feature = "streaming"
FeatureReplication Feature = "replication"
FeatureSharding Feature = "sharding"
FeatureMigration Feature = "migration"
FeatureRawSQL Feature = "raw_sql"
)
// Operator represents query operators
type Operator string
const (
OpEqual Operator = "="
OpNotEqual Operator = "!="
OpGreaterThan Operator = ">"
OpGreaterThanOrEqual Operator = ">="
OpLessThan Operator = "<"
OpLessThanOrEqual Operator = "<="
OpLike Operator = "LIKE"
OpNotLike Operator = "NOT LIKE"
OpIn Operator = "IN"
OpNotIn Operator = "NOT IN"
OpIsNull Operator = "IS NULL"
OpIsNotNull Operator = "IS NOT NULL"
OpBetween Operator = "BETWEEN"
OpNotBetween Operator = "NOT BETWEEN"
OpContains Operator = "CONTAINS"
OpStartsWith Operator = "STARTS_WITH"
OpEndsWith Operator = "ENDS_WITH"
OpRegex Operator = "REGEX"
OpExists Operator = "EXISTS"
OpNotExists Operator = "NOT EXISTS"
OpInSubQuery Operator = "IN_SUBQUERY"
OpNotInSubQuery Operator = "NOT_IN_SUBQUERY"
)
// LogicOperator represents logic operators for combining conditions
type LogicOperator string
const (
LogicAnd LogicOperator = "AND"
LogicOr LogicOperator = "OR"
LogicNot LogicOperator = "NOT"
)
// Order represents sorting order
type Order struct {
Field string
Direction OrderDirection
}
// OrderDirection represents sort direction
type OrderDirection string
const (
OrderAsc OrderDirection = "ASC"
OrderDesc OrderDirection = "DESC"
)
// JoinClause represents a table join
type JoinClause struct {
Type JoinType
Table string
Condition string
Alias string
}
// JoinType represents types of table joins
type JoinType string
const (
JoinInner JoinType = "INNER"
JoinLeft JoinType = "LEFT"
JoinRight JoinType = "RIGHT"
JoinFull JoinType = "FULL"
)
// LockType represents database lock types
type LockType string
const (
LockNone LockType = "NONE"
LockShared LockType = "SHARED"
LockExclusive LockType = "EXCLUSIVE"
LockUpdateNoWait LockType = "UPDATE_NOWAIT"
LockForUpdate LockType = "FOR_UPDATE"
LockForShare LockType = "FOR_SHARE"
)
// IndexType represents different types of database indexes
type IndexType string
const (
IndexTypePrimary IndexType = "primary"
IndexTypeUnique IndexType = "unique"
IndexTypeStandard IndexType = "standard"
IndexTypeFullText IndexType = "fulltext"
IndexTypeGeoSpatial IndexType = "geospatial"
IndexTypeComposite IndexType = "composite"
)
// RelationType represents different types of entity rel
type RelationType string
const (
RelationOneToOne RelationType = "one_to_one"
RelationOneToMany RelationType = "one_to_many"
RelationManyToOne RelationType = "many_to_one"
RelationManyToMany RelationType = "many_to_many"
)
// SubQueryType represents the type of subquery operation
type SubQueryType string
const (
SubQueryExists SubQueryType = "EXISTS"
SubQueryNotExists SubQueryType = "NOT EXISTS"
SubQueryIn SubQueryType = "IN"
SubQueryNotIn SubQueryType = "NOT IN"
SubQueryScalar SubQueryType = "SCALAR"
SubQueryAny SubQueryType = "ANY"
SubQueryAll SubQueryType = "ALL"
SubQueryTypeExists SubQueryType = "EXISTS"
SubQueryTypeIn SubQueryType = "IN"
SubQueryTypeScalar SubQueryType = "SCALAR"
SubQueryTypeCorrelated SubQueryType = "CORRELATED"
)
// ErrorType represents different types of errors that can occur
type ErrorType string
const (
ErrorTypeValidation ErrorType = "validation"
ErrorTypeNotFound ErrorType = "not_found"
ErrorTypeDuplicate ErrorType = "duplicate"
ErrorTypeConnection ErrorType = "connection"
ErrorTypeTimeout ErrorType = "timeout"
ErrorTypePermission ErrorType = "permission"
ErrorTypeConstraint ErrorType = "constraint"
ErrorTypeTransaction ErrorType = "transaction"
ErrorTypeUnsupported ErrorType = "unsupported"
ErrorTypeInternal ErrorType = "internal"
ErrorTypeSerialization ErrorType = "serialization"
ErrorTypeInvalidArgument ErrorType = "invalid_argument"
ErrorTypeDatabase ErrorType = "database"
)