data

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: Apache-2.0 Imports: 5 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 BTCParams.

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 BTCParams

type Response

type Response struct {
	Data     []byte `json:"data"`
	ErrorMsg string `json:"errorMsg,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 Router added in v0.14.3

type Router interface {
	Add(Type, interface{}) error
	Get(Type) (interface{}, error)
}

Router interface supplies functionality to add a store to the Data package.

type StorageRouter added in v0.14.3

type StorageRouter struct {
	// contains filtered or unexported fields
}

func NewStorageRouter added in v0.14.3

func NewStorageRouter() StorageRouter

func (StorageRouter) Add added in v0.14.3

func (s StorageRouter) Add(storeType Type, storeObj interface{}) error

Add a new store to the router

func (StorageRouter) Get added in v0.14.3

func (s StorageRouter) Get(storeType Type) (interface{}, error)

Get the structure of store ,using the Type

type TransactionData

type TransactionData []byte

type Type added in v0.14.3

type Type string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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