mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-27 13:58:05 +00:00
2e8bbf2a87
Parse request parameters on-demand.
22 lines
346 B
Go
22 lines
346 B
Go
package request
|
|
|
|
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))
|
|
}
|