ValidateConnectConfig validates params
(cfg *config.SQL)
| 163 | |
| 164 | // ValidateConnectConfig validates params |
| 165 | func ValidateConnectConfig(cfg *config.SQL) error { |
| 166 | host, _, err := net.SplitHostPort(cfg.ConnectAddr) |
| 167 | if err != nil { |
| 168 | return schema.NewConfigError("invalid host and port " + cfg.ConnectAddr) |
| 169 | } |
| 170 | if len(host) == 0 { |
| 171 | return schema.NewConfigError("missing sql endpoint argument " + flag(schema.CLIOptEndpoint)) |
| 172 | } |
| 173 | if cfg.DatabaseName == "" { |
| 174 | return schema.NewConfigError("missing " + flag(schema.CLIOptDatabase) + " argument") |
| 175 | } |
| 176 | |
| 177 | return nil |
| 178 | } |
| 179 | |
| 180 | func flag(opt string) string { |
| 181 | return "(-" + opt + ")" |
no test coverage detected