Blame view

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