utils

package
v0.7.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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