utils

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2026 License: Apache-2.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompactJSON

func CompactJSON(raw json.RawMessage) string

func CompactRawJSONMap

func CompactRawJSONMap(in map[string]json.RawMessage) map[string]string

func TimeOrZero

func TimeOrZero(t *time.Time) time.Time

TimeOrZero dereferences *time.Time, returning zero value for nil. Useful for converting nullable DB timestamps to in-memory structs.

func TimeToPtr

func TimeToPtr(t time.Time) *time.Time

TimeToPtr converts time.Time to *time.Time, returning nil for zero values. Useful for converting in-memory timestamps to nullable DB fields.

func TimeToUnix

func TimeToUnix(t *time.Time) int64

TimeToUnix converts *time.Time to unix seconds, returning 0 for nil. Useful for converting nullable timestamps to protobuf int64 fields.

func UnixOrZero

func UnixOrZero(t time.Time) int64

UnixOrZero returns unix seconds for non-zero time.Time, or 0 for zero time.Time.

func UnixToTimePtr

func UnixToTimePtr(sec int64) *time.Time

UnixToTimePtr converts unix seconds to *time.Time, returning nil for zero/negative values. Useful for converting protobuf int64 timestamps to nullable DB fields.

Types

type LoggingTransport

type LoggingTransport struct {
	Base  http.RoundTripper
	Label string
}

loggingTransport dumps every request and response between the BFF and MDS at klog -v=2 (verbose). Errors and non-2xx responses always log at info. Enable with `--v=2` (or env KLOG_V=2) when debugging the OpenAI SDK payloads.

func (*LoggingTransport) RoundTrip

func (t *LoggingTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL