Crates.io | ts_sqlx |
lib.rs | ts_sqlx |
version | |
source | src |
created_at | 2024-02-04 20:35:47.719027 |
updated_at | 2024-10-21 09:53:17.317931 |
description | Typescript SQLx compile-time checked queries without a DSL. |
homepage | |
repository | https://github.com/nathanfaucett/ts-sqlx |
max_upload_size | |
id | 1126637 |
Cargo.toml error: | TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Typescript SQLx compile-time checked queries without a DSL.
install the ts-sqlx cli tool globally
cargo install ts_sqlx
in your project install the typescript definitions
npm install ts-sqlx -D
include the path to generated declaration files in your tsconfig.json
{
// default destination of declaration files
"include": [".ts-sqlx/*"]
}
create a .env
file with DATABASE_URL
set to your database url
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres
or create a .ts-sqlx.json
file like
{
"databases": {
"default": "postgres://postgres:postgres@localhost:5432/postgres",
"another": "postgres://postgres:postgres@localhost:5432/postgres"
},
// defaults shown below, the rest of these are optional
"src": ".",
"dest": ".ts-sqlx",
"extensions": ["ts", "tsx", "js", "jsx"],
"ignore_patterns": ["*.d.ts"]
}
run in watch mode ts-sqlx watch
in the root of your project, just once with ts-sqlx run
or for help ts-sqlx help
see example for a "full" project example