### Install FlyQL
Source: https://github.com/iamtelescope/flyql/blob/main/javascript/packages/flyql/README.md
Installation commands for npm and pnpm.
```bash
npm install flyql
# or
pnpm add flyql
```
--------------------------------
### Go Renderer Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/advanced/custom-renderers.mdx
Example of registering a custom 'href' renderer in Go.
```APIDOC
## Go Example: HrefRenderer
```go
import (
flyql "github.com/iamtelescope/flyql/golang"
"github.com/iamtelescope/flyql/golang/columns"
"github.com/iamtelescope/flyql/golang/flyqltype"
"github.com/iamtelescope/flyql/golang/transformers"
)
type HrefRenderer struct{ columns.BaseRenderer }
func (HrefRenderer) Name() string { return "href" }
func (HrefRenderer) ArgSchema() []transformers.ArgSpec {
return []transformers.ArgSpec{{Type: flyqltype.String, Required: true}}
}
reg := columns.DefaultRendererRegistry()
_ = reg.Register(HrefRenderer{})
opts := columns.DiagnoseOptions{RendererRegistry: reg}
diags := columns.DiagnoseWithOptions(parsedColumns, schema, opts)
```
```
--------------------------------
### Install FlyQL Go package
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/getting-started/go.mdx
Use the go get command to add the FlyQL library to your project dependencies.
```bash
go get github.com/iamtelescope/flyql/golang
```
--------------------------------
### Installation
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/index.mdx
Instructions for installing the flyql-vue package and its dependencies.
```APIDOC
## Installation
### Description
Install the `flyql-vue` package and its peer dependency `vue`.
### Method
N/A (Package Installation)
### Endpoint
N/A (Package Installation)
### Parameters
N/A
### Request Example
```bash
npm install flyql-vue
npm install vue
```
### Response
N/A
```
--------------------------------
### Install FlyQL
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/getting-started/javascript.mdx
Install the package via npm.
```bash
npm install flyql
```
--------------------------------
### Install FlyQL for JavaScript
Source: https://github.com/iamtelescope/flyql/blob/main/README.md
Install FlyQL for JavaScript using npm.
```bash
npm install flyql
```
--------------------------------
### Install FlyQL for Python
Source: https://github.com/iamtelescope/flyql/blob/main/README.md
Install FlyQL for Python using pip or uv.
```bash
pip install flyql
```
```bash
uv add flyql
```
--------------------------------
### Install FlyQL
Source: https://context7.com/iamtelescope/flyql/llms.txt
Install the FlyQL library in your preferred language runtime using the respective package managers.
```bash
# Go
go get github.com/iamtelescope/flyql/golang
```
```bash
# Python
pip install flyql
```
```bash
# JavaScript
npm install flyql
```
--------------------------------
### Wildcard Examples
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/pattern-matching.mdx
Demonstrates the use of % for sequences and _ for single characters.
```flyql
host like 'prod%'
```
```flyql
code like 'E__'
```
--------------------------------
### Advanced Pattern Matching Examples
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/pattern-matching.mdx
Additional examples demonstrating regex and complex filtering logic.
```flyql
message ~ "error|fail"
```
```flyql
path ~ "^/api/v2"
```
```flyql
path !~ "^/health"
```
```flyql
host like 'prod%'
```
```flyql
host like 'prod%' and message ~ "timeout.*" and path !~ "^/health"
```
--------------------------------
### Install FlyQL
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/getting-started/python.mdx
Install the flyql package and its dependency google-re2 using pip. Requires Python 3.10+.
```bash
pip install flyql
```
--------------------------------
### Start of Time Units with startOf()
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/values.mdx
Use startOf() to get the beginning of the current day, week, or month. An optional timezone can be specified.
```FlyQL
created_at > startOf('day')
```
```FlyQL
created_at > startOf('week')
```
```FlyQL
created_at > startOf('month', 'Asia/Tokyo')
```
--------------------------------
### LIKE and Regex Syntax Examples
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/pattern-matching.mdx
Comparison of LIKE and regex syntax for various matching use cases.
```flyql
key like 'prefix%'
```
```flyql
host like 'prod%'
```
```flyql
key like '%word%'
```
```flyql
msg like '%error%'
```
```flyql
key ~ "pattern"
```
```flyql
host ~ "^prod-[0-9]+"
```
--------------------------------
### Install flyql-vue
Source: https://github.com/iamtelescope/flyql/blob/main/javascript/packages/flyql-vue/README.md
Install the flyql-vue package using npm or pnpm. Vue 3 is required as a peer dependency.
```bash
npm install flyql-vue
# or
pnpm add flyql-vue
```
```bash
npm install vue
```
--------------------------------
### Chained Renderers Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/renderers.mdx
Shows how to stack multiple renderers by separating them with additional pipes.
```plaintext
url as link|href("http://{{value}}")|badge("info")
```
--------------------------------
### Define Named Parameters
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Syntax examples for various named parameter formats.
```text
status = $code
```
```text
env = $my_env
```
```text
user = $_internal
```
--------------------------------
### Implement FlyqlColumns with basic configuration
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/columns-component.mdx
Use this setup to initialize the component with a column schema and handle parsed output.
```vue
```
--------------------------------
### Python Renderer Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/advanced/custom-renderers.mdx
Example of registering a custom 'href' renderer in Python, including its arguments, metadata, and a custom validation hook.
```APIDOC
## Python Example: HrefRenderer
```python
from flyql.flyql_type import Type
from flyql.renderers import ArgSpec, Renderer, RendererRegistry
from flyql.columns import parse, diagnose
from flyql.core.validator import Diagnostic
from flyql.core.range import Range
class HrefRenderer(Renderer):
arg_schema = (ArgSpec(type=Type.String, required=True),)
@property
def name(self) -> str:
return "href"
@property
def metadata(self):
return {"html_safe": True}
def diagnose(self, arguments, parsed_column):
if arguments and "{{value}}" not in arguments[0]:
return [Diagnostic(
range=Range(0, 1),
message="href template should contain {{value}}",
severity="warning",
code="custom_href_no_placeholder",
)]
return []
registry = RendererRegistry()
registry.register(HrefRenderer())
cols = parse('url as link|href("/users/{{value}}")', capabilities={"transformers": True, "renderers": True})
# ...then run the validator with both registries:
diags = diagnose(cols, schema, renderer_registry=registry)
```
```
--------------------------------
### Bind Parameters in Go
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Example of parsing and binding parameters using the Go API.
```go
import flyql "github.com/iamtelescope/flyql/golang"
ast, _ := flyql.Parse(`status = $code and env = $env`)
err := flyql.BindParams(ast.Root, map[string]any{
"code": 200,
"env": "prod",
})
```
--------------------------------
### Install flyql-vue
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/index.mdx
Install the flyql-vue npm package. It automatically includes the flyql core package.
```bash
npm install flyql-vue
```
--------------------------------
### Query syntax examples
Source: https://github.com/iamtelescope/flyql/blob/main/python/README.md
Common patterns for boolean operators and filter conditions.
```text
status=200 and active and not archived
service!=api or user="john doe"
message~"error.*" and not debug
(a=1 or b=2) and not (c=3 and d=4)
status in [200, 201] and method not in ['DELETE', 'PUT']
```
--------------------------------
### Full FlyQL ColumnSchema Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/schema.mdx
This example demonstrates defining various column types including enums, strings with async autocomplete, numbers, and nested objects, both static and schemaless.
```javascript
import { ColumnSchema } from 'flyql-vue'
const columns = ColumnSchema.fromPlainObject({
// Enum with static values
level: { type: 'enum', suggest: true, autocomplete: true, values: ['debug', 'info', 'error'] },
// String with async autocomplete
service: { type: 'string', suggest: true, autocomplete: true },
// Number — excludes regex operators
status_code: { type: 'number', suggest: true, autocomplete: true, values: [200, 400, 500] },
// Simple string
host: { type: 'string', suggest: true },
// Nested with known children
metadata: {
type: 'object',
suggest: true,
children: {
labels: {
type: 'object',
suggest: true,
children: {
tier: { type: 'string', suggest: true, autocomplete: true, values: ['dev', 'staging', 'prod'] },
env: { type: 'string', suggest: true, autocomplete: true },
},
},
version: { type: 'string', suggest: true },
},
},
// Schemaless — nested keys discovered at runtime
request: { type: 'object', suggest: true },
})
```
--------------------------------
### Combined Filtering Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/nested-keys.mdx
An example demonstrating the combination of nested key access with multiple operators for complex filtering.
```flyql
request.method = 'GET'
```
```flyql
response.headers.content_type = "application/json"
```
```flyql
"app.config".debug = true
```
```flyql
request.status >= 400 and response.body ~ "error" and not request.internal
```
--------------------------------
### String Containment Check with 'has' (example)
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/operators.mdx
Example demonstrating the 'has' operator for substring checking in strings.
```FlyQL
msg has 'err'
```
--------------------------------
### Query Examples
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/boolean-logic.mdx
Common query patterns using boolean logic.
```FlyQL
status = 200 and service = 'api'
```
```FlyQL
level = 'error' or level = 'critical'
```
```FlyQL
status >= 400 or level = 'error' and service = 'api'
```
```FlyQL
(status >= 400 or level = 'error') and service = 'api'
```
```FlyQL
(status >= 500 and host = 'prod') or (level = 'error' and not service = 'healthcheck')
```
--------------------------------
### JavaScript Renderer Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/advanced/custom-renderers.mdx
Example of registering a custom 'href' renderer in JavaScript, including its arguments, and a custom validation hook.
```APIDOC
## JavaScript Example: HrefRenderer
```javascript
import { Renderer, RendererRegistry, ArgSpec } from 'flyql/renderers'
import { Type } from 'flyql'
import { parse, diagnose } from 'flyql/columns'
class HrefRenderer extends Renderer {
get name() { return 'href' }
get argSchema() { return [new ArgSpec(Type.String, true)] }
diagnose(args, col) {
if (args && args[0] && !args[0].includes('{{value}}')) {
return [{
range: { start: 0, end: 1 },
message: 'href template should contain {{value}}',
severity: 'warning',
code: 'custom_href_no_placeholder',
}]
}
return []
}
}
const registry = new RendererRegistry()
registry.register(new HrefRenderer())
const cols = parse('url as link|href("/users/{{value}}")', { transformers: true, renderers: true })
const diags = diagnose(cols, schema, null, registry)
```
```
--------------------------------
### No-Argument Renderers Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/renderers.mdx
Demonstrates the syntax for renderers that do not require arguments, similar to argument-less transformers.
```plaintext
url as link|plain
```
--------------------------------
### Post-alias Pipe Syntax Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/renderers.mdx
Demonstrates the basic syntax for applying a renderer after an alias using a pipe.
```plaintext
url as link|href("http://{{value}}")
```
--------------------------------
### Column expression syntax example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/columns-component.mdx
Example of the supported comma-separated column expression format.
```text
message, status|upper, host as h, metadata.labels.env
```
--------------------------------
### FlyQL Introduction Query
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/index.mdx
A basic example of a FlyQL query string used for filtering data.
```text
service != 'api' AND (status >= 400 OR level = 'error') AND message =~ '.*timeout.*'
```
--------------------------------
### Define Positional Parameters
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Syntax example for 1-indexed positional parameters.
```text
a = $1 and b = $2
```
--------------------------------
### Operator Precedence Examples
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/boolean-logic.mdx
Demonstrating how FlyQL parses expressions based on operator precedence and associativity.
```FlyQL
a = 1 or b = 2 and c = 3
```
```FlyQL
a = 1 or (b = 2 and c = 3)
```
```FlyQL
a = 1 and b = 2 and c = 3
```
```FlyQL
(a = 1 and b = 2) and c = 3
```
--------------------------------
### Basic Query Structure Examples
Source: https://github.com/iamtelescope/flyql/blob/main/README.md
Illustrates basic FlyQL query structures including comparisons, boolean operators, regex matching, list membership, and temporal functions.
```sql
status=200 and active and not archived
```
```sql
-- comparisons with or
service!=api or user="john doe"
```
```sql
-- regex match and negation
message~"error.*" and not debug
```
```sql
-- grouped conditions
(a=1 or b=2) and not (c=3 and d=4)
```
```sql
-- list membership
status in [200, 201] and method not in ['DELETE', 'PUT']
```
```sql
-- temporal functions
timestamp > ago(1h) and level = 'error'
```
```sql
-- timezone-aware date
date = today('Europe/Berlin')
```
```sql
-- start of week
created_at > startOf('week')
```
```sql
-- Date (calendar day) vs DateTime (instant) column types drive
-- schema-aware matcher coercion: ISO-8601 literals auto-parse and the
-- record value is compared at the declared granularity.
event_day = '2026-04-06' -- Type.Date column: Y/M/D compare
ts > '2026-04-06T21:00:00Z' -- Type.DateTime column: ms-granularity compare
```
--------------------------------
### Install Vue 3 Peer Dependency
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/index.mdx
Install Vue 3 as a peer dependency for the flyql-vue package.
```bash
npm install vue
```
--------------------------------
### Bind Parameters in JavaScript
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Example of parsing and binding parameters using the JavaScript API.
```javascript
import { parse, bindParams } from 'flyql'
const ast = parse('status = $code and env = $env')
bindParams(ast.root, { code: 200, env: 'prod' })
```
--------------------------------
### Define Column Types
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/schema.mdx
Examples of individual column definitions for different data types.
```javascript
{ type: 'string', suggest: true }
```
```javascript
{ type: 'number', suggest: true }
```
```javascript
{ type: 'enum', suggest: true, autocomplete: true, values: ['debug', 'info', 'warning', 'error', 'critical'] }
```
```javascript
{
type: 'object',
suggest: true,
children: {
labels: {
type: 'object',
suggest: true,
children: {
tier: { type: 'string', suggest: true },
env: { type: 'string', suggest: true },
},
},
version: { type: 'string', suggest: true },
},
}
```
--------------------------------
### Additional transformer examples
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/transformers.mdx
Common patterns for filtering data using transformers.
```flyql
host|lower != "localhost"
```
```flyql
path|len > 0
```
--------------------------------
### Boolean SQL Generation Examples
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/values.mdx
Demonstrates how FlyQL boolean literals are translated into SQL across different dialects.
```SQL
field = true
```
```SQL
field = false
```
```SQL
field = TRUE
```
```SQL
field = FALSE
```
```SQL
field = true
```
```SQL
field = false
```
--------------------------------
### Example: Case-Insensitive Host Comparison
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/fr/syntax/transformers.mdx
Converts the 'host' column to lowercase before comparing it to 'localhost' to ensure a case-insensitive check.
```Flyql
host|lower != "localhost"
```
--------------------------------
### Basic List Operator Usage
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/lists.mdx
Standard examples for filtering fields using list membership.
```FlyQL
status in [200, 201, 204]
```
```FlyQL
env not in ['dev', 'test', 'staging']
```
```FlyQL
method in ['GET', 'POST'] and status not in [401, 403, 404]
```
--------------------------------
### Compare to the Start of a Day, Week, or Month
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/dates.mdx
The `startOf()` function allows comparison to the beginning of a specified period (day, week, month). This is useful for analyzing data within specific calendar cycles.
```flyql
event_time > startOf('week')
```
--------------------------------
### startOf(unit, [timezone])
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/values.mdx
Returns the start of the current day, week (Monday), or month, with an optional timezone.
```APIDOC
## startOf(unit, [timezone])
### Description
Returns the start of the current day, week (Monday), or month. Accepts an optional timezone.
### Method
N/A (Function within a query language)
### Endpoint
N/A
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
```flyql
created_at > startOf('day')
created_at > startOf('week')
created_at > startOf('month', 'Asia/Tokyo')
```
### Response
#### Success Response (200)
N/A (Returns a timestamp value)
#### Response Example
N/A
```
--------------------------------
### Define StarRocks Columns in Go
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/sql/starrocks.mdx
Example of defining columns for StarRocks, including native JSON and JSON-as-string types, using Go.
```go
columns := map[string]*starrocks.Column{
"message": starrocks.NewColumn(starrocks.ColumnDef{Name: "message", Type: "VARCHAR(255)"}),
"data": starrocks.NewColumn(starrocks.ColumnDef{Name: "data", Type: "JSON"}), // native JSON
"log": starrocks.NewColumn(starrocks.ColumnDef{Name: "log", Type: "jsonstring"}), // JSON-in-text
}
```
--------------------------------
### Compare to Today (Timezone-Aware)
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/dates.mdx
Employ the `today()` function for timezone-aware comparisons to the start of the current day. Specify the desired timezone, such as 'UTC', for accurate results.
```flyql
scheduled_for = today('UTC')
```
--------------------------------
### JavaScript Column Initialization with Type.String
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/advanced/column-types.mdx
Demonstrates initializing a Fly தேர்ந்தெடுத்த Column in JavaScript with the String type. This is a common setup for text-based columns.
```javascript
import { Column, Type } from 'flyql'
const col = new Column('host', Type.String)
// All twelve values:
Type.String
Type.Int
Type.Float
Type.Bool
Type.Date
Type.Duration
Type.Array
Type.Map
Type.Struct
Type.JSON
Type.JSONString
Type.Unknown
```
--------------------------------
### Quick Start: Go - Generate SQL WHERE clause
Source: https://github.com/iamtelescope/flyql/blob/main/README.md
Parse a FlyQL query and generate a SQL WHERE clause for ClickHouse using Go. Ensure the FlyQL Go packages are imported.
```go
import (
flyql "github.com/iamtelescope/flyql/golang"
"github.com/iamtelescope/flyql/golang/generators/clickhouse"
)
result, err := flyql.Parse("status >= 400 and host like 'prod%'" )
columns := map[string]*clickhouse.Column{
"status": clickhouse.NewColumn(clickhouse.ColumnDef{Name: "status", Type: "UInt32"}),
host: clickhouse.NewColumn(clickhouse.ColumnDef{Name: "host", Type: "String"}),
}
sql, err := clickhouse.ToSQLWhere(result.Root, columns)
```
--------------------------------
### Apply general syntax rules
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/index.mdx
Demonstrates whitespace flexibility, operator precedence, and grouping.
```flyql
active
```
```flyql
status = 200
```
```flyql
status=200
```
```flyql
status = 200
```
```flyql
a = 1 or b = 2 and c = 3
```
```flyql
a = 1 or (b = 2 and c = 3)
```
```flyql
(a = 1 or b = 2) and c = 3
```
--------------------------------
### Define and Register Custom HrefRenderer in Go
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/advanced/custom-renderers.mdx
Implement a custom HrefRenderer in Go by embedding `columns.BaseRenderer`. This example defines the renderer's name, argument schema, and shows how to register it with the default RendererRegistry.
```go
import (
flyql "github.com/iamtelescope/flyql/golang"
"github.com/iamtelescope/flyql/golang/columns"
"github.com/iamtelescope/flyql/golang/flyqltype"
"github.com/iamtelescope/flyql/golang/transformers"
)
type HrefRenderer struct{ columns.BaseRenderer }
func (HrefRenderer) Name() string { return "href" }
func (HrefRenderer) ArgSchema() []transformers.ArgSpec {
return []transformers.ArgSpec{{Type: flyqltype.String, Required: true}}
}
reg := columns.DefaultRendererRegistry()
_ = reg.Register(HrefRenderer{})
opts := columns.DiagnoseOptions{RendererRegistry: reg}
diags := columns.DiagnoseWithOptions(parsedColumns, schema, opts)
```
--------------------------------
### startOf() 시간 함수 사용
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/ko/syntax/values.mdx
startOf() 함수는 현재 일, 주 또는 월의 시작 시점을 반환합니다. 선택적으로 타임존을 지정할 수 있습니다.
```FlyQL
created_at > startOf('day')
```
```FlyQL
created_at > startOf('week')
```
```FlyQL
created_at > startOf('month', 'Asia/Tokyo')
```
--------------------------------
### String Non-Containment Check with 'not has' (example)
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/operators.mdx
Example demonstrating the 'not has' operator for checking the absence of a substring in strings.
```FlyQL
msg not has 'ok'
```
--------------------------------
### Type Mismatch Error Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/fr/syntax/transformers.mdx
This example demonstrates a type error that occurs when chaining transformers with incompatible input and output types. The 'len' transformer outputs an 'int', but 'upper' requires a 'string' input.
```Flyql
message|len|upper
```
--------------------------------
### Run Formatting and Linting
Source: https://github.com/iamtelescope/flyql/blob/main/CONTRIBUTING.md
Commands to execute project-wide formatting and linting tools.
```bash
make fmt
make lint
```
--------------------------------
### Initialize Basic Schema
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/schema.mdx
Create a schema instance from a plain object to define available columns and their properties.
```javascript
import { ColumnSchema } from 'flyql-vue'
const columns = ColumnSchema.fromPlainObject({
level: { type: 'enum', suggest: true, autocomplete: true, values: ['debug', 'info', 'error'] },
service: { type: 'string', suggest: true, autocomplete: true },
status_code: { type: 'number', suggest: true },
host: { type: 'string', suggest: true },
})
```
--------------------------------
### Define complex query conditions
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/index.mdx
Examples using various operators for filtering.
```flyql
service != 'api' or user = "john doe"
```
```flyql
message ~ "error.*" and not debug
```
```flyql
(a = 1 or b = 2) and not (c = 3 and d = 4)
```
```flyql
status in [200, 201] and method not in ['DELETE', 'PUT']
```
```flyql
message has 'error' and tags not has 'debug'
```
--------------------------------
### Define individual condition types
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/index.mdx
Examples of equality, truthy checks, and negation.
```flyql
status = 200
```
```flyql
active
```
```flyql
not archived
```
--------------------------------
### now() 시간 함수 사용
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/ko/syntax/values.mdx
now() 함수는 현재 타임스탬프를 반환합니다. 비교 표현식의 오른쪽 값으로 사용됩니다.
```FlyQL
expires_at < now()
```
--------------------------------
### Use Parameters in Comparisons
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Demonstrates parameter usage within standard comparison operators.
```text
status = $code
```
```text
age >= $min_age
```
```text
name != $banned
```
```text
score > $1
```
--------------------------------
### PostgreSQL JSONB Access
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/sql/index.mdx
Example of accessing JSONB data in PostgreSQL using the `->` and `->>` operators.
```sql
(jsonb_typeof("data"->'user'->'name') = 'string'
AND "data"->'user'->>'name' = 'john')
```
--------------------------------
### Listas heterogêneas no FlyQL
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/pt-br/syntax/lists.mdx
O parser FlyQL aceita listas com tipos de dados mistos (strings, números, booleanos, null). A validação de tipos é realizada pelos geradores SQL.
```FlyQL
field in [200, 'ok', true, null]
```
--------------------------------
### Example: Check Path Length
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/fr/syntax/transformers.mdx
Checks if the length of the 'path' column is greater than 0.
```Flyql
path|len > 0
```
--------------------------------
### Use Parameters with Operators
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Demonstrates parameter usage with has, like, ilike, and not has operators.
```text
message has $needle
```
```text
path like $pattern
```
```text
title ilike $search
```
```text
tags not has $excluded
```
--------------------------------
### Example: Convert Status to Uppercase
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/fr/syntax/transformers.mdx
Converts the 'status' column to uppercase for comparison with 'ERROR'.
```Flyql
status|upper = "ERROR"
```
--------------------------------
### Importing Stylesheet
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/index.mdx
How to import the necessary CSS for the FlyQL editor's styling.
```APIDOC
## Importing Stylesheet
### Description
Import the `flyql.css` stylesheet once in your application's entry point to apply the necessary styles for the editor.
### Method
N/A (CSS Import)
### Endpoint
N/A (CSS Import)
### Parameters
N/A
### Request Example
```javascript
import 'flyql-vue/flyql.css'
```
### Response
N/A
```
--------------------------------
### Multiline Regex Flag
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/pattern-matching.mdx
The (?m) flag allows ^ and $ to match the start and end of individual lines.
```flyql
log ~ "(?m)^ERROR"
```
--------------------------------
### Import FlyQL Go Packages
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/pt/advanced/ast.mdx
Import the main FlyQL package for Go. This includes functions for parsing queries, binding parameters, and validating Abstract Syntax Trees (ASTs).
```go
import flyql "github.com/iamtelescope/flyql/golang"
// flyql.Parse(query string) (*ParseResult, error)
// flyql.BindParams(node *Node, params map[string]any) error — resolver marcadores de parâmetros
// flyql.Node — struct do nó da AST
// flyql.Expression — struct da condição folha
// flyql.Parameter — struct do marcador de parâmetro ($name / $1)
// flyql.FunctionCall — struct do valor de função temporal
// flyql.Key — struct do caminho do campo
// flyql.Range — intervalo de posição na fonte [Start, End)
// flyql.Column — tipo de coluna principal para o validador
// flyql.Diagnose(ast, columns, registry) []Diagnostic — validador de AST
// flyql.Diagnostic — registo de diagnóstico com posição
//
// Constantes de operadores: flyql.OpEquals, flyql.OpIn, flyql.OpTruthy, etc.
// Constantes de operadores booleanos: flyql.BoolOpAnd, flyql.BoolOpOr
```
--------------------------------
### PostgreSQL and StarRocks SQL Generation in JavaScript
Source: https://context7.com/iamtelescope/flyql/llms.txt
Demonstrates using the same API pattern across different SQL dialects (PostgreSQL and StarRocks).
```javascript
// JavaScript - PostgreSQL
import { parse } from 'flyql'
import { generateWhere, newColumn } from 'flyql/generators/postgresql'
const result = parse("status >= 400 and host like 'prod%'"
const columns = {
status: newColumn({ name: 'status', type: 'integer' }),
host: newColumn({ name: 'host', type: 'text' }),
}
const sql = generateWhere(result.root, columns)
// JavaScript - StarRocks
import { generateWhere as generateStarrocks, newColumn as newStarrocksColumn } from 'flyql/generators/starrocks'
const starrocksColumns = {
status: newStarrocksColumn({ name: 'status', type: 'INT' }),
host: newStarrocksColumn({ name: 'host', type: 'VARCHAR' }),
}
const starrocksSql = generateStarrocks(result.root, starrocksColumns)
```
--------------------------------
### Define Parameterized Query
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Example of a query string using named parameters for status and environment.
```text
status = $code and env = $env
```
--------------------------------
### Use Parameters in Temporal Functions
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Demonstrates using parameters for duration and timezone arguments.
```text
created > ago($duration)
```
```text
date = today($tz)
```
```text
created > startOf('day', $tz)
```
--------------------------------
### Evaluación de parámetros en memoria con Flyql
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/es/syntax/parameters.mdx
Los parámetros se asocian primero y luego se evalúan. Es necesario llamar a `bind_params()` antes de evaluar para evitar errores de parámetros no resueltos.
```python
from flyql import parse, bind_params
from flyql.matcher.evaluator import Evaluator
ast = parse("status = $code")
bind_params(ast.root, {"code": 200})
result = Evaluator().evaluate(ast.root, {"status": 200})
```
--------------------------------
### Filter with numeric lists
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/lists.mdx
Examples of using numeric values within list membership operators.
```flyql
status in [200, 201, 204]
```
```flyql
port not in [80, 443]
```
--------------------------------
### Map Access in SQL Dialects
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/es/sql/index.mdx
Illustrates map access syntax across ClickHouse, PostgreSQL, and StarRocks. ClickHouse uses specific functions, PostgreSQL uses hstore operators, and StarRocks uses bracket notation.
```sql
equals(metadata.key1, 'value1')
```
```sql
"metadata" -> 'key1' = 'value1'
```
```sql
metadata.key1 = 'value1'
```
--------------------------------
### Filter with string lists
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/lists.mdx
Examples of using string values within list membership operators.
```flyql
method in ['GET', 'POST', 'PUT']
```
```flyql
env not in ['dev', 'test', 'local']
```
--------------------------------
### SQL Output by Dialect
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/transformers.mdx
Shows how transformers are translated into SQL functions for different database dialects.
```APIDOC
## SQL Output by Dialect
### Description
Transformers generate dialect-specific SQL function calls. Chained transformers result in nested function calls.
### Single Transformer Example
**FlyQL:** `status|upper = "ERROR"`
| Dialect | Generated SQL |
|------------|-----------------------------------|
| ClickHouse | `equals(upper(status), 'ERROR')` |
| PostgreSQL | `UPPER(status) = 'ERROR'` |
| StarRocks | `UPPER(\`status\`) = 'ERROR'` |
### Chained Transformers Example
**FlyQL:** `message|lower|len > 100`
| Dialect | Generated SQL |
|------------|-----------------------------------|
| ClickHouse | `length(lower(message)) > 100` |
| PostgreSQL | `LENGTH(LOWER(message)) > 100` |
| StarRocks | `LENGTH(LOWER(\`message\`)) > 100` |
### Split with Has Example
**FlyQL:** `message|split(" ") has "hello"`
| Dialect | Generated SQL |
|------------|---------------------------------------------------|
| ClickHouse | `has(splitByChar(' ', message), 'hello')` |
| PostgreSQL | `'hello' = ANY(STRING_TO_ARRAY(message, ' '))` |
| StarRocks | `` array_contains(SPLIT(`message`, ' '), 'hello') `` |
```
--------------------------------
### Get Default Registry
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/zh/advanced/api-matrix.mdx
Retrieves the default registry for transformers. Available in Go, Python, and JavaScript.
```Go
DefaultRegistry()
```
```Python
default_registry()
```
```JavaScript
defaultRegistry()
```
--------------------------------
### ClickHouse JSON Access (Native)
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/sql/index.mdx
Example of accessing a native JSON column in ClickHouse using FlyQL.
```sql
data.`user`.`name` = 'john'
```
--------------------------------
### Enable FlyQL Themes
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/editor/theming.mdx
Use the 'dark' prop on FlyQL components to enable the built-in dark theme, or toggle the 'flyql-dark' class on the document root for global application.
```html
```
```javascript
document.documentElement.classList.toggle('flyql-dark', isDark)
```
--------------------------------
### Transformers in Go
Source: https://context7.com/iamtelescope/flyql/llms.txt
Apply transformers to column values before comparison using pipe syntax. Requires importing flyql and clickhouse generators.
```go
// Go
package main
import (
"fmt"
flyql "github.com/iamtelescope/flyql/golang"
clickhousegen "github.com/iamtelescope/flyql/golang/generators/clickhouse"
)
func main() {
result, _ := flyql.Parse("message|upper = 'ERROR'")
columns := map[string]*clickhousegen.Column{
"message": clickhousegen.NewColumn(clickhousegen.ColumnDef{Name: "message", Type: "String"}),
}
sql, _ := clickhousegen.ToSQLWhere(result.Root, columns)
fmt.Println(sql) // equals(upper(message), 'ERROR')
}
```
--------------------------------
### Python Registry-Level Chain Hook
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/advanced/custom-renderers.mdx
Example of setting a chain-level diagnostic rule in Python to enforce order between renderers.
```APIDOC
## Registry-Level Chain Hook (Python)
```python
def chain_rule(parsed_column, chain):
names = [r["name"] for r in chain]
if "truncate" in names and "href" in names:
if names.index("truncate") < names.index("href"):
return [Diagnostic(
range=Range(0, 1),
message="href cannot follow truncate",
severity="error",
code="chain_forbidden",
)]
return []
registry.set_diagnose(chain_rule)
```
The chain hook runs after per-renderer `diagnose` hooks and after the built-in unknown-name / arg-count / arg-type checks.
```
--------------------------------
### Current Date with today()
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/values.mdx
Use today() to get the current date. An optional IANA timezone argument can be provided.
```FlyQL
date = today()
```
```FlyQL
date = today('Europe/Berlin')
```
--------------------------------
### Top-Level Package Imports
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/ja/advanced/api-matrix.mdx
Shows how to import the FlyQL library in different programming languages.
```APIDOC
## Top-Level Package Imports
### Python
`from flyql import parse, bind_params, Node, Expression, Parameter, FunctionCall, Key, Column, ColumnSchema, Operator, Range, Diagnostic, diagnose, LiteralKind`
### JavaScript
`import { parse, bindParams, Node, Expression, Parameter, FunctionCall, Key, Column, ColumnSchema, Operator, Range, LiteralKind } from 'flyql'`
### Go
`import "github.com/iamtelescope/flyql/golang"` (core), dialect-specific generator imports separately
```
--------------------------------
### Renderers and Transformers Together Example
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/renderers.mdx
Illustrates the order of operations: transformers before the alias, renderers after. The transformer affects SQL, while the renderer does not.
```plaintext
url|upper as u|href("https://{{value}}")
```
--------------------------------
### Consultas de tiempo relativo con funciones temporales
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/es/syntax/dates.mdx
Utiliza funciones temporales integradas como ago(), now(), today(), y startOf() para consultas de tiempo relativo.
```FlyQL
created_at > ago(1h)
```
```FlyQL
updated_at >= ago(7d)
```
```FlyQL
expires_at < now()
```
```FlyQL
event_time > startOf('day')
```
```FlyQL
scheduled_for >= today('Europe/Berlin')
```
--------------------------------
### StarRocks JSON Access
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/sql/index.mdx
Example of accessing native JSON data in StarRocks using bracket notation and JSON functions.
```sql
`data`->'"user"'->'"name"' = 'john'
```
--------------------------------
### Evaluate parameters in-memory
Source: https://github.com/iamtelescope/flyql/blob/main/docs/src/content/docs/syntax/parameters.mdx
Shows the workflow of parsing, binding, and evaluating a query with parameters.
```python
from flyql import parse, bind_params
from flyql.matcher.evaluator import Evaluator
ast = parse("status = $code")
bind_params(ast.root, {"code": 200})
result = Evaluator().evaluate(ast.root, {"status": 200})
```