feat: add execution history queries and preserve bounded JSON payloads
This commit is contained in:
18
sdk/go/json_wire.go
Normal file
18
sdk/go/json_wire.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package orbit
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// marshalWire 不做 HTML 转义,保持 RawMessage 精确数字及受控载荷大小。
|
||||
// 这些文档只用于 JSON/WS 通道,不能直接嵌入 HTML。
|
||||
func marshalWire(value any) ([]byte, error) {
|
||||
var buffer bytes.Buffer
|
||||
encoder := json.NewEncoder(&buffer)
|
||||
encoder.SetEscapeHTML(false)
|
||||
if err := encoder.Encode(value); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return bytes.TrimSuffix(buffer.Bytes(), []byte{'\n'}), nil
|
||||
}
|
||||
Reference in New Issue
Block a user