mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 18:12:26 +00:00
23 lines
409 B
Go
23 lines
409 B
Go
package rpc
|
|
|
|
import "encoding/json"
|
|
|
|
func NewError(code int, message string, id *json.RawMessage) *RPCResponse {
|
|
return &RPCResponse{
|
|
JSONRPC: JSONRPCVersion,
|
|
ID: id,
|
|
Error: map[string]any{
|
|
"code": code,
|
|
"message": message,
|
|
},
|
|
}
|
|
}
|
|
|
|
func NewResponse(result any, id *json.RawMessage) *RPCResponse {
|
|
return &RPCResponse{
|
|
JSONRPC: JSONRPCVersion,
|
|
ID: id,
|
|
Result: result,
|
|
}
|
|
}
|