branch | url |
---|---|
main | https://kyse.link |
preview | https://kysely-playground.web.app |
Playground for Kysely.
Provides vscode-like experiences including type checking and auto suggestions.
Supports built-in dialects(postgres, mysql, sqlite), last 20 kysely versions.
You can test stuffs quickly, create issues with reproducing with playground.
The playground has 3 editor: schema
, query
and sql
.
Schema editor is the leftmost editor(in wide-enough screen).
You can declare global scope interface DB
to help checking types related database schema.
You can import type
s from kysely
. (e.g. import { Generated } from "kysely"
)
You can hide the editor by clicking Schema
checkbox on header of playground.
If you want to let reader focus on building query not schema, hide the schema editor before share.
The visibility of schema editor will be shared.
(Type checking for schema still works even though it is hidden.)
If you want to disable the type checking for schema, check out the example.
To
prevent 2669 error,
you should specify export {}
if you import nothing in schema editor.
The editor in the middle is the query editor.
For now, you can't import a non-type thing. If you need something to be pre-defined, please issue it.
These are pre-defined variables you can use to build query:
variable | description |
---|---|
sql |
import {sql} from "kysely" |
kysely |
an Kysely instance |
db |
alias for kysely |
You can see the generated sql in the rightmost sql editor.
By default, the playground will show you the generated sql string as-is(with parameter placeholders).
You can generate sql with hard-coded parameter by turning on More Options
-> SQL Format
-> inlineParameters
.
It is useful when you copy-paste the sql into database cli or DataGrip.