Blame view

format_utility.go 478 Bytes
90fd36e9b   Marko Tikvić   resolved some dep...
1
  package restutility
514fa9dd6   Marko Tikvić   added formating u...
2
3
4
5
6
7
  
  import (
  	"strings"
  	"time"
  	"strconv"
  )
25e001550   Marko Tikvić   exported everything
8
  func UnixToDate(input int64) time.Time {
514fa9dd6   Marko Tikvić   added formating u...
9
10
  	return time.Unix(input, 0)
  }
25e001550   Marko Tikvić   exported everything
11
  func DateToUnix(input interface{}) int64 {
514fa9dd6   Marko Tikvić   added formating u...
12
13
14
15
16
17
18
  	if input != nil {
  		t := input.(time.Time)
  		return t.Unix()
  
  	}
  	return 0
  }
25e001550   Marko Tikvić   exported everything
19
  func EqualQuotes(input string) string {
514fa9dd6   Marko Tikvić   added formating u...
20
21
22
23
24
  	if input != "" {
  		return " = '" + input + "'"
  	}
  	return ""
  }
25e001550   Marko Tikvić   exported everything
25
  func LikeQuotes(input string) string {
514fa9dd6   Marko Tikvić   added formating u...
26
27
28
29
30
  	if input != "" {
  		return " LIKE UPPER('%" + input + "%')"
  	}
  	return ""
  }