neoneo-go/pkg/rpc/server/params/params.go
Roman Khimov adab83496c rpc: move Request, Params and related code server-side
It's absolutely irrelevant for the client and request/response packages should
only contain code that is useful on both sides of the conversation. It's OK
for client tests to reuse this code, but the package is used by external
developers and they shouldn't be bothered with it. Nothing changed
functionally here except WSClient simplification. Fixes #2236.
2022-07-08 17:38:53 +03:00

22 lines
345 B
Go

package params
import "fmt"
type (
// Params represents the JSON-RPC params.
Params []Param
)
// Value returns the param struct for the given
// index if it exists.
func (p Params) Value(index int) *Param {
if len(p) > index {
return &p[index]
}
return nil
}
func (p Params) String() string {
return fmt.Sprintf("%v", []Param(p))
}