Documentation
¶
Index ¶
- func InferSchemaFromType(rt reflect.Type, customTypes map[reflect.Type]*invopop.Schema) (*invopop.Schema, error)
- func IsCanceled(err error) bool
- func JSONToStruct(data []byte, v any) error
- func NewJSONRPCError(id string, code int, message string, data any) (*protocol.JSONRPCMessage, error)
- func NewJSONRPCNotification(method string, params any) (*protocol.JSONRPCMessage, error)
- func NewJSONRPCRequest(method string, params any) (*protocol.JSONRPCMessage, error)
- func NewJSONRPCResponse(id string, result any) (*protocol.JSONRPCMessage, error)
- func SchemaToJSONMap(schema *invopop.Schema) (protocol.JSONSchema, error)
- func StructToJSON(v interface{}) ([]byte, error)
- func StructToJSONSchema(v any) (protocol.JSONSchema, error)
- func ValidateJSONRPCMessage(msg *protocol.JSONRPCMessage) error
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 JSONToStruct ¶
func NewJSONRPCError ¶
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 StructToJSONSchema ¶
func StructToJSONSchema(v any) (protocol.JSONSchema, error)
func ValidateJSONRPCMessage ¶
func ValidateJSONRPCMessage(msg *protocol.JSONRPCMessage) error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.