Giter VIP home page Giter VIP logo

arango-dart's Introduction

ArangoDB Dart Driver

The dart driver for ArangoDB the native multi-model database

Index

Quick Reference

Database Collection Document Index
createDatabase create replace ensureIndex
exists load update ensureHashIndex
version unload bulkUpdate ensureSkipList
listDatabases setProperties remove ensureGeoIndex
listUserDatabases rename list ensureFulltextIndex
dropDatabase rotate save ensurePersistentIndex
truncate truncate index
query drop indexes
rawQuery ensureExists dropIndex
import
Cursor Simple Query Transaction
count all beginTransaction
all list listTransactions
next any executeTransaction
hasNext byExample exists
nextBatch firstExample get
each removeByExample commit
every replaceByExample abort
some updateByExample run
map lookupByKeys
reduce removeByKeys
kill

Simple Queries are deprecated from version 3.4.0 on. They are superseded by AQL queries.

Usage

A simple todo example:

import 'package:arango/arango.dart';

void main() async {
  final db = ArangoDatabase('http://localhost:8529');
  db.useBasicAuth('root', 'YOUR-PASSWORD');

  await db.collection('todos').ensureExists();
  await db.collection('todos').ensureTTLIndex(['expiresAt']);
  await db.collection('todos').ensureFulltextIndex(['content']);

  await db.collection('todos').save({'content': 'Go shopping'});
  await db.collection('todos').save({'content': 'Go home'});

  final todos = await db
      .query()
      .line('FOR todo IN todos')
      .line('RETURN todo.content')
      .toList();

  print('todos: $todos');
  // -> todos: [Go shopping, Go home]
}

Transactions:

import 'package:arango/arango.dart';

void main() async {
  final db = ArangoDatabase('http://localhost:8529');
  db.useBasicAuth('root', 'YOUR-PASSWORD');

  await db.collection('accounts').ensureExists();
  await db.collection('accounts').truncate();

  final txn = await db.beginTransaction(write: ['accounts']);
  await txn.run(() => db.collection('accounts').save({'id': '1'}));
  await txn.run(() => db.collection('accounts').save({'id': '2'}));
  await txn.commit();

  final txn2 = await db.beginTransaction(write: ['accounts']);
  await txn2.run(() => db.collection('accounts').save({'id': '3'}));
  await txn2.run(() => db.collection('accounts').save({'id': '4'}));
  await txn2.abort();

  final data = await db
      .query()
      .line('FOR account IN accounts')
      .line('RETURN account.id')
      .toList();

  print('accounts: $data');
  // -> accounts: [1, 2]
}

Run query:

import 'package:arango/arango.dart';

void main() async {
  final db = ArangoDatabase('http://localhost:8529');
  db.useBasicAuth('root', '123123');

  final cursor = await db.rawQuery('FOR todo IN todos RETURN todo.title');
  final data = await cursor.all();
  print(data);

  // or with the fluent query builder
  final result = await db
      .query()
      .line('FOR todo IN todos')
      .line('RETURN todo.title')
      .toList();
  print(result);
}

AQL

The ArangoDB Query Language (AQL) can be used to retrieve and modify data that are stored in ArangoDB.

To learn more about AQL, please refer to https://www.arangodb.com/docs/stable/aql/

Features and bugs

Please file feature requests and bugs at the issue tracker.

Todo

Analyzer View
exists arangoSearchView
get listViews
create views
drop
listAnalyzers
analyzers
analyzer

arango-dart's People

Contributors

xtyxtyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

arango-dart's Issues

Project stopped?

You did so much work on this project, why is it not more updated?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.