Skip to content

Commit

Permalink
Add the README example to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
honzasp committed Mar 27, 2023
1 parent 7190a25 commit 09bbeff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ jobs:

- name: "Build"
run: "npm run build"
- name: "Test using hrana-test-server"
- name: "Test"
run: "python hrana-test-server/test_server.py npm test"
- name: "Example"
run: "python hrana-test-server/test_server.py node examples/readme_example.js"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as hrana from "@libsql/hrana-client";

// Open a `hrana.Client`, which works like a connection pool in standard SQL
// databases, but it uses just a single network connection internally
const url = process.env.URL ?? "ws://localhost:2023"; // Address of the sqld server
const url = process.env.URL ?? "ws://localhost:8080"; // Address of the sqld server
const jwt = process.env.JWT; // JWT token for authentication
const client = hrana.open(url, jwt);

Expand Down Expand Up @@ -43,7 +43,7 @@ if (year.value !== undefined) {

// Execute a statement that does not return any rows
const res = await stream.run(["DELETE FROM book WHERE author = ?", ["J. K. Rowling"]])
console.log(`${res.rowsAffected} books have been cancelled`);
console.log(`${res.affectedRowCount} books have been cancelled`);

// When you are done, remember to close the client
client.close();
Expand Down
4 changes: 2 additions & 2 deletions examples/readme_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as hrana from "@libsql/hrana-client";

// Open a `hrana.Client`, which works like a connection pool in standard SQL
// databases, but it uses just a single network connection internally
const url = process.env.URL ?? "ws://localhost:2023"; // Address of the sqld server
const url = process.env.URL ?? "ws://localhost:8080"; // Address of the sqld server
const jwt = process.env.JWT; // JWT token for authentication
const client = hrana.open(url, jwt);

Expand Down Expand Up @@ -52,7 +52,7 @@ if (year.value !== undefined) {

// Execute a statement that does not return any rows
const res = await stream.run(["DELETE FROM book WHERE author = ?", ["J. K. Rowling"]])
console.log(`${res.rowsAffected} books have been cancelled`);
console.log(`${res.affectedRowCount} books have been cancelled`);

// When you are done, remember to close the client
client.close();

0 comments on commit 09bbeff

Please sign in to comment.