couchbase

Creator: coderz1093

Last updated:

0 purchases

couchbase Image
couchbase Images

Languages

Categories

Add to Cart

Description:

couchbase

This is a SDK to access a Couchbase Server cluster from Dart.

⚠️ This project is still at an early stage and a work in progress. If you find
bugs or have suggestions for improvements please open an issue.

Couchbase Server is a document-oriented NoSQL database that is
distributed, scalable, and highly available. It is a key-value store with
additional support for documents, views, and queries.
Installation #
Add a dependency on couchbase to your pubspec.yaml file:
dart pub add couchbase
copied to clipboard
The SDK uses a native library that is platform specific and is automatically
downloaded when you use the SDK. The native library can be downloaded manually
by running the following command:
dart run couchbase:install
copied to clipboard
This is useful when a Dart application is packaged as a Docker image and you
want to avoid the latency of downloading the native library each time a
container is created. In this case the native library should be included in the
image.
Getting started #
Use Cluster.connect to connect to a Couchbase Server cluster:
import 'package:couchbase/couchbase.dart';

void main() async {
final cluster = await Cluster.connect(
'couchbase://localhost',
ClusterOptions(
username: 'admin',
password: 'password',
),
);

final bucket = cluster.bucket('my-bucket');
final collection = bucket.defaultCollection;

await collection.insert('greeting-alice', {'message': 'Hello @name!', 'name': 'Alice'});

final getResult = await collection.get('greeting-alice');
print(getResult.content);

await cluster.close();
}
copied to clipboard
Acknowledgements #
Thanks to BenjaminThong for making the
couchbase package name available on pub.dev.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.