Add SQL-style operators (#1322)
This commit is contained in:
1 parent
396543191c
commit
7bdf3a39ad
4 files changed
+125
No files matched your search
@@ -1835,6 +1835,46 @@ sections:
|
||||
input: '"2015-03-05T23:51:47Z"'
|
||||
output: ['1425599507']
|
||||
|
||||
- title: "SQL-Style Operators"
|
||||
body: |
|
||||
|
||||
jq provides a few SQL-style operators.
|
||||
|
||||
* INDEX(stream; index_expression):
|
||||
|
||||
This builtin produces an object whose keys are computed by
|
||||
the given index expression applied to each value from the
|
||||
given stream.
|
||||
|
||||
* JOIN($idx; stream; idx_expr; join_expr):
|
||||
|
||||
This builtin joins the values from the given stream to the
|
||||
given index. The index's keys are computed by applying the
|
||||
given index expression to each value from the given stream.
|
||||
An array of the value in the stream and the corresponding
|
||||
value from the index is fed to the given join expression to
|
||||
produce each result.
|
||||
|
||||
* JOIN($idx; stream; idx_expr):
|
||||
|
||||
Same as `JOIN($idx; stream; idx_expr; .)`.
|
||||
|
||||
* JOIN($idx; idx_expr):
|
||||
|
||||
This builtin joins the input `.` to the given index, applying
|
||||
the given index expression to `.` to compute the index key.
|
||||
The join operation is as described above.
|
||||
|
||||
* IN(s):
|
||||
|
||||
This builtin outputs `true` if `.` appears in the given
|
||||
stream, otherwise it outputs `false`.
|
||||
|
||||
* IN(source; s):
|
||||
|
||||
This builtin outputs `true` if any value in the source stream
|
||||
appears in the second stream, otherwise it outputs `false`.
|
||||
|
||||
- title: Conditionals and Comparisons
|
||||
entries:
|
||||
- title: "`==`, `!=`"
|
||||
|
||||
Reference in new issue
Block a user