data

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagOLVMResult  = "action_olvm_result"
	TagOLVMRequest = "action_olvm_request"
	TagOLVMContext = "action_olvm_context"
)

Variables

View Source
var (
	ErrParamNotFound  = errors.New("param not found")
	ErrWrongParamType = errors.New("wrong param type")
)

Functions

This section is empty.

Types

type ContractData

type ContractData struct {
	Address []byte
	Data    map[string]interface{}
}

func NewContractData

func NewContractData(address []byte) *ContractData

NewContractData returns a pointer to a new ContractData object. It takes an address as an input.

func (*ContractData) Get

func (data *ContractData) Get(key string) interface{}

func (*ContractData) Update

func (data *ContractData) Update(d map[string]interface{}) error

func (*ContractData) UpdateByJSONData

func (data *ContractData) UpdateByJSONData(in []byte) error

func (*ContractData) Validate

func (data *ContractData) Validate(address []byte) bool

type OLVMContext

type OLVMContext struct {
	Data map[string]interface{}
}

func (OLVMContext) GetValue

func (context OLVMContext) GetValue(key string) interface{}

type OLVMRequest

type OLVMRequest struct {
	From        string
	Address     string
	CallString  string
	Value       int
	SourceCode  []byte
	Reference   []byte
	Transaction TransactionData
	Context     OLVMContext
}

All of the input necessary to perform a computation on a transaction

func NewOLVMRequest

func NewOLVMRequest(script []byte, context OLVMContext) *OLVMRequest

func NewOLVMResultWithCallString

func NewOLVMResultWithCallString(script []byte, callString string, context OLVMContext) *OLVMRequest

type OLVMResult

type OLVMResult struct {
	Status       string
	Out          string
	Ret          string // TODO: Should be a real name
	Elapsed      string
	Reference    []byte
	Transactions []TransactionData
	Context      OLVMContext
}

All of the output received from the computation

func NewOLVMResult

func NewOLVMResult() *OLVMResult

type Request

type Request struct {
	Query  string                 // the query method
	Data   []byte                 // data stored as a serialized byte array
	Params map[string]interface{} // request params as a map of string to interface
}
Request

Request generic request object for Query handling. Request comes with its query string and parameters

func NewRequest

func NewRequest(query string, params map[string]interface{}) (*Request, error)

NewRequest creates a new request with given Params.

func NewRequestFromData

func NewRequestFromData(query string, dat []byte) *Request

NewRequestFromData creates a new request object from a byte array

func NewRequestFromObj

func NewRequestFromObj(query string, obj interface{}) (*Request, error)

NewRequestFromObj creates a new request object from an arguments struct passed. It serializes the argument struct object for a client channel and sets it against an argname. You can check example argument structs in client/request.

func (*Request) ClientDeserialize

func (r *Request) ClientDeserialize(name string, obj interface{}) error

func (*Request) GetBool

func (r *Request) GetBool(key string) (bool, error)

func (*Request) GetBytes

func (r *Request) GetBytes(key string) []byte

GetBytes retrieves a byte array

func (*Request) GetFloat64

func (r *Request) GetFloat64(key string) float64

func (*Request) GetInt

func (r *Request) GetInt(key string) int

func (*Request) GetString

func (r *Request) GetString(key string) string

GetString retrieves a string parameter saved in a request object. If a string parameter is not set or the object type of the parameter is not string an empty string is returned. All calling instances are required to check and handle empty string.

func (*Request) Parse

func (r *Request) Parse()

Parse parses the serialized parameters data and saves it to Params

type Response

type Response struct {
	Data     []byte `json:"data"`
	ErrorMsg string `json:"error_msg,omitempty"`
	Success  bool   `json:"success"`
}

Response

func (*Response) Error

func (r *Response) Error(msg string)

func (*Response) JSON

func (r *Response) JSON(a interface{}) (err error)

func (*Response) SetData

func (r *Response) SetData(dat []byte)

func (*Response) SetDataObj

func (r *Response) SetDataObj(obj interface{}) error

type TransactionData

type TransactionData []byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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