leonardiwagner / jsonbox-java

JVM library for jsonbox.io storage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jsonbox-java Travis (.org) Coveralls github Maven Central

JVM library for jsonbox.io: A HTTP based JSON storage. It lets you store, read & modify JSON data over HTTP APIs for FREE. Ideal for small projects, prototypes or hackathons, where you don't have to spin up your own data store.

Demo example:

JsonBoxStorage storage = new JsonBoxStorage("box30c83d77bab82ce487665");
// create a new record
storage.create(adapter.toJson(new Record("john")));
// read records
List<Record> records = adapter.fromJson(storage.read());

Starting Guide

  1. Installation
  2. Basic examples
  3. Advanced examples with JSON parsing

Documentation

Constructors

Name Summary
JsonBoxStorage() Instance for a jsonbox.io box, a random box id will be generated, you can use getBoxId() to retrieve the generated box id
JsonBoxStorage(String boxId) Instance for a jsonbox.io box
JsonBoxStorage(String boxId, String collectionId) Instance for a jsonbox.io collection inside a box

Functions

Name Summary
create(String json) Create a new record
read() Read all records
read(int skip, int limit, String filter, String sort) Read records with pagination, filtering and sorting*
update(String recordId, String json) Update a record by a given record id
delete(String recordId) Delete a single record by a given record id
deleteFiltering(String filter) Delete multiple records using filtering*

*filtering and sorting:

  • filter usage here
  • sort by a json property, use - for descending sorting, example: "-name".

Getters

Name Summary
getBoxId() current box id
getCollectionId() current collection id (returns null if you are not using a collection)

Helper Functions for reading

Name Summary
readFiltering(String filter) Read applying only filtering
readSorting(String sort) Read applying only sorting
read(int skip, int limit) Read applying only pagination**
read(int skip, int limit, String filter) Read applying only pagination and filtering**

**default sorting is _createdOn desc.

Contribution

Feel free to contribute. Just create an issue before sending a Pull Request.

License

Apache 2.0

About

JVM library for jsonbox.io storage

License:Apache License 2.0


Languages

Language:Java 100.0%