Blame view
format_utility.go
485 Bytes
ea858b8a7 refactoring |
1 |
package webutility |
514fa9dd6 added formating u... |
2 3 |
import ( |
514fa9dd6 added formating u... |
4 |
"time" |
4b4ea384f hmm |
5 |
"fmt" |
514fa9dd6 added formating u... |
6 |
) |
33fd58161 minor changes, sh... |
7 8 |
func UnixToDate(unix int64) time.Time { return time.Unix(unix, 0) |
514fa9dd6 added formating u... |
9 |
} |
33fd58161 minor changes, sh... |
10 11 12 |
func DateToUnix(date interface{}) int64 { if date != nil { t := date.(time.Time) |
514fa9dd6 added formating u... |
13 14 15 16 17 |
return t.Unix() } return 0 } |
33fd58161 minor changes, sh... |
18 19 |
func EqualQuotes(stmt string) string { if stmt != "" { |
4b4ea384f hmm |
20 |
stmt = fmt.Sprintf(" = '%s'", stmt) |
514fa9dd6 added formating u... |
21 |
} |
33fd58161 minor changes, sh... |
22 |
return stmt |
514fa9dd6 added formating u... |
23 |
} |
33fd58161 minor changes, sh... |
24 25 |
func LikeQuotes(stmt string) string { if stmt != "" { |
e77b75ec6 proper LIKE forma... |
26 |
stmt = fmt.Sprintf(" LIKE UPPER('%s%s%s')", "%", stmt, "%") |
514fa9dd6 added formating u... |
27 |
} |
33fd58161 minor changes, sh... |
28 |
return stmt |
514fa9dd6 added formating u... |
29 |
} |