3
0

import misc/util go files

This commit is contained in:
Tit Petric
2018-07-01 01:46:24 +02:00
parent 839e249506
commit a7fcdf3795
2 changed files with 43 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
package crm
import (
"net/http"
)
// RequestFiller is an interface for typed request parameters
type RequestFiller interface {
Fill(r *http.Request) error
}
+33
View File
@@ -0,0 +1,33 @@
package crm
import (
"strconv"
)
// parseInt64 parses an string to int64
func parseInt64(s string) int64 {
if s == "" {
return 0
}
i, _ := strconv.ParseInt(s, 10, 64)
return i
}
// parseUInt64 parses an string to uint64
func parseUInt64(s string) uint64 {
if s == "" {
return 0
}
i, _ := strconv.ParseUint(s, 10, 64)
return i
}
// is checks if string s is contained in matches
func is(s string, matches ...string) bool {
for _, v := range matches {
if s == v {
return true
}
}
return false
}