kitutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package kitutil holds the dependency-free helpers shared by the conversion kit packages (dto, types, relayconvert). It moved out of the host's common package as part of the relaykit extraction; common re-exports these for host code.

Index

Constants

This section is empty.

Variables

View Source
var Debug atomic.Bool

Debug reports whether verbose kit diagnostics are enabled. The host sets this once at startup (new-api mirrors common.DebugEnabled into it).

Functions

func Any2Type

func Any2Type[T any](data any) (T, error)

func DecodeJson

func DecodeJson(reader io.Reader, v any) error

func GetJsonType

func GetJsonType(data json.RawMessage) string

func GetPointer

func GetPointer[T any](v T) *T

func GetTimestamp

func GetTimestamp() int64

func GetUUID

func GetUUID() string

func Interface2String

func Interface2String(inter interface{}) string

func JsonRawMessageToString

func JsonRawMessageToString(data json.RawMessage) string

JsonRawMessageToString returns JSON strings as their decoded value and other JSON values as raw text.

func LogError

func LogError(message string)

func LogInfo

func LogInfo(message string)

func LogSystemError

func LogSystemError(message string)

LogSystemError reports an internal converter failure through its dedicated hook, keeping it distinct from malformed request-data diagnostics.

func Marshal

func Marshal(v any) ([]byte, error)

func MaskSensitiveInfo

func MaskSensitiveInfo(str string) string

MaskSensitiveInfo masks sensitive information like URLs, IPs, and domain names in a string Example: http://example.com -> http://***.com https://api.test.org/v1/users/123?key=secret -> https://***.org/***/***/?key=*** https://sub.domain.co.uk/path/to/resource -> https://***.co.uk/***/*** 192.168.1.1 -> ***.***.***.*** openai.com -> ***.com www.openai.com -> ***.***.com api.openai.com -> ***.***.com

func SetLogging

func SetLogging(info LogFunc, errorFn LogFunc)

func SetSystemErrorLogging

func SetSystemErrorLogging(errorFn LogFunc)

SetSystemErrorLogging configures the hook for internal converter failures.

func String2Int

func String2Int(str string) int

func StringToByteSlice

func StringToByteSlice(s string) []byte

func Unmarshal

func Unmarshal(data []byte, v any) error

func UnmarshalJsonStr

func UnmarshalJsonStr(data string, v any) error

Types

type LogFunc

type LogFunc func(message string)

Jump to

Keyboard shortcuts

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