search

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagMinHeight = "minHeight"
	FlagMaxHeight = "maxHeight"
)

nolint

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "search",
	Short: "Search for specific transactions based on tags",
	Long: `Search has subcommands for each specific tx type.

Each one has specific flags it allows you to search on and
these are exposed on those subcommands. Returns all historical
transactions that match those tags.
`,
}

RootCmd represents the base command when called without any subcommands

Functions

func FindAnyTx

func FindAnyTx(prove bool, queries ...string) ([]*ctypes.ResultTx, error)

FindAnyTx search all of the strings sequentionally and returns combined result

func FindTx

func FindTx(query string, prove bool) ([]*ctypes.ResultTx, error)

FindTx performs the given search

func Foutput

func Foutput(w io.Writer, v interface{}) error

Foutput writes the output of wrapping height and info in the form {"data": <the_data>, "height": <the_height>} to the provider io.Writer

func Output

func Output(data interface{}) error

Output prints the search results from FormatSearch to stdout

Types

type TxExtractor

type TxExtractor func([]byte) (interface{}, error)

TxExtractor take an encoded tx and converts it to a usable format

type TxOutput

type TxOutput struct {
	Tx     interface{} `json:"tx"`
	Height int64       `json:"height"`
}

TxOutput is like the query output, but stores Tx data

func FormatSearch

func FormatSearch(res []*ctypes.ResultTx, fn TxExtractor) ([]TxOutput, error)

FormatSearch takes the FindTx results and converts them to a format to display with help of a TxExtractor that knows how to present the tx

Jump to

Keyboard shortcuts

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