2022-11-18 21:25:40 +01:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2023-04-21 21:45:16 +02:00
|
|
|
//go:generate go run ../_gen/enum-generate.go -- enums_gen.go
|
|
|
|
|
2022-11-18 21:25:40 +01:00
|
|
|
func timeOptFmt(t *time.Time, fmt string) *string {
|
|
|
|
if t == nil {
|
|
|
|
return nil
|
|
|
|
} else {
|
|
|
|
return langext.Ptr(t.Format(fmt))
|
|
|
|
}
|
|
|
|
}
|
2022-11-18 23:12:37 +01:00
|
|
|
|
|
|
|
func timeOptFromMilli(millis *int64) *time.Time {
|
|
|
|
if millis == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return langext.Ptr(time.UnixMilli(*millis))
|
|
|
|
}
|
2023-04-21 21:45:16 +02:00
|
|
|
|
|
|
|
func timeFromMilli(millis int64) time.Time {
|
|
|
|
return time.UnixMilli(millis)
|
|
|
|
}
|