streams
- the core concept behind ParsiQL. One can imagine the stream of events as an infinite sequence of structs. There are two categories of streams:
Native streams consist of produced native events:Transfers
,Calls
andLogs
. User streams are formed from native ones or other user streams.
1stream YourUserStream2from SourceStreamCopied!
true
, false
. Supported operators:!
(logical negation)&&
(logical conjunction, “and”)||
(logical disjunction, “or”)==
, !=
(boolean equality and inequality)-2^255
- 2^255 -1
. Supported operators:+
(addition)-
(subtraction)*
(multiplication)/
(integer division rounded towards zero)<
, <=
, ==
, !=
, >=
, >
(integer comparisons)"anything between double quotes is an UTF-8 string"
. Supported operators:+
(concatenation)==
, !=
(string equality and inequality)0x215d4e8096ca21529ebb7168a2223e1102a59cea
. Address of either externally owned account or smart contract.{ prop1: value1, prop2: value2, ... }
. Supported operators:.
(access struct’s property)==
, !=
(struct equality and inequality)[ value0, value1, ... ]
. Supported operators:[i]
(access i-th element of an array; starts from 0)in
(check that provided value is in the array)==
, !=
(equality and inequality)[address]
(access table row with a primary key equal to the provided address)in
(check that provided address is among the table primary keys)emit
language construct is available. The stream of such events will be immediately set for delivery on all of the Smart-Trigger’s delivery channels.
Dataset variables of a primitive kind with a particular primitive type are represented as ParsiQL variables that hold values of according primitive types. Dataset variables of struct and table kinds are represented as ParsiQL variables that hold values of according complex types.
where
clause. In addition, filters can be chained.&&
):||
(or) expression or at least in one of &&
(and) expression.select
clause that takes a struct that represents the transformed event from the source stream.process
block is different from other transformations, as it can be stateful, provides advanced language elements and allows producing child streams.state
keyword and initialized with some value on the same line.emit .. to
statement inside the process
block that acts similarly to the select
one. By executing this line, the newly-formed event would end up being in the child stream.code_address
property.