Modify postgres query to get is_unique for indexes

* Remove unused SnakeCase function
* Fix formatting bug in relationship structs
This commit is contained in:
Patrick O'brien 2016-08-13 17:30:55 +10:00
parent 7517ad3ced
commit d92a439c54
5 changed files with 14 additions and 52 deletions
strmangle

View file

@ -10,7 +10,6 @@ import (
"math"
"regexp"
"strings"
"unicode"
"github.com/jinzhu/inflection"
)
@ -140,22 +139,6 @@ func CamelCase(name string) string {
return strings.Join(splits, "")
}
// SnakeCase converts TitleCase variable names to snake_case format.
func SnakeCase(name string) string {
runes := []rune(name)
length := len(runes)
var out []rune
for i := 0; i < length; i++ {
if i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1]) || unicode.IsDigit(runes[i-1])) {
out = append(out, '_')
}
out = append(out, unicode.ToLower(runes[i]))
}
return string(out)
}
// MakeStringMap converts a map[string]string into the format:
// "key": "value", "key": "value"
func MakeStringMap(types map[string]string) string {