The .identity() function adds a column to the result collection with a sequence of numbers starting at 1. Typically called a row number when used in databases. The .identity() function can be placed anywhere after the .from() and before the .select() functions.
Constructor Settings
The constructor takes an optional setting to globally set inserting a row number on all jinqJs queries.
Simple Arrays
In the case the .identity() is used on a simple array of strings or numbers, then the simple array will be converted to an array of JSON objects, with original value of the array being assigned to a property called โValueโ. This field a of โValueโ can be changed using the .select().
The .identity() function can take a zero parameter. If the parameter is omitted then the sequence column is labeled Id.
No Parameter
identity()
identity(): jinqJs;
String Parameter
When a string parameter is specified then the sequence field will be named as such.
identity(string)
identity(fieldName: string): jinqJs;