Skip to content

Commit

Permalink
libsql is no longer experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
penberg committed Sep 6, 2023
1 parent 35aa56e commit fc3f90c
Show file tree
Hide file tree
Showing 21 changed files with 1,372 additions and 340 deletions.
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "libsql-experimental"
name = "libsql"
version = "0.0.1"
description = ""
authors = ["Pekka Enberg <penberg@iki.fi>"]
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# libSQL API for Node

[![npm](https://badge.fury.io/js/libsql-experimental.svg)](https://badge.fury.io/js/libsql-experimental)
[![npm](https://badge.fury.io/js/libsql.svg)](https://badge.fury.io/js/libsql)

[libSQL](https://github.com/libsql/libsql) is an open source, open contribution fork of SQLite.
This source repository contains libSQL API bindings for Node, which aims to be compatible with [better-sqlite3](https://github.com/WiseLibs/better-sqlite3/), but with opt-in promise API.
Expand All @@ -16,7 +16,7 @@ This source repository contains libSQL API bindings for Node, which aims to be c
You can install the package with `npm`:

```sh
npm i libsql-experimental
npm i libsql
```

## Documentation
Expand All @@ -28,7 +28,7 @@ npm i libsql-experimental
To try out your first libsql program, type the following in `hello.js`:

```javascript
import Database from 'libsql-experimental';
import Database from 'libsql';

const db = new Database(':memory:');

Expand All @@ -46,10 +46,10 @@ and then run:
$ node hello.js
```

To use the promise API, import `libsql-experimental/promise`:
To use the promise API, import `libsql/promise`:

```javascript
import Database from 'libsql-experimental/promise';
import Database from 'libsql/promise';

const db = new Database(':memory:');

Expand All @@ -65,15 +65,15 @@ console.log(`Name: ${row.name}, email: ${row.email}`);
#### Connecting to a local database file

```javascript
import Database from 'libsql-experimental';
import Database from 'libsql';

const db = new Database('hello.db');
````

#### Connecting to a Remote libSQL server

```javascript
import Database from 'libsql-experimental';
import Database from 'libsql';
const url = process.env.LIBSQL_URL;
const authToken = process.env.LIBSQL_AUTH_TOKEN;
Expand All @@ -88,7 +88,7 @@ const db = new Database(url, opts);
#### Creating an in-app replica and syncing it

```javascript
import libsql_experimental as libsql
import libsql
const opts = { syncUrl: "<url>", authToken: "<optional auth token>" };
const db = new Database('hello.db', opts);
Expand Down Expand Up @@ -126,7 +126,7 @@ You can then run the integration tests with:
```console
npm link
cd integration-tests
npm link libsql-experimental
npm link libsql
npm test
```

Expand All @@ -140,4 +140,4 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in libSQL by you, shall be licensed as MIT, without any additional
terms or conditions.

[MIT license]: https://github.com/libsql/libsql-experimental-node/blob/main/LICENSE
[MIT license]: https://github.com/libsql/libsql-node/blob/main/LICENSE
10 changes: 3 additions & 7 deletions examples/drizzle/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
import { drizzle } from 'drizzle-orm/better-sqlite3';
import Database from 'libsql-experimental';
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
import Database from 'libsql';

const users = sqliteTable('users', {
id: integer('id').primaryKey(), // 'id' is the column name
fullName: text('full_name'),
})

const opts = {
syncUrl: 'http://localhost:8081'
};
const sqlite = new Database('sqlite.db', opts);

sqlite.sync();
const sqlite = new Database('drizzle.db');

const db = drizzle(sqlite);

Expand Down
Loading

0 comments on commit fc3f90c

Please sign in to comment.