From fbce0d98f6c36027255f73ecf787fc324e0a8007 Mon Sep 17 00:00:00 2001 From: kimiby Date: Sun, 16 Aug 2015 10:35:58 +0300 Subject: [PATCH] m2m preload utils --- utils_private.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/utils_private.go b/utils_private.go index 6f609ae0..8b43453f 100644 --- a/utils_private.go +++ b/utils_private.go @@ -5,6 +5,8 @@ import ( "reflect" "regexp" "runtime" + "unicode" + "unicode/utf8" ) func fileWithLineNum() string { @@ -71,3 +73,24 @@ func convertInterfaceToMap(values interface{}) map[string]interface{} { } 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:] +}