parser

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PARSE_PARAMS = 0
	PARSE_RESULT = 1
)

Variables

This section is empty.

Functions

func CapStringLen

func CapStringLen(inp string) string

func GetDataToParse

func GetDataToParse(rpcInput RPCInput, dataSource int) (interface{}, error)

Move to RPCInput

func Parse

func Parse(rpcInput RPCInput, blockParser spectypes.BlockParser, dataSource int) ([]interface{}, error)

this function returns the block that was requested,

func ParseBlockFromParams

func ParseBlockFromParams(rpcInput RPCInput, blockParser spectypes.BlockParser) (int64, error)

this function returns the block that was requested,

func ParseBlockFromReply

func ParseBlockFromReply(rpcInput RPCInput, blockParser spectypes.BlockParser) (int64, error)

this function returns the block that was requested,

func ParseByArg

func ParseByArg(rpcInput RPCInput, input []string, dataSource int) ([]interface{}, error)

func ParseCanonical

func ParseCanonical(rpcInput RPCInput, input []string, dataSource int) ([]interface{}, error)

expect input to be keys[a,b,c] and a canonical object such as

{
  "a": {
      "b": {
         "c": "wanted result"
       }
   }
}

should output an interface array with "wanted result" in first index 0

func ParseDefault

func ParseDefault(rpcInput RPCInput, input []string, dataSource int) []interface{}

func ParseDefaultBlockParameter

func ParseDefaultBlockParameter(block string) (int64, error)

func ParseDictionary

func ParseDictionary(rpcInput RPCInput, input []string, dataSource int) ([]interface{}, error)

ParseDictionary return a value of prop specified in args if exists in dictionary if not return an error

func ParseDictionaryOrDefault added in v0.5.0

func ParseDictionaryOrDefault(rpcInput RPCInput, input []string, dataSource int) ([]interface{}, error)

ParseDictionaryOrDefault return a value of prop specified in args if exists in dictionary if not it returns default value also specified in args

func ParseDictionaryOrOrdered

func ParseDictionaryOrOrdered(rpcInput RPCInput, input []string, dataSource int) ([]interface{}, error)

ParseDictionaryOrOrdered return a value of prop specified in args if exists in dictionary if not return an item from specified index

func ParseMessageResponse

func ParseMessageResponse(rpcInput RPCInput, resultParser spectypes.BlockParser) ([]interface{}, error)

this function returns the block that was requested,

Types

type RPCInput

type RPCInput interface {
	GetParams() interface{}
	GetResult() json.RawMessage
	ParseBlock(block string) (int64, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL