35 lines
496 B
Go
35 lines
496 B
Go
package commonlogic
|
|
|
|
import (
|
|
"github.com/rs/zerolog/log"
|
|
"os"
|
|
)
|
|
|
|
func ContainsInt64(a []int64, b int64) bool {
|
|
for _, v := range a {
|
|
if v == b {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func ContainsString(a []string, b string) bool {
|
|
for _, v := range a {
|
|
if v == b {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
func GetFileSize(path string) (size int64) {
|
|
file, err := os.Stat(path)
|
|
if err != nil {
|
|
log.Error().Err(err).Msg("Failed to stat " + path)
|
|
return 0
|
|
}
|
|
return file.Size()
|
|
}
|