couchdb 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new66

A library for Dart developers for work with CouchDB

Introducing first beta of library! 🎊 🎉

Created under a MIT-style license.

Usage

A simple usage example:

import 'package:couchdb/couchdb.dart';
import 'package:couchdb/couchdb_server_client.dart';

Future<void> main() async {
  final c = CouchDbServerClient(username: 'name', password: 'password');
  final dm = DatabaseModel(c);

  try {
    final DbResponse o = await dm.getAllDocs('denta');

    // Some code here

  } on CouchDbException catch (e) {
    print('$e - error');
  }
}

Overview

CouchDB is a database that completely embraces the web. Store your data with JSON documents. Access your documents with your web browser, via HTTP.

Every supported method: HEAD, GET, POST, PUT and COPY - have Accept header with default value as application/json and POST and PUT - Content-Type header with default value as application/json. You might override it if you need it.

Authorization

At the current time only Basic authorization is implemented.

Areas of API

Requests to the API are categorised by the different areas of the CouchDB system that you are accessing.

Exist 5 areas of API:

1. Server
2. Database
3. Documents
4. Design documents
5. Local documents

Every area (layer) contain its own method for interacting with CouchDB. Detailed information you can find in official documentation site.

Features and bugs

Please file feature requests and bugs at the issue tracker.

With ❤️ to CouchDB

0.1.1

  • Small changes that don't touch main classes.

0.1.0

  • Introducing beta-version of library.
  • Implement all methods of ServerModel class.
  • Implement all methods of DesignDocumentModel class.
  • Add library description to CouchDb(Server/Web)Client classes.
  • Add raw field to DbResponse class (prior rawBody).
  • Change body parameter of post() method in CouchDb(Server/Web)Client to Object type.

0.0.8

  • Implements schedulerJobs(), schedulerDocs(), schedulerDocsWithReplicatorDbName(), schedulerDocsWithDocId(), nodeStats(), systemStatsForNode(), up() and uuids() methods of ServerModel class.
  • Add some fields to DbResponse class.

0.0.7

  • Change toString() method of CouchDbException class - it shows error code, name error and reason.
  • Add allNodes, clusterNodes, history, replicationIdVersion, sessionId and sourceLastSeq fields to DbResponse class.
  • Implements configureCouchDb(), dbUpdates(), membership() and replicate() methods of ServerModel class.

0.0.6

  • Moving CouchDbWebClient and CouchDbServerClient to the separate export.
  • Delete rawBody field from DbResponse class.
  • Add state field to DbResponse class.
  • Implements couchDbInfo(), activeTasks(), allDbs(), dbsInfo() and getClusterSetup() methods of ServerModel class.
  • Small changes in CouchDb(Server/Web)Client classes.

0.0.5

  • Implement CouchDbWebClient class for interacting with CouchDB.
  • Moving all examples to example/README.md.

0.0.4

  • Implements attachmentInfo(), getAttachment(), insertAttachment() and deleteAttachment() methods of DocumentModel class.
  • Implement setRevsLimit() method of DatabaseModel class.
  • Method put() now accept any body type.
  • Non-json response body now available in rawBody field of DbRespone class.

0.0.3

  • Implements insertDoc(), deleteDoc() and copyDoc() methods of DocumentModel class.
  • All methods of CouchDb(Server/Web)Client can set custom headers.

0.0.2

  • Implementats docInfo() and getDoc() methods of DocumentModel class.
  • Add documentation to DatabaseModel methods.
  • Add opportunity to add headers to head() method of CouchDb(Server/Web)Client classes.

0.0.1

  • Initial version.
  • Implement CouchDbServerClient for interacting with CouchDB.
  • Implements DatabaseBaseModel methods.

example/README.md

Server

import 'package:couchdb/couchdb.dart';
import 'package:couchdb/couchdb_server_client.dart';

Future<void> main() async {
  final c = CouchDbServerClient(username: 'name', password: 'pass');
  final dm = DatabaseModel(c);

  try {
    DbResponse o = await dm.dbInfo('db');
    print('$o - success');
  } on CouchDbException catch (e) {
    print('$e - error');
  }
}

Browser

import 'dart:html';

import 'package:couchdb/couchdb.dart';
import 'package:couchdb/couchdb_web_client.dart';

Future<void> main(List<String> args) async {
  final ButtonElement btn = querySelector('#data');
  final DivElement output = querySelector('#output');

  final c = CouchDbWebClient(username: 'name', password: 'pass');
  final dm = DocumentModel(c);

  btn.onClick.listen((event) async {
    try {
      DbResponse r = await dm.getDoc('db', 'docId');
      output.text = '${r.id}';
    } on CouchDbException catch (e) {
      window.console.log('${e.code} - error');
    }
  });
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  couchdb: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:couchdb/couchdb.dart';
  
Version Uploaded Documentation Archive
0.1.1 Dec 11, 2018 Go to the documentation of couchdb 0.1.1 Download couchdb 0.1.1 archive
0.1.0 Nov 30, 2018 Go to the documentation of couchdb 0.1.0 Download couchdb 0.1.0 archive
0.0.8 Nov 29, 2018 Go to the documentation of couchdb 0.0.8 Download couchdb 0.0.8 archive
0.0.7 Nov 27, 2018 Go to the documentation of couchdb 0.0.7 Download couchdb 0.0.7 archive
0.0.6 Nov 27, 2018 Go to the documentation of couchdb 0.0.6 Download couchdb 0.0.6 archive
0.0.5 Nov 26, 2018 Go to the documentation of couchdb 0.0.5 Download couchdb 0.0.5 archive
0.0.4 Nov 23, 2018 Go to the documentation of couchdb 0.0.4 Download couchdb 0.0.4 archive
0.0.3 Nov 22, 2018 Go to the documentation of couchdb 0.0.3 Download couchdb 0.0.3 archive
0.0.2 Nov 21, 2018 Go to the documentation of couchdb 0.0.2 Download couchdb 0.0.2 archive
0.0.1 Nov 21, 2018 Go to the documentation of couchdb 0.0.1 Download couchdb 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Dec 11, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:couchdb/couchdb.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
http ^0.12.0 0.12.0
meta ^1.1.6 1.1.6
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
path 1.6.2
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6