bagel_db 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new48

BagelDB #

BagelDB is a content management system with rich API features. The database aims to offer an all in one service for web and app developers, from data delivery to search functionality. While at the same time, the aim is that data administrators will have an ability to access the data, filtering based on their requirements and than export the data if necessary. Our main focuses are content delivery speed and developer and data-admin experience.

The way the system works is you have dedicated tokens that can be used to perform CRUD operations. The access for each of those tokens can be set via your interface, in the settings option in the project page.

[0.0.1] #

  • The initial version.

[0.1.0] #

  • Add an example in example directory
  • Add more descriptive README
  • Add more documantation to the functions

example/example.dart

// Copyright 2020 Bagel Studio ltd. All rights reserved.

import 'package:bagel_db/bagel_db.dart';
import 'package:dio/dio.dart';

// create an instance of BagelDB
BagelDB bagelDB = BagelDB(
    organizationId: 'mkd2tbi23pfo11ei0t0g', // replace with your organization id
    apiKey: 'AIzaSyDfZNuVbEN_73RhORbwo-A2hRMMpKBOZZU', // replace with the api key of your projcet
    projectId: 'brh2tg223akg00ei0ung'); // replace with your project id

// create BagelDB instance, with a specific collection
BagelDBRequest bagelDBRequest = BagelDBRequest(bagelDB: bagelDB, collection: 'testItems' /*specify your collection*/);

// a var that will hold data in a JSON format
var data;

// a var that will hold the response from BagelDB
Response response;

// get data, using Builder pattern
void getFromBagelDB() async {
  // simple get
  response = await bagelDBRequest.get();

  // get with query
  response = await bagelDBRequest.addQuery('position:developer').addQuery('age:>:27').get();

  // sort the data bt parameter
  response = await bagelDBRequest.addSort('age').get();

  // sort with order
  response = await bagelDBRequest.addSort('age').addOrder('desc').get();

  // define the number of results in page
  response = await bagelDBRequest.addResponsesPerPage('2').get();

  // specify if you wanted the nested objects fully
  response = await bagelDBRequest.everything().get();

  // get a specific item
  response = await bagelDBRequest.addDoc('5dr22f010a1296a13e2f967a' /*replace with your item id*/).get();

  data = response.data;
}

// post item. Post returns the id of item that created
void postToBagelDB() async {
  // post item to BagelDB
  response =
      await bagelDBRequest.post(item: {'name': 'Baz', 'age': 25, 'position': 'CTO'} /* replace with your item */);
  data = response.data;
}

// put item
void putInBagelDB() async {
  // post item to BagelDB
  response = await bagelDBRequest.put(item: {
    'name': 'Baz',
    'age': 34,
    'position': 'CEO',
    '_id': '2bb9836502f94e7c9b4afb66' // specify the id of the itemwith your item
  }, itemId: '2bb9836502f94e7c9b4afb66' /* specify again the item id */);
  data = response.data;
}

// delete item
void deleteFromBagelDB() async {
  response = await bagelDBRequest.delete(itemId: '2bb9836502f94e7c9b4afb66');
  data = response.data;
}

Use this package as a library

1. Depend on it

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


dependencies:
  bagel_db: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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:bagel_db/bagel_db.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]
91
Overall:
Weighted score of the above. [more]
48
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • bagel_db that is a package requiring null.

Health suggestions

Format lib/src/bagel_db_functions.dart.

Run flutter format to format lib/src/bagel_db_functions.dart.

Maintenance suggestions

The package description is too short. (-9 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.7.0 <3.0.0
dio ^3.0.8 3.0.9
flutter 0.0.0
random_string ^2.0.1 2.1.0
Transitive dependencies
charcode 1.1.3
collection 1.14.12 1.14.13
http_parser 3.1.4
meta 1.1.8 1.2.2
path 1.7.0
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test
test ^1.14.7