Documentation
¶
Index ¶
- func CompactJSON(raw json.RawMessage) string
- func CompactRawJSONMap(in map[string]json.RawMessage) map[string]string
- func FormatCompletionWindow(duration time.Duration) (string, error)
- func ParseCompletionWindow(value string) (time.Duration, error)
- func TimeOrZero(t *time.Time) time.Time
- func TimeToPtr(t time.Time) *time.Time
- func TimeToUnix(t *time.Time) int64
- func UnixOrZero(t time.Time) int64
- func UnixToTimePtr(sec int64) *time.Time
- type LoggingTransport
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 FormatCompletionWindow ¶ added in v0.8.0
FormatCompletionWindow rounds a positive duration down to the nearest minute and formats it using the largest applicable units in d, h, min order.
func ParseCompletionWindow ¶ added in v0.8.0
ParseCompletionWindow parses a positive completion window composed of days, hours, and minutes, for example "1d2h", "1h38min", or "72min".
func TimeOrZero ¶
TimeOrZero dereferences *time.Time, returning zero value for nil. Useful for converting nullable DB timestamps to in-memory structs.
func TimeToPtr ¶
TimeToPtr converts time.Time to *time.Time, returning nil for zero values. Useful for converting in-memory timestamps to nullable DB fields.
func TimeToUnix ¶
TimeToUnix converts *time.Time to unix seconds, returning 0 for nil. Useful for converting nullable timestamps to protobuf int64 fields.
func UnixOrZero ¶
UnixOrZero returns unix seconds for non-zero time.Time, or 0 for zero time.Time.
func UnixToTimePtr ¶
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.