Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/djdeveloperr/postquery
An easy to use Query Client for Deno Postgres.
https://github.com/djdeveloperr/postquery
client database deno postgres query sql
Last synced: 6 days ago
JSON representation
An easy to use Query Client for Deno Postgres.
- Host: GitHub
- URL: https://github.com/djdeveloperr/postquery
- Owner: DjDeveloperr
- License: mit
- Created: 2021-02-19T09:52:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-07-12T08:33:25.000Z (over 3 years ago)
- Last Synced: 2024-10-26T06:52:00.068Z (10 days ago)
- Topics: client, database, deno, postgres, query, sql
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PostQuery
An easy to use Query Client for Deno Postgres.
## Docs
Docs are available [here](https://doc.deno.land/https/deno.land/x/postquery/mod.ts).
## Usage
```ts
import { QueryClient, DataType, CreateTableMode, Constraint } from "https://deno.land/x/postquery/mod.ts";const client = new QueryClient(/* Connection URI or Connection Object */);
const users = client.table<{
id: number,
name: string,
}>("users");await users.create({
id: {
type: DataType.Integer,
constraint: Constraint.PrimaryKey,
},
name: {
type: DataType.VarChar,
length: 20,
}
}, CreateTableMode.DropIfExists);await users.insert({
id: 1,
name: "User 1",
}, {
id: 2,
name: "User 2",
}, {
id: 3,
name: "User 3",
});await users.where({
id: 2
}).select("name"); // { name: "User 2" }await users.where().limit(2).select();
// [ { id: 1, name: "User 1" }, { id: 2, name: "User 2" } ]await users.where({ id: 1 }).delete();
await users.where({
id: 1
}).select(); // []
```## Contributing
You're always welcome to contribute!
- We use `deno fmt` for our code style.
- We use `deno lint` for linting code.## License
Check [LICENSE](LICENSE) for more info.
Copyright 2021 @ DjDeveloperr