/
types.go
88 lines (78 loc) · 3.62 KB
/
types.go
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
package db
type Config struct {
SkipDefaultTransaction bool `json:"skip_default_transaction"`
DryRun bool `json:"dry_run"`
PrepareStmt bool `json:"prepare_stmt"`
DisableAutomaticPing bool `json:"disable_automatic_ping"`
DisableForeignKeyConstraintWhenMigrating bool `json:"disable_foreign_key_constraint_when_migrating"`
IgnoreRelationshipsWhenMigrating bool `json:"ignore_relationships_when_migrating"`
DisableNestedTransaction bool `json:"disable_nested_transaction"`
}
type LoggerConfig struct {
SlowThreshold int64 `json:"slow_threshold"`
IgnoreRecordNotFoundError bool `json:"ignore_record_not_found_error"`
ParameterizedQueries bool `json:"parameterized_queries"`
LogLevel string `json:"log_level"`
}
type MysqlSpecificConfig struct {
DefaultStringSize uint `json:"default_string_size"`
DisableDatetimePrecision bool `json:"disable_datetime_precision"`
DefaultDatetimePrecision int `json:"default_datetime_precision"`
SupportRenameIndex bool `json:"support_rename_index"`
SupportRenameColumn bool `json:"support_rename_column"`
SkipInitializeWithVersion bool `json:"skip_initialize_with_version"`
DisableWithReturning bool `json:"disable_with_returning"`
SupportForShareClause bool `json:"support_for_share_clause"`
SupportNullAsDefaultValue bool `json:"support_null_as_default_value"`
SupportRenameColumnUnique bool `json:"support_rename_column_unique"`
}
type PostgresqlSpecificConfig struct {
PreferSimpleProtocol bool `json:"prefer_simple_protocol"`
WithoutReturning bool `json:"without_returning"`
}
type Sqlite struct {
FileName string `json:"db"`
Options map[string]string `json:"options"`
Config *Config `json:"config"`
LoggerConfig *LoggerConfig `json:"logger"`
}
type Mysql struct {
DatabaseName string `json:"db"`
Username string `json:"username"`
Password string `json:"password"`
Host string `json:"host"`
Port string `json:"port"`
Protocol string `json:"protocol"`
Options map[string]string `json:"options"`
Config *Config `json:"config"`
LoggerConfig *LoggerConfig `json:"logger"`
SpecificConfig *MysqlSpecificConfig `json:"specific_config"`
}
type Postgresql struct {
DatabaseName string `json:"db"`
Username string `json:"username"`
Password string `json:"password"`
Host string `json:"host"`
Port string `json:"port"`
Options map[string]string `json:"options"`
Config *Config `json:"config"`
LoggerConfig *LoggerConfig `json:"logger"`
SpecificConfig *PostgresqlSpecificConfig `json:"specific_config"`
}
type SqlConfigurable interface {
Sqlite | Mysql | Postgresql
}
type MongoLoggerConfig struct {
MaxDocumentLength int `json:"max_document_length"`
ComponentCommand string `json:"component_command"`
ComponentConnection string `json:"component_connection"`
}
type Mongo struct {
DatabaseName string `json:"db"`
Username string `json:"username"`
Password string `json:"password"`
Host string `json:"host"`
Port string `json:"port"`
Options map[string]string `json:"options"`
LoggerConfig *MongoLoggerConfig `json:"logger"`
}