utils

package
v1.2.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InferSchemaFromType added in v1.2.7

func InferSchemaFromType(rt reflect.Type, customTypes map[reflect.Type]*invopop.Schema) (*invopop.Schema, error)

InferSchemaFromType 使用 invopop/jsonschema 生成对象类型的 JSON Schema。

func IsCanceled

func IsCanceled(err error) bool

func JSONToStruct

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

func NewJSONRPCError

func NewJSONRPCError(id string, code int, message string, data any) (*protocol.JSONRPCMessage, error)

func NewJSONRPCNotification

func NewJSONRPCNotification(method string, params any) (*protocol.JSONRPCMessage, error)

func NewJSONRPCRequest

func NewJSONRPCRequest(method string, params any) (*protocol.JSONRPCMessage, error)

func NewJSONRPCResponse

func NewJSONRPCResponse(id string, result any) (*protocol.JSONRPCMessage, error)

func SchemaToJSONMap added in v1.2.7

func SchemaToJSONMap(schema *invopop.Schema) (protocol.JSONSchema, error)

SchemaToJSONMap 将 invopop.Schema 转为协议使用的 JSON Schema 格式。

func StructToJSON

func StructToJSON(v interface{}) ([]byte, error)

func StructToJSONSchema

func StructToJSONSchema(v any) (protocol.JSONSchema, error)

func ValidateJSONRPCMessage

func ValidateJSONRPCMessage(msg *protocol.JSONRPCMessage) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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