Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
9b752a911c
|
|||
ec9ac26a4c
|
|||
39a0b73d56
|
@@ -16,11 +16,11 @@ type ErrorPackageConfig struct {
|
||||
}
|
||||
|
||||
type ErrorPackageConfigInit struct {
|
||||
ZeroLogErrTraces bool
|
||||
ZeroLogAllTraces bool
|
||||
RecursiveErrors bool
|
||||
ExtendedGinOutput bool
|
||||
IncludeMetaInGinOutput bool
|
||||
ZeroLogErrTraces *bool
|
||||
ZeroLogAllTraces *bool
|
||||
RecursiveErrors *bool
|
||||
ExtendedGinOutput *bool
|
||||
IncludeMetaInGinOutput *bool
|
||||
ExtendGinOutput func(err *ExErr, json map[string]any)
|
||||
ExtendGinDataOutput func(err *ExErr, depth int, json map[string]any)
|
||||
}
|
||||
@@ -56,11 +56,11 @@ func Init(cfg ErrorPackageConfigInit) {
|
||||
}
|
||||
|
||||
pkgconfig = ErrorPackageConfig{
|
||||
ZeroLogErrTraces: cfg.ZeroLogErrTraces,
|
||||
ZeroLogAllTraces: cfg.ZeroLogAllTraces,
|
||||
RecursiveErrors: cfg.RecursiveErrors,
|
||||
ExtendedGinOutput: cfg.ExtendedGinOutput,
|
||||
IncludeMetaInGinOutput: cfg.IncludeMetaInGinOutput,
|
||||
ZeroLogErrTraces: langext.Coalesce(cfg.ZeroLogErrTraces, pkgconfig.ZeroLogErrTraces),
|
||||
ZeroLogAllTraces: langext.Coalesce(cfg.ZeroLogAllTraces, pkgconfig.ZeroLogAllTraces),
|
||||
RecursiveErrors: langext.Coalesce(cfg.RecursiveErrors, pkgconfig.RecursiveErrors),
|
||||
ExtendedGinOutput: langext.Coalesce(cfg.ExtendedGinOutput, pkgconfig.ExtendedGinOutput),
|
||||
IncludeMetaInGinOutput: langext.Coalesce(cfg.IncludeMetaInGinOutput, pkgconfig.IncludeMetaInGinOutput),
|
||||
ExtendGinOutput: ego,
|
||||
ExtendGinDataOutput: egdo,
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.244"
|
||||
const GoextVersion = "0.0.247"
|
||||
|
||||
const GoextVersionTimestamp = "2023-08-18T13:27:02+0200"
|
||||
const GoextVersionTimestamp = "2023-08-21T14:23:44+0200"
|
||||
|
@@ -22,6 +22,17 @@ func TimeToDatePart(t time.Time, tz *time.Location) time.Time {
|
||||
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
||||
}
|
||||
|
||||
// TimeToDayStart returns a timestamp at the start of the day which contains t (= 00:00:00)
|
||||
func TimeToDayStart(t time.Time, tz *time.Location) time.Time {
|
||||
t = t.In(tz)
|
||||
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
||||
}
|
||||
|
||||
// TimeToDayEnd returns a timestamp at the end of the day which contains t (= 23:59:59)
|
||||
func TimeToDayEnd(t time.Time, tz *time.Location) time.Time {
|
||||
return TimeToDayStart(t, tz).AddDate(0, 0, 1).Add(-1)
|
||||
}
|
||||
|
||||
// TimeToWeekStart returns a timestamp at the start of the week which contains t (= Monday 00:00:00)
|
||||
func TimeToWeekStart(t time.Time, tz *time.Location) time.Time {
|
||||
t = TimeToDatePart(t, tz)
|
||||
|
Reference in New Issue
Block a user