m2m preload utils

This commit is contained in:
kimiby 2015-08-16 10:35:58 +03:00
parent 42c3f39163
commit fbce0d98f6
1 changed files with 23 additions and 0 deletions

View File

@ -5,6 +5,8 @@ import (
"reflect" "reflect"
"regexp" "regexp"
"runtime" "runtime"
"unicode"
"unicode/utf8"
) )
func fileWithLineNum() string { func fileWithLineNum() string {
@ -71,3 +73,24 @@ func convertInterfaceToMap(values interface{}) map[string]interface{} {
} }
return attrs return attrs
} }
func toString(a interface{}) string {
return fmt.Sprintf("%v", a)
}
func strInSlice(a string, list []string) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
}
func upFL(s string) string {
if s == "" {
return ""
}
r, n := utf8.DecodeRuneInString(s)
return string(unicode.ToUpper(r)) + s[n:]
}