format_utility.go
474 Bytes
package restutility
import (
"time"
"fmt"
)
func UnixToDate(unix int64) time.Time {
return time.Unix(unix, 0)
}
func DateToUnix(date interface{}) int64 {
if date != nil {
t := date.(time.Time)
return t.Unix()
}
return 0
}
func EqualQuotes(stmt string) string {
if stmt != "" {
stmt = fmt.Sprintf(" = '%s'", stmt)
}
return stmt
}
func LikeQuotes(stmt string) string {
if stmt != "" {
stmt = fmt.Sprintf(" LIKE UPPER('%%s%')", stmt)
}
return stmt
}