Blame view

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