docstore/pkg/core/helper.go
2019-04-19 15:45:28 +02:00

26 lines
409 B
Go

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)
}