forked from goccy/go-zetasqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
context.go
20 lines (16 loc) · 631 Bytes
/
context.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package zetasqlite
import (
"context"
"time"
"github.com/goccy/go-zetasqlite/internal"
)
// WithCurrentTime use to replace the current time with the specified time.
// To replace the time, you need to pass the returned context as an argument to QueryContext.
// `CURRENT_DATE`, `CURRENT_DATETIME`, `CURRENT_TIME`, `CURRENT_TIMESTAMP` functions are targeted.
func WithCurrentTime(ctx context.Context, now time.Time) context.Context {
return internal.WithCurrentTime(ctx, now)
}
// CurrentTime gets the time specified by WithCurrentTime.
func CurrentTime(ctx context.Context) *time.Time {
return internal.CurrentTime(ctx)
}