hrana 0.3.0 copy "hrana: ^0.3.0" to clipboard
hrana: ^0.3.0 copied to clipboard

Dart client for hrana, a protocol for accessing libsql database servers.

Hrana Version

This package provides a Dart implementation for the Hrana protocol used by libsql servers to expose sqlite3 databases over web sockets.

Getting started #

To use this package, you need a server to connect to. For testing purposes, you can start an ephemeral sqld container:

docker run -p 8080:8080 -ti -e SQLD_NODE=primary ghcr.io/tursodatabase/libsql-server:latest

Usage #

With a running server, all this package needs to connect is the web socket URI and optionally a JWT token for authorization:

import 'package:hrana/hrana.dart';

void main() async {
  final database = await Database.connect(
    Uri.parse('ws://localhost:8080/'),
    jwtToken: null,
  );
  print(await database.select('SELECT 1;'));
}

Additional information #

At the moment, this package implementats functionality to execute statements and getting their results as rows. Batches and stored statements are supported as well, but no support for streaming cursors is implemented yet.

Contributing #

Contributions to expose more functionality of the hrana protocol are welcome!

If you need to re-run the protoc compiler, first run

$ dart pub global activate protoc_plugin

Afterwards, you can use ./proto.sh to re-generate protobuf code.

2
likes
160
pub points
25%
popularity

Publisher

verified publishersimonbinder.eu

Dart client for hrana, a protocol for accessing libsql database servers.

Repository (GitHub)
View/report issues

Topics

#database #turso #libsql #sqld #hrana

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

fixnum, http, protobuf, sqlite3, stream_channel, web_socket_channel

More

Packages that depend on hrana