database_adapter_elasticsearch 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new49

Pub Package Github Actions CI

Overview #

This is an adapter between database and ElasticSearch.

Getting started #

// Set up
final database = ElasticSearch(
  credentials: ElasticSearchPasswordCredentials(
    user: 'example user',
    password: 'example password'
  ),
);

// Insert a document
final document = await database.collection('example').insert({
  'greeting': 'Hello world!'
});

// Search documents
final results = await database.collection('example').search(
  query: Query.parse(
    'world hello',
    skip: 0,
    take: 10,
  )',
});

[0.1.0] - January 14, 2020

  • Initial release

example/example.dart

import 'package:database/database.dart';
import 'package:database_adapter_elasticsearch/database_adapter_elasticsearch.dart';

Future main() async {
  // Set up
  final database = ElasticSearch(
    host: 'localhost',
    credentials: ElasticSearchPasswordCredentials(
      user: 'example user',
      password: 'example password',
    ),
  );
  final collection = database.collection('example');

  // Insert a document
  final document = await collection.insert(data: {'greeting': 'Hello world!'});
  print('Inserted ID: ${document.documentId}');

  // Search documents
  final results = await collection.search(
    query: Query.parse(
      'world hello',
      skip: 0,
      take: 10,
    ),
  );
  print('Found ${results.items} results');
}

Use this package as a library

1. Depend on it

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


dependencies:
  database_adapter_elasticsearch: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:database_adapter_elasticsearch/database_adapter_elasticsearch.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
93
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Maintenance suggestions

The package description is too short. (-7 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0
built_value >=5.0.0 <8.0.0 7.0.8
collection ^1.14.0 1.14.12
database ^0.2.4 0.2.7
fixnum ^0.10.0 0.10.11
meta ^1.1.0 1.1.8
universal_io ^0.8.5 0.8.6
Transitive dependencies
async 2.4.0
built_collection 4.3.2
charcode 1.1.2
convert 2.1.1
csslib 0.16.1
html 0.14.0+3
matcher 0.12.6
path 1.6.4
petitparser 3.0.0
protobuf 1.0.1
quiver 2.1.2+1
source_span 1.6.0
stack_trace 1.9.3
term_glyph 1.1.0
typed_data 1.1.6
universal_html 1.1.12
xml 3.7.0
zone_local 0.1.2
Dev dependencies
pedantic ^1.9.0
test ^1.8.0