Versions in this module Expand all Collapse all v0 v0.2.0 Feb 22, 2023 Changes in this version type CallOption + func ExtraField(name string, value interface{}) CallOption type ConnOpt + func SetLogger(logger Logger) ConnOpt type ObjectStream + func NewPlainObjectStream(conn io.ReadWriteCloser) ObjectStream type Request + ExtraFields []RequestField + func (r *Request) SetExtraField(name string, v interface{}) error + type RequestField struct + Name string + Value interface{} v0.1.0 Apr 26, 2021 Changes in this version + const CodeInternalError + const CodeInvalidParams + const CodeInvalidRequest + const CodeMethodNotFound + const CodeParseError + var ErrClosed = errors.New("jsonrpc2: connection is closed") + type CallOption interface + func Meta(meta interface{}) CallOption + func PickID(id ID) CallOption + func StringID() CallOption + type Conn struct + func NewConn(ctx context.Context, stream ObjectStream, h Handler, opts ...ConnOpt) *Conn + func (c *Conn) Call(ctx context.Context, method string, params, result interface{}, ...) error + func (c *Conn) Close() error + func (c *Conn) DisconnectNotify() <-chan struct{} + func (c *Conn) DispatchCall(ctx context.Context, method string, params interface{}, opts ...CallOption) (Waiter, error) + func (c *Conn) Notify(ctx context.Context, method string, params interface{}, opts ...CallOption) error + func (c *Conn) Reply(ctx context.Context, id ID, result interface{}) error + func (c *Conn) ReplyWithError(ctx context.Context, id ID, respErr *Error) error + func (c *Conn) SendResponse(ctx context.Context, resp *Response) error + type ConnOpt func(*Conn) + func LogMessages(logger Logger) ConnOpt + func OnRecv(f func(*Request, *Response)) ConnOpt + func OnSend(f func(*Request, *Response)) ConnOpt + type Error struct + Code int64 + Data *json.RawMessage + Message string + func (e *Error) Error() string + func (e *Error) SetError(v interface{}) + type Handler interface + Handle func(context.Context, *Conn, *Request) + func AsyncHandler(h Handler) Handler + type HandlerWithErrorConfigurer struct + func HandlerWithError(...) *HandlerWithErrorConfigurer + func (h *HandlerWithErrorConfigurer) Handle(ctx context.Context, conn *Conn, req *Request) + func (h *HandlerWithErrorConfigurer) SuppressErrClosed() Handler + type ID struct + IsString bool + Num uint64 + Str string + func (id *ID) UnmarshalJSON(data []byte) error + func (id ID) MarshalJSON() ([]byte, error) + func (id ID) String() string + type JSONRPC2 interface + Call func(ctx context.Context, method string, params, result interface{}, ...) error + Close func() error + Notify func(ctx context.Context, method string, params interface{}, opt ...CallOption) error + type Logger interface + Printf func(format string, v ...interface{}) + type ObjectCodec interface + ReadObject func(stream *bufio.Reader, v interface{}) error + WriteObject func(stream io.Writer, obj interface{}) error + type ObjectStream interface + ReadObject func(v interface{}) error + WriteObject func(obj interface{}) error + func NewBufferedStream(conn io.ReadWriteCloser, codec ObjectCodec) ObjectStream + type PlainObjectCodec struct + func (PlainObjectCodec) ReadObject(stream *bufio.Reader, v interface{}) error + func (PlainObjectCodec) WriteObject(stream io.Writer, v interface{}) error + type Request struct + ID ID + Meta *json.RawMessage + Method string + Notif bool + Params *json.RawMessage + func (r *Request) SetMeta(v interface{}) error + func (r *Request) SetParams(v interface{}) error + func (r *Request) UnmarshalJSON(data []byte) error + func (r Request) MarshalJSON() ([]byte, error) + type Response struct + Error *Error + ID ID + Meta *json.RawMessage + Result *json.RawMessage + func (r *Response) SetResult(v interface{}) error + func (r *Response) UnmarshalJSON(data []byte) error + func (r Response) MarshalJSON() ([]byte, error) + type VSCodeObjectCodec struct + func (VSCodeObjectCodec) ReadObject(stream *bufio.Reader, v interface{}) error + func (VSCodeObjectCodec) WriteObject(stream io.Writer, obj interface{}) error + type VarintObjectCodec struct + func (VarintObjectCodec) ReadObject(stream *bufio.Reader, v interface{}) error + func (VarintObjectCodec) WriteObject(stream io.Writer, obj interface{}) error + type Waiter struct + func (w Waiter) Wait(ctx context.Context, result interface{}) error