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 ¶
- Variables
- func Any2Type[T any](data any) (T, error)
- func DecodeJson(reader io.Reader, v any) error
- func GetJsonType(data json.RawMessage) string
- func GetPointer[T any](v T) *T
- func GetTimestamp() int64
- func GetUUID() string
- func Interface2String(inter interface{}) string
- func JsonRawMessageToString(data json.RawMessage) string
- func LogError(message string)
- func LogInfo(message string)
- func LogSystemError(message string)
- func Marshal(v any) ([]byte, error)
- func MaskSensitiveInfo(str string) string
- func SetLogging(info LogFunc, errorFn LogFunc)
- func SetSystemErrorLogging(errorFn LogFunc)
- func String2Int(str string) int
- func StringToByteSlice(s string) []byte
- func Unmarshal(data []byte, v any) error
- func UnmarshalJsonStr(data string, v any) error
- type LogFunc
Constants ¶
This section is empty.
Variables ¶
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 GetJsonType ¶
func GetJsonType(data json.RawMessage) string
func GetPointer ¶
func GetPointer[T any](v T) *T
func GetTimestamp ¶
func GetTimestamp() int64
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 LogSystemError ¶
func LogSystemError(message string)
LogSystemError reports an internal converter failure through its dedicated hook, keeping it distinct from malformed request-data diagnostics.
func MaskSensitiveInfo ¶
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 SetSystemErrorLogging ¶
func SetSystemErrorLogging(errorFn LogFunc)
SetSystemErrorLogging configures the hook for internal converter failures.