Primitive Types
Primitives Summary
Type | Description |
---|---|
int | The |
float | The |
boolean | The |
string | The |
json | The |
xml | The |
any | The |
blob | The |
typedesc | The |
record | The |
array | The |
map | The |
union | The |
tuple | The |
table | The |
stream | The |
future | The |
function | The |
table<$anonType$builtin$4> | |
future<any> | |
map<any> | |
table<$anonType$builtin$1> | |
table<$anonType$builtin$3> | |
table<$anonType$builtin$2> | |
stream<any> | |
table<$anonType$builtin$5> |
int
The int
data type is a 64-bit two's complement integer.
float
The float
data type is a double-precision 64-bit IEEE 754 floating point.
boolean
The boolean
data type has only two possible values of true
and false
. A variable of boolean
type defaults to true
.
string
The string
data type is a series of characters gathered together.
-
<string> contains(string substring) returns (boolean)
Returns a Boolean value indicating whether a string contains the specified substring.
Parameter Name Data Type Default Value Description substring string The substring to be compared
Return Type Description boolean True if the string contains the substring; false otherwise
-
<string> equalsIgnoreCase(string anotherString) returns (boolean)
Compares two strings, ignoring the case of the strings.
Parameter Name Data Type Default Value Description anotherString string The string to be compared
Return Type Description boolean True if the strings are equal; false otherwise
-
<string> findAll(string regex) returns (string[]|error<>)
Finds all the strings matching the regular expression.
Parameter Name Data Type Default Value Description regex string Regular expression
Return Type Description string[]|error<> The matching string array. Error will be returned if there exist a syntax error in pattern
-
<string> hasPrefix(string prefix) returns (boolean)
Returns a Boolean value indicating whether a string starts with the specified prefix.
Parameter Name Data Type Default Value Description prefix string The prefix to be compared
Return Type Description boolean True if the string starts with the prefix; false otherwise
-
<string> hasSuffix(string suffix) returns (boolean)
Returns a Boolean value indicating whether the string ends with specified suffix.
Parameter Name Data Type Default Value Description suffix string The suffix to be compared
Return Type Description boolean True if the string ends with the suffix; false otherwise
-
<string> hashCode() returns (int)
Returns a hash code for this string.
Return Type Description int a hash code value for this string.
-
<string> indexOf(string substring) returns (int)
Returns the first index of the first occurence of the substring within the specified string.
Parameter Name Data Type Default Value Description substring string The substring to search for
Return Type Description int The index of the first occurence of the substring
-
<string> lastIndexOf(string substring) returns (int)
Returns the first index of the last occurence of the substring within the specified string.
Parameter Name Data Type Default Value Description substring string The substring to search for
Return Type Description int The index of the last occurence of the substring
-
<string> length() returns (int)
Returns the length of the specified string.
Return Type Description int The length of the specified string
-
<string> matches(string regex) returns (boolean|error<>)
Returns a Boolean value indicating whether the string matches the regular expression.
Parameter Name Data Type Default Value Description regex string Regular expression
Return Type Description boolean|error<> True if the string matches the regex; false otherwise. Error will be returned if there exist a syntax error in pattern.
-
<string> replace(string regex, string replaceWith) returns (string)
Replaces all instances of the replacePattern string with the replaceWith string and returns the result.
Parameter Name Data Type Default Value Description regex string The pattern to search for
replaceWith string The replacement string
Return Type Description string The derived string
-
<string> replaceAll(string regex, string replaceWith) returns (string)
Replaces each substring of the string that matches the given regular expression with the given replacement.
Parameter Name Data Type Default Value Description regex string The regular expression to search for
replaceWith string The replacement string
Return Type Description string The derived string
-
<string> replaceFirst(string regex, string replaceWith) returns (string)
Replaces the first instance of the replacePattern with the replaceWith string and returns the result.
Parameter Name Data Type Default Value Description regex string The pattern to search for
replaceWith string The replacement string
Return Type Description string The derived string
-
<string> split(string regex) returns (string[])
Splits the string with the given regular expression to produce a string array.
Parameter Name Data Type Default Value Description regex string The regex to split the string
Return Type Description string[] The split string array
-
<string> substring(int startIndex, int endIndex) returns (string)
Returns a new string that is the substring of the specified string.
Parameter Name Data Type Default Value Description startIndex int The starting index
endIndex int The ending index
Return Type Description string The derived sub string
-
<string> toByteArray(string encoding) returns (byte[])
Converts string to a byte array.
Parameter Name Data Type Default Value Description encoding string Encoding to be used in the conversion
Return Type Description byte[] The byte array representation of the given String
-
<string> toLower() returns (string)
Returns a string with all the characters converted to lowercase.
Return Type Description string The string converted to lowercase
-
<string> toUpper() returns (string)
Returns a string with all the characters converted to uppercase.
Return Type Description string The string converted to uppercase
-
<string> trim() returns (string)
Returns a trimmed string by omitting the leading and trailing whitespaces of the original string.
Return Type Description string The derived string
-
<string> unescape() returns (string)
Returns an unescaped string by omitting the escape characters of the original string.
Return Type Description string The derived string
json
The json
data type which represents the standard JSON
format. It is a collection of numbers
, string
, true
, false
, null
, an array
of JSON
, or an object
with key-value pairs where value is another JSON
.
-
<json> getKeys() returns (string[])
Returns an array of keys contained in the specified JSON.
Return Type Description string[] A string array of keys contained in the specified JSON
-
<json> remove(string key)
Removes each element that matches the given key.
Parameter Name Data Type Default Value Description key string Key of the field to remove
-
<json> toString() returns (string)
Converts a JSON object to a string representation.
Return Type Description string String value of the converted JSON
-
<json> toXML($anonType$builtin$0 options) returns (xml|error<>)
Converts a JSON object to a XML representation.
Parameter Name Data Type Default Value Description options $anonType$builtin$0 jsonOptions struct for JSON to XML conversion properties
Return Type Description xml|error<> The XML representation of the JSON
xml
The xml
data type represents an immutable sequence of zero or more XML
elements, comments, text or proccessing instructions.
-
<xml> appendChildren(xml children)
Append children to an XML if its an element type XML. Error otherwise. New children will be appended at the end of the existing children.
Parameter Name Data Type Default Value Description children xml children
-
<xml> copy() returns (xml)
Make a deep copy of an XML.
Return Type Description xml A Copy of the XML
-
<xml> elements() returns (xml)
Get all the items that are of element type in an XML sequence.
Return Type Description xml All the elements-type items in the given XML sequence
-
<xml> getElementName() returns (string)
Get the fully qualified name of the element as a string. Returns an empty string if the XML is not a singleton.
Return Type Description string Qualified name of the XML as a string
-
<xml> getItemType() returns (string)
Get the type of a XML as a string. If the XML is singleton, type can be one of 'element', 'text', 'comment' or 'pi'. Returns an empty string if the XML is not a singleton.
Return Type Description string Type of the XML as a string
-
<xml> getTextValue() returns (string)
Get the text value of a XML. If the XML is a sequence, concatenation of the text values of the members of the sequence is returned. If the XML is an element, then the text value of the sequence of children is returned. If the XML is a text item, then the text is returned. Otherwise, an empty string is returned.
Return Type Description string Text value of the xml
-
<xml> isEmpty() returns (boolean)
Check whether the XML sequence is empty.
Return Type Description boolean Boolean flag indicating whether the XML sequence is empty
-
<xml> isSingleton() returns (boolean)
Check whether the XML sequence contains only a single element.
Return Type Description boolean Boolean flag indicating whether the XML sequence contains only a single element
-
<xml> removeAttribute(string qname)
Remove an attribute from an XML.
Parameter Name Data Type Default Value Description qname string Qualified name of the attribute
-
<xml> removeChildren(string qname)
Remove children matching the given name from an XML. This operation has no effect if the XML is not an element type XML.
Parameter Name Data Type Default Value Description qname string Namespace qualified name of the children to be removed
-
<xml> select(string qname) returns (xml)
Get all the items that are of element type, and matches the given qualified name, in an XML sequence.
Parameter Name Data Type Default Value Description qname string Qualified name of the element
Return Type Description xml All the elements-type items in the given XML sequence, that matches the qualified name
-
<xml> selectDescendants(string qname) returns (xml)
Searches in children recursively for elements matching the qualified name and returns a sequence containing them all. Does not search within a matched result.
Parameter Name Data Type Default Value Description qname string Qualified name of the element
Return Type Description xml All the descendants that matches the given qualified name, as a sequence
-
<xml> setAttributes(map attributes)
Sets the attributes to the provided attributes map.
Parameter Name Data Type Default Value Description attributes map Attributes map
-
<xml> setChildren(xml children)
Set the children of an XML if its a singleton. An Error otherwise. Any existing children will be removed.
Parameter Name Data Type Default Value Description children xml children
-
<xml> slice(int startIndex, int endIndex) returns (xml)
Slice and return a subsequence of the an XML sequence.
Parameter Name Data Type Default Value Description startIndex int Start index, inclusive
endIndex int End index, exclusive
Return Type Description xml Sliced sequence
-
<xml> strip() returns (xml)
Strips any text items from an XML sequence that are all whitespace.
Return Type Description xml Striped sequence
-
<xml> toJSON($anonType$builtin$11 options) returns (json)
Converts a XML object to a JSON representation.
Parameter Name Data Type Default Value Description options $anonType$builtin$11 xmlOptions struct for XML to JSON conversion properties
Return Type Description json JSON representation of the given XML
any
The any
data type represents all the available data types.
blob
The blob
data type represents a sequence of bytes.
typedesc
The typedesc
data type as a special type whose values are the types that are in the BVM.
record
The record
data type represents a mutable mapping from keys, which are strings, to values; specifies maps in terms of names of fields (required keys) and value for each field.
array
The array
data type represents a dynamic length, mutable list of values, where each member of the list is specified with the same type.
map
The map
data type represents a mutable mapping from keys, which are strings, to values; specifies maps in terms of a single type to which all keys are mapped.
union
The union
type which is defined as a set of given types, where at one given time, a value of that type can contain one of the given types.
tuple
The tuple
data type represents a fixed length, immutable, list of values, where each member of the list has its own type.
table
The table
data type consists of three main elments. The primaryKeys
element defines the fields of the table that act as primary keys. The indices
element defines the the fields of the table that are not primary keys. The values
element defines array of records for the table.
stream
The stream
data type allows publishing and subscribing, where functions introduced for each subscription to the stream (as function pointers) would be invoked for the events published to the stream.
future
The future
data type represents an asynchronous function invocation, which can be used to read the return value of the asynchronous function or do control operations for the function execution, such as cancel
, isDone()
and isCancelled()
.
function
The function
data type function with 0 or more specified parameter types and a single return type.
table<$anonType$builtin$4>
-
<table<$anonType$builtin$4>> add(any data) returns (error<>|null)
Add record to the table.
Parameter Name Data Type Default Value Description data any A record with data
Return Type Description error<>|null An
error
will be returned if there is any error occured during adding data or else nil is returned
future<any>
-
<future<any>> cancel() returns (boolean)
Cancels the given future.
Return Type Description boolean true if the future was cancelled; false otherwise
-
<future<any>> isCancelled() returns (boolean)
Checks if the given future is cancelled.
Return Type Description boolean true if the future is cancelled; false otherwise
-
<future<any>> isDone() returns (boolean)
Checks if the given future is done.
Return Type Description boolean true if the future is done; false otherwise
map<any>
-
<map<any>> clear()
Clear the items from given map.
-
<map<any>> hasKey(string key) returns (boolean)
Check whether specific key exists from the given map.
Parameter Name Data Type Default Value Description key string The key to be find existence
Return Type Description boolean -
<map<any>> keys() returns (string[])
Returns an array of keys contained in the specified map.
Return Type Description string[] A string array of keys contained in the specified map
-
<map<any>> remove(string key) returns (boolean)
Removes the specified element from the map.
Parameter Name Data Type Default Value Description key string The key to be removed
Return Type Description boolean A boolean to indicate whether the key is removed or not from map
-
<map<any>> values() returns (any[])
Returns an array of values contained in the specified map.
Return Type Description any[] An any array of values contained in the specified map
table<$anonType$builtin$1>
-
<table<$anonType$builtin$1>> close()
Releases the database connection. If the table data is fully iterated, it will be automatically closed. This explicit close is required only if it is not fully iterated.
table<$anonType$builtin$3>
-
<table<$anonType$builtin$3>> getNext() returns (any)
Retrives the current row and return a record with the data in the columns.
Return Type Description any The resulting row as a record
table<$anonType$builtin$2>
-
<table<$anonType$builtin$2>> hasNext() returns (boolean)
Checks for a new row in the given table. If a new row is found, moves the cursor to it.
Return Type Description boolean True if there is a new row; false otherwise
stream<any>
-
<stream<any>> publish(any data)
Publishes data to the stream.
Parameter Name Data Type Default Value Description data any Data to be published to the stream
-
<stream<any>> subscribe(function (any) returns () func)
Subscribes to data from the stream.
Parameter Name Data Type Default Value Description func function (any) returns () The function pointer for the subscription, which will be invoked with data published to the stream
table<$anonType$builtin$5>
-
<table<$anonType$builtin$5>> remove(function (any) returns (boolean) func) returns (int|error<>)
Remove data from the table.
Parameter Name Data Type Default Value Description func function (any) returns (boolean) The function pointer for delete crieteria
Return Type Description int|error<> An
int
the number of deleted record count orerror
if any error occured during removing data