Skip to content

Commit 27b961a

Browse files
committed
Merge branch 'main' into task/handle-custom-decoder-array
2 parents 1e4827d + dd7df18 commit 27b961a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+721
-572
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: ci
1+
name: Checks
22

3-
on: [ push, pull_request, release ]
3+
on:
4+
pull_request:
5+
branches:
6+
- main
47

58
jobs:
69
code_quality:
@@ -12,62 +15,37 @@ jobs:
1215
- name: Setup Deno
1316
uses: denoland/setup-deno@v1
1417
with:
15-
deno-version: v1.x
16-
18+
deno-version: v2.x
19+
1720
- name: Format
1821
run: deno fmt --check
19-
22+
2023
- name: Lint
2124
run: deno lint
2225

23-
- name: Documentation tests
24-
run: deno test --doc client.ts mod.ts pool.ts client/ connection/ query/ utils/
25-
26-
test:
26+
test_docs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- name: Clone repo
3030
uses: actions/checkout@master
3131

3232
- name: Build tests container
33-
run: docker-compose build tests
34-
35-
- name: Run tests
36-
run: docker-compose run tests
37-
38-
- name: Run tests without typechecking
39-
id: no_typecheck
40-
uses: mathiasvr/command-output@v2.0.0
41-
with:
42-
run: docker-compose run no_check_tests
43-
continue-on-error: true
33+
run: docker compose build tests
4434

45-
- name: Report no typechecking tests status
46-
id: no_typecheck_status
47-
if: steps.no_typecheck.outcome == 'success'
48-
run: echo "name=status::success" >> $GITHUB_OUTPUT
49-
outputs:
50-
no_typecheck: ${{ steps.no_typecheck.outputs.stdout }}
51-
no_typecheck_status: ${{ steps.no_typecheck_status.outputs.status }}
35+
- name: Run doc tests
36+
run: docker compose run doc_tests
5237

53-
report_warnings:
54-
needs: [ code_quality, test ]
38+
test:
5539
runs-on: ubuntu-latest
5640
steps:
57-
- name: Set no-typecheck fail comment
58-
if: ${{ needs.test.outputs.no_typecheck_status != 'success' && github.event_name == 'push' }}
59-
uses: peter-evans/commit-comment@v3
60-
with:
61-
body: |
62-
# No typecheck tests failure
41+
- name: Clone repo
42+
uses: actions/checkout@master
6343

64-
This error was most likely caused by incorrect type stripping from the SWC crate
44+
- name: Build tests container
45+
run: docker compose build tests
6546

66-
Please report the following failure to https://github.com/denoland/deno with a reproduction of the current commit
47+
- name: Run tests
48+
run: docker compose run tests
6749

68-
<details>
69-
<summary>Failure log</summary>
70-
<pre><code>
71-
${{ needs.test.outputs.no_typecheck }}
72-
</code></pre>
73-
</details>
50+
- name: Run tests without typechecking
51+
run: docker compose run no_check_tests

.github/workflows/publish_jsr.yml

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,66 @@ jobs:
1111
timeout-minutes: 30
1212

1313
permissions:
14-
contents: read
14+
contents: write
1515
id-token: write
1616

1717
steps:
18-
- name: Clone repository
18+
- name: Checkout repository
1919
uses: actions/checkout@v4
2020
with:
21-
submodules: true
21+
fetch-depth: 0
2222

2323
- name: Set up Deno
2424
uses: denoland/setup-deno@v1
25+
with:
26+
deno-version: v2.x
2527

26-
- name: Convert to JSR package
27-
run: deno run -A tools/convert_to_jsr.ts
28+
- name: Extract version from deno.json
29+
id: get_version
30+
run: |
31+
VERSION=$(jq -r .version < deno.json)
32+
echo "version=$VERSION" >> $GITHUB_OUTPUT
2833
29-
- name: Format
34+
- name: Check if version tag already exists
35+
run: |
36+
TAG="v${{ steps.get_version.outputs.version }}"
37+
if git rev-parse "$TAG" >/dev/null 2>&1; then
38+
echo "🚫 Tag $TAG already exists. Aborting."
39+
exit 1
40+
fi
41+
42+
- name: Check Format
3043
run: deno fmt --check
31-
44+
45+
- name: Format
46+
run: deno fmt
47+
3248
- name: Lint
3349
run: deno lint
3450

35-
- name: Documentation tests
36-
run: deno test --doc client.ts mod.ts pool.ts client/ connection/ query/ utils/
37-
3851
- name: Build tests container
39-
run: docker-compose build tests
40-
52+
run: docker compose build tests
53+
4154
- name: Run tests
42-
run: docker-compose run tests
55+
run: docker compose run tests
56+
57+
- name: Run doc tests
58+
run: docker compose run doc_tests
59+
60+
- name: Create tag for release
61+
run: |
62+
TAG="v${{ steps.get_version.outputs.version }}"
63+
git config user.name "github-actions"
64+
git config user.email "github-actions@users.noreply.github.com"
65+
git tag "$TAG"
66+
git push origin "$TAG"
4367
44-
- name: Publish (dry run)
45-
if: startsWith(github.ref, 'refs/tags/') == false
46-
run: deno publish --dry-run
68+
- name: Create GitHub Release
69+
run: |
70+
gh release create "v${{ steps.get_version.outputs.version }}" \
71+
--title "v${{ steps.get_version.outputs.version }}"
72+
env:
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4774

48-
- name: Publish (real)
49-
if: startsWith(github.ref, 'refs/tags/')
50-
run: deno publish
75+
- name: Publish package
76+
run: deno publish

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM denoland/deno:alpine-1.40.3
1+
FROM denoland/deno:alpine-2.2.11
22
WORKDIR /app
33

44
# Install wait utility
@@ -11,7 +11,6 @@ USER deno
1111
# Cache external libraries
1212
# Test deps caches all main dependencies as well
1313
COPY tests/test_deps.ts tests/test_deps.ts
14-
COPY deps.ts deps.ts
1514
RUN deno cache tests/test_deps.ts
1615

1716
ADD . .

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018-2022 Bartłomiej Iwańczuk and Steven Guerrero
3+
Copyright (c) 2018-2025 Bartłomiej Iwańczuk, Steven Guerrero, and Hector Ayala
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 65 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
1+
<div align="center">
2+
13
# deno-postgres
24

3-
![Build Status](https://img.shields.io/github/workflow/status/denodrivers/postgres/ci?label=Build&logo=github&style=flat-square)
4-
[![Discord server](https://img.shields.io/discord/768918486575480863?color=blue&label=Ask%20for%20help%20here&logo=discord&style=flat-square)](https://discord.gg/HEdTCvZUSf)
5+
<img src="./docs/deno-postgres.png" width="164" style="padding-bottom:20px;" />
6+
</div>
7+
8+
<div align="center">
9+
10+
![Build Status](https://img.shields.io/github/actions/workflow/status/denodrivers/postgres/ci.yml?branch=main&label=Build&logo=github&style=flat-square)
11+
[![Discord server](https://img.shields.io/discord/768918486575480863?color=blue&label=Join%20us&logo=discord&style=flat-square)](https://discord.com/invite/HEdTCvZUSf)
12+
[![JSR](https://jsr.io/badges/@db/postgres?style=flat-square)](https://jsr.io/@db/postgres)
13+
[![JSR Score](https://jsr.io/badges/@db/postgres/score?style=flat-square)](https://jsr.io/@db/postgres)
514
[![Manual](https://img.shields.io/github/v/release/denodrivers/postgres?color=orange&label=Manual&logo=deno&style=flat-square)](https://deno-postgres.com)
6-
[![Documentation](https://img.shields.io/github/v/release/denodrivers/postgres?color=yellow&label=Documentation&logo=deno&style=flat-square)](https://doc.deno.land/https/deno.land/x/postgres/mod.ts)
15+
[![Documentation](https://img.shields.io/github/v/release/denodrivers/postgres?color=yellow&label=Documentation&logo=deno&style=flat-square)](https://jsr.io/@db/postgres/doc)
716
[![License](https://img.shields.io/github/license/denodrivers/postgres?color=yellowgreen&label=License&style=flat-square)](LICENSE)
817

9-
A lightweight PostgreSQL driver for Deno focused on developer experience.
10-
11-
`deno-postgres` is being developed inspired by the excellent work of
18+
A lightweight PostgreSQL driver for Deno focused on developer experience.\
19+
`deno-postgres` is inspired by the excellent work of
1220
[node-postgres](https://github.com/brianc/node-postgres) and
1321
[pq](https://github.com/lib/pq).
1422

23+
</div>
24+
1525
## Documentation
1626

17-
The documentation is available on the `deno-postgres` website
18-
[https://deno-postgres.com/](https://deno-postgres.com/)
27+
The documentation is available on the
28+
[`deno-postgres`](https://deno-postgres.com/) website.
1929

20-
Join the [Discord](https://discord.gg/HEdTCvZUSf) as well! It's a good place to
21-
discuss bugs and features before opening issues.
30+
Join the [Discord](https://discord.com/invite/HEdTCvZUSf) as well! It's a good
31+
place to discuss bugs and features before opening issues.
2232

2333
## Examples
2434

2535
```ts
2636
// deno run --allow-net --allow-read mod.ts
27-
import { Client } from "https://deno.land/x/postgres/mod.ts";
37+
import { Client } from "jsr:@db/postgres";
2838

2939
const client = new Client({
3040
user: "user",
3141
database: "test",
3242
hostname: "localhost",
3343
port: 5432,
3444
});
45+
3546
await client.connect();
3647

3748
{
@@ -59,6 +70,42 @@ await client.connect();
5970
await client.end();
6071
```
6172

73+
## Deno compatibility
74+
75+
Due to breaking changes introduced in the unstable APIs `deno-postgres` uses,
76+
there has been some fragmentation regarding what versions of Deno can be used
77+
alongside the driver.
78+
79+
This situation will stabilize as `deno-postgres` approach version 1.0.
80+
81+
| Deno version | Min driver version | Max version | Note |
82+
| ------------- | ------------------ | ----------- | -------------------------------------------------------------------------- |
83+
| 1.8.x | 0.5.0 | 0.10.0 | |
84+
| 1.9.0 | 0.11.0 | 0.11.1 | |
85+
| 1.9.1 and up | 0.11.2 | 0.11.3 | |
86+
| 1.11.0 and up | 0.12.0 | 0.12.0 | |
87+
| 1.14.0 and up | 0.13.0 | 0.13.0 | |
88+
| 1.16.0 | 0.14.0 | 0.14.3 | |
89+
| 1.17.0 | 0.15.0 | 0.17.1 | |
90+
| 1.40.0 | 0.17.2 | 0.19.3 | 0.19.3 and down are available in [deno.land](https://deno.land/x/postgres) |
91+
| 2.0.0 and up | 0.19.4 | - | Available on JSR! [`@db/postgres`](https://jsr.io/@db/postgres) |
92+
93+
## Breaking changes
94+
95+
Although `deno-postgres` is reasonably stable and robust, it is a WIP, and we're
96+
still exploring the design. Expect some breaking changes as we reach version 1.0
97+
and enhance the feature set. Please check the
98+
[Releases](https://github.com/denodrivers/postgres/releases) for more info on
99+
breaking changes. Please reach out if there are any undocumented breaking
100+
changes.
101+
102+
## Found issues?
103+
104+
Please
105+
[file an issue](https://github.com/denodrivers/postgres/issues/new/choose) with
106+
any problems with the driver. If you would like to help, please look at the
107+
issues as well. You can pick up one of them and try to implement it.
108+
62109
## Contributing
63110

64111
### Prerequisites
@@ -73,8 +120,8 @@ await client.end();
73120
it to run the linter and formatter locally
74121

75122
- https://deno.land/
76-
- `deno upgrade --version 1.40.0`
77-
- `dvm install 1.40.0 && dvm use 1.40.0`
123+
- `deno upgrade stable`
124+
- `dvm install stable && dvm use stable`
78125

79126
- You don't need to install Postgres locally on your machine to test the
80127
library; it will run as a service in the Docker container when you build it
@@ -86,8 +133,8 @@ result assertions.
86133

87134
To run the tests, run the following commands:
88135

89-
1. `docker-compose build tests`
90-
2. `docker-compose run tests`
136+
1. `docker compose build tests`
137+
2. `docker compose run tests`
91138

92139
The build step will check linting and formatting as well and report it to the
93140
command line
@@ -96,8 +143,8 @@ It is recommended that you don't rely on any previously initialized data for
96143
your tests instead create all the data you need at the moment of running the
97144
tests
98145

99-
For example, the following test will create a temporal table that will disappear
100-
once the test has been completed
146+
For example, the following test will create a temporary table that will
147+
disappear once the test has been completed
101148

102149
```ts
103150
Deno.test("INSERT works correctly", async () => {
@@ -134,41 +181,6 @@ a local testing environment, as shown in the following steps:
134181
3. Run the tests manually by using the command\
135182
`deno test -A`
136183

137-
## Deno compatibility
138-
139-
Due to breaking changes introduced in the unstable APIs `deno-postgres` uses,
140-
there has been some fragmentation regarding what versions of Deno can be used
141-
alongside the driver.
142-
143-
This situation will stabilize as `std` and `deno-postgres` approach version 1.0.
144-
145-
| Deno version | Min driver version | Max driver version | Note |
146-
| ------------- | ------------------ | ------------------ | -------------------- |
147-
| 1.8.x | 0.5.0 | 0.10.0 | |
148-
| 1.9.0 | 0.11.0 | 0.11.1 | |
149-
| 1.9.1 and up | 0.11.2 | 0.11.3 | |
150-
| 1.11.0 and up | 0.12.0 | 0.12.0 | |
151-
| 1.14.0 and up | 0.13.0 | 0.13.0 | |
152-
| 1.16.0 | 0.14.0 | 0.14.3 | |
153-
| 1.17.0 | 0.15.0 | 0.17.1 | |
154-
| 1.40.0 | 0.17.2 | | Now available on JSR |
155-
156-
## Breaking changes
157-
158-
Although `deno-postgres` is reasonably stable and robust, it is a WIP, and we're
159-
still exploring the design. Expect some breaking changes as we reach version 1.0
160-
and enhance the feature set. Please check the Releases for more info on breaking
161-
changes. Please reach out if there are any undocumented breaking changes.
162-
163-
## Found issues?
164-
165-
Please
166-
[file an issue](https://github.com/denodrivers/postgres/issues/new/choose) with
167-
any problems with the driver in this repository's issue section. If you would
168-
like to help, please look at the
169-
[issues](https://github.com/denodrivers/postgres/issues) as well. You can pick
170-
up one of them and try to implement it.
171-
172184
## Contributing guidelines
173185

174186
When contributing to the repository, make sure to:
@@ -194,5 +206,5 @@ preserved their individual licenses and copyrights.
194206

195207
Everything is licensed under the MIT License.
196208

197-
All additional work is copyright 2018 - 2024 — Bartłomiej Iwańczuk, Steven
209+
All additional work is copyright 2018 - 2025 — Bartłomiej Iwańczuk, Steven
198210
Guerrero, Hector Ayala — All rights reserved.

0 commit comments

Comments
 (0)