Got insert testing in a better state

* Split up insert function for testing
* Add DBType to global state
* Move test reflection helpers to testing.go
* Add incremental seed to randomizeField to avoid duplicate constraint
  error messages
* Fixed Viper SSL default bug
* Fixed pgpass SSL inclusion bug
* Add MakeStringMap strmangle helper
* Change test errors from error to skip
This commit is contained in:
Patrick O'brien 2016-07-14 02:51:40 +10:00
parent f054f2f754
commit 4036786b6a
25 changed files with 778 additions and 781 deletions
strmangle

View file

@ -98,6 +98,17 @@ func CamelCase(name string) string {
return strings.Join(splits, "")
}
// MakeStringMap converts a map[string]string into the format:
// "key": "value", "key": "value"
func MakeStringMap(types map[string]string) string {
var typArr []string
for k, v := range types {
typArr = append(typArr, fmt.Sprintf(`"%s": "%s"`, k, v))
}
return strings.Join(typArr, ", ")
}
// StringMap maps a function over a slice of strings.
func StringMap(modifier func(string) string, strs []string) []string {
ret := make([]string, len(strs))