initial import of sources

This commit is contained in:
2022-06-29 14:31:00 +02:00
commit d5e5fd3700
31 changed files with 2274 additions and 0 deletions

31
response.go Normal file
View File

@@ -0,0 +1,31 @@
/*
*
* Copyright 2022 Oleg Borodin <borodin@unix7.org>
*
*/
package dsrpc
import (
"encoding/json"
)
type Response struct {
Error string `json:"error,omitempty" msgpack:"error,omitempty"`
Result any `json:"result,omitemty" msgpack:"result,omitemty"`
}
func NewResponse() *Response {
return &Response{}
}
func (this *Response) JSON() []byte {
jBytes, _ := json.Marshal(this)
return jBytes
}
func (this *Response) Pack() ([]byte, error) {
rBytes, err := json.Marshal(this)
return rBytes, err
}