Documentation ¶
Index ¶
- func CtxLogger(ctx context.Context) *slog.Logger
- func CtxRequestID(ctx context.Context) (types.RequestID, context.Context)
- func CtxTime(ctx context.Context) time.Time
- func CtxWithLogger(ctx context.Context, logger *slog.Logger) context.Context
- func CtxWithTime(ctx context.Context, timeFunc TimeFunc) context.Context
- func DumpJson(t *testing.T, path string, v interface{})
- func HandleError(ctx context.Context, msg string, err error)
- func HashBranch(branch string) string
- func LoadEnv(t *testing.T, name string) string
- func LoadJson(t *testing.T, path string, v interface{})
- func Logger() *slog.Logger
- func ReconfigureLogger(logFormat, logLevel, logOutput string) error
- func SafeClose(closer io.Closer)
- func SafeRemove(path string)
- func SafeRemoveAll(path string)
- func SafeRollback(tx *sql.Tx)
- type TimeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CtxLogger ¶ added in v0.3.0
CtxLogger returns logger from context. If logger is not set, return default logger
func CtxRequestID ¶ added in v0.3.0
CtxRequestID returns request ID from context. If request ID is not set, return new request ID and context with it
func CtxTime ¶ added in v0.3.0
CtxTime returns time from context. If time is not set, return current time and context with it
func CtxWithLogger ¶ added in v0.3.0
WithLogger returns a new context with logger
func CtxWithTime ¶ added in v0.3.0
CtxWithTime returns a new context with time function
func DumpJson ¶ added in v0.3.0
DumpJson dumps v into JSON file for test code. If it fails, it fails the test.
func HashBranch ¶ added in v0.3.0
func LoadEnv ¶ added in v0.3.0
LoadEnv loads environment variable and return its value for test code. If the variable is not set, it skips the test.
func LoadJson ¶ added in v0.3.0
LoadJson loads JSON file and decode it into v for test code. If it fails, it fails the test.
func ReconfigureLogger ¶ added in v0.2.0
func SafeRemove ¶ added in v0.2.0
func SafeRemove(path string)
func SafeRemoveAll ¶ added in v0.2.0
func SafeRemoveAll(path string)