Blame view

format_utility.go 447 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
  )
33fd58161   markotikvic   minor changes, sh...
6
7
  func UnixToDate(unix int64) time.Time {
  	return time.Unix(unix, 0)
514fa9dd6   Marko Tikvić   added formating u...
8
  }
33fd58161   markotikvic   minor changes, sh...
9
10
11
  func DateToUnix(date interface{}) int64 {
  	if date != nil {
  		t := date.(time.Time)
514fa9dd6   Marko Tikvić   added formating u...
12
13
14
15
16
  		return t.Unix()
  
  	}
  	return 0
  }
33fd58161   markotikvic   minor changes, sh...
17
18
19
  func EqualQuotes(stmt string) string {
  	if stmt != "" {
  		stmt = " = '" + stmt + "'"
514fa9dd6   Marko Tikvić   added formating u...
20
  	}
33fd58161   markotikvic   minor changes, sh...
21
  	return stmt
514fa9dd6   Marko Tikvić   added formating u...
22
  }
33fd58161   markotikvic   minor changes, sh...
23
24
25
  func LikeQuotes(stmt string) string {
  	if stmt != "" {
  		stmt " LIKE UPPER('%" + stmt + "%')"
514fa9dd6   Marko Tikvić   added formating u...
26
  	}
33fd58161   markotikvic   minor changes, sh...
27
  	return stmt
514fa9dd6   Marko Tikvić   added formating u...
28
  }