VirtualColumn class base
A description used within a Scheme to define a generated virtual column.
A virtual column is added to the mapping table and is useful for
extracting the result of an sql expression that operates on the
library-defined columns. For example, an expression may return a particular
data element from a JSON value stored in the value column. If kinds is
empty, an expression is evaluated for every row; otherwise, it is evaluated
only for rows whose kinds are included in the kinds property, while rows
of other kinds will have NULL as the value of the virtual column.
Limitation: virtual columns that refer to other application-defined virtual columns are not supported and may fail the migration procedure. It is safe to refer to the value, kind, keyid, and rowid columns.
In the following fragment, a virtual column named "numFlatware" calculates
the total number of forks and spoons for rows of the "Kitchen" kind using
SqlJX in the expression:
var vc = VirtualColumn(
name: "numFlatware",
kinds: ["Kitchen"],
sql: SqlJX.std("numForks") + SqlJX.std("numSpoons"),
);
/* ... */
See also: PartialIndex.
- Inheritance
-
- Object
- SchemeElement
- VirtualColumn
- Annotations
-
- @immutable
Constructors
- VirtualColumn({int version = schemeElementInitialVersion, required String name, required KindList kinds, required Sql sql})
- Creates a description of a virtual column using the given parameters.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- kinds → KindList
-
The kinds of rows to which the evaluation of the column value is limited.
final
- lcName → String
-
The lowercase variant of name.
finalinherited
- name → String
-
A string representing the name of the provided description.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sql → Sql
-
The expression whose result forms the value of the virtual column.
final
- version → int
-
An integer representing the version of the provided description.
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDefinition(
) → Map< String, Object> -
Returns a JSON that changes when SchemeElement properties change.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited