@@ -8,91 +8,143 @@ import (
88var waitGroup sync.WaitGroup
99
1010type Filter struct {
11+ // Exclude as strings (regexp)
1112 Exclude []string `yaml:"exclude"`
13+ // compiled regexp excludes
1214 excludeRegexp []* regexp.Regexp
15+
16+ // Includes as strings (regexp)
1317 Include []string `yaml:"include"`
18+ // compiled regexp includes
1419 includeRegexp []* regexp.Regexp
1520}
1621
1722type Filesystem struct {
23+ // Remove path
1824 Path string `yaml:"path"`
25+ // Local path (optional)
1926 Local string `yaml:"local"`
27+ // Filter
2028 Filter Filter `yaml:"filter"`
29+ // Connection for filesystem sync (optional, default is Server connection)
2130 Connection * YamlCommandBuilderConnection `yaml:"connection"`
2231 Options struct {
32+ // Generate stubs (small example files) instead of fetching files from remote
2333 GenerateStubs bool `yaml:"generate-stubs"`
2434 } `yaml:"options"`
2535}
2636
2737type DatabaseOptions struct {
38+ // Clear database with DROP/CREATE before sync
2839 ClearDatabase bool `yaml:"clear-database"`
29- Mysqldump string `yaml:"mysqldump"`
30- Mysql string `yaml:"mysql"`
31- Pgdump string `yaml:"pgdump"`
32- Psql string `yaml:"psql"`
40+ // Arguments for mysqldump command
41+ Mysqldump * YamlStringArray `yaml:"mysqldump"`
42+ // Arguments for mysql command
43+ Mysql * YamlStringArray `yaml:"mysql"`
44+ // Arguments for pgdump command
45+ Pgdump * YamlStringArray `yaml:"pgdump"`
46+ // Arguments for psql command
47+ Psql * YamlStringArray `yaml:"psql"`
3348}
3449
3550type EnvironmentVar struct {
51+ // Name of variable
3652 Name string `yaml:"name"`
53+ // Value of variable
3754 Value string `yaml:"value"`
3855}
3956
4057type Database struct {
58+ // Type of database (either mysql or postgres)
4159 Type string `yaml:"type"`
60+ // Database name on remote database server
4261 Db string `yaml:"database"`
62+ // Hostname of remote database server
4363 Hostname string `yaml:"hostname"`
64+ // Port of remote database server
4465 Port string `yaml:"port"`
66+ // Username of remote database server
4567 User string `yaml:"user"`
68+ // Password of remote database server
4669 Password string `yaml:"password"`
4770
71+ // Table filter
4872 Filter Filter `yaml:"filter"`
73+ // Connection for database sync (optional, default is Server connection)
4974 Connection * YamlCommandBuilderConnection `yaml:"connection"`
75+ // Database options
5076 Options DatabaseOptions `yaml:"options"`
5177
5278 Local struct {
53- Type string `yaml:"type"`
79+ // Database name on local database server
5480 Db string `yaml:"database"`
81+ // Hostname of local database server
5582 Hostname string `yaml:"hostname"`
83+ // Port of local database server
5684 Port string `yaml:"port"`
85+ // Username of local database server
5786 User string `yaml:"user"`
87+ // Password of local database server
5888 Password string `yaml:"password"`
5989
90+ // Connection for database sync (optional, default is empty)
6091 Connection * YamlCommandBuilderConnection `yaml:"connection"`
92+
93+ // Database options
6194 Options DatabaseOptions `yaml:"options"`
6295 } `yaml:"local"`
6396
64- // local cache
97+ // local cache for remote table list
6598 cacheRemoteTableList []string
99+ // local cache for local table list
66100 cacheLocalTableList []string
67101}
68102
69103type Execution struct {
104+ // Type of execution (remote or local)
70105 Type string `yaml:"type"`
106+ // Command as string or as elements
71107 Command YamlStringArray `yaml:"command"`
108+ // Workdir for execution
72109 Workdir string `yaml:"workdir"`
110+
111+ // Environment variables
73112 Environment []EnvironmentVar `yaml:"environment"`
113+
114+ // Execution options
74115 Options struct {
75116 } `yaml:"options"`
76117}
77118
78119type Server struct {
120+ // General working path (for filesystem syncs)
79121 Path string `yaml:"path"`
122+ // General connection (default for all remote connections)
80123 Connection * YamlCommandBuilderConnection `yaml:"connection"`
124+ // Filesystem sync list
81125 Filesystem []Filesystem `yaml:"filesystem"`
126+ // Database sync list
82127 Database []Database `yaml:"database"`
128+ // Startup execution list (executed before sync)
83129 ExecStartup []Execution `yaml:"exec-startup"`
130+ // Finish execution list (executed after sync)
84131 ExecFinish []Execution `yaml:"exec-finish"`
85132
86133 runConfiguration * RunConfiguration
87134}
88135
89136type SyncConfig struct {
137+ // Sync (remote -> local) configurations
90138 Sync map [string ]Server `yaml:"sync"`
139+ // Deploy (local -> remote) configurations
91140 Deploy map [string ]Server `yaml:"deploy"`
92141}
93142
94143type RunConfiguration struct {
144+ // Enable database sync
95145 Database bool
146+ // Enable filesystem sync
96147 Filesystem bool
148+ // Enable exec runner
97149 Exec bool
98150}
0 commit comments