initial commit
This commit is contained in:
commit
18995db757
871 changed files with 492725 additions and 0 deletions
26
pkg/core/helper.go
Normal file
26
pkg/core/helper.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package core
|
||||
|
||||
import "time"
|
||||
|
||||
// Contains checks if slice a contains string str
|
||||
func Contains(str string, a []string) (int, bool) {
|
||||
for i, s := range a {
|
||||
if s == str {
|
||||
return i, true
|
||||
}
|
||||
}
|
||||
return -1, false
|
||||
}
|
||||
|
||||
const (
|
||||
timeFmt = "2006-01-02 15:04:05"
|
||||
fileFmt = "20060102_150405"
|
||||
)
|
||||
|
||||
func Now() string {
|
||||
return time.Now().Format(timeFmt)
|
||||
}
|
||||
|
||||
func FileName() string {
|
||||
return time.Now().Format(fileFmt)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue