{"id":3589,"url":"https://github.com/xmartlabs/RxSimpleNoSQL","last_synced_at":"2025-08-03T20:32:49.593Z","repository":{"id":141654284,"uuid":"54569294","full_name":"xmartlabs/RxSimpleNoSQL","owner":"xmartlabs","description":"Reactive extensions for SimpleNoSQL","archived":false,"fork":false,"pushed_at":"2018-04-24T17:50:55.000Z","size":73,"stargazers_count":37,"open_issues_count":3,"forks_count":3,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-08-16T14:34:46.766Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xmartlabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-03-23T15:05:11.000Z","updated_at":"2021-08-29T18:45:26.000Z","dependencies_parsed_at":"2024-01-02T21:21:13.702Z","dependency_job_id":"325d0e24-3561-42c2-96e8-f5de7255e8a4","html_url":"https://github.com/xmartlabs/RxSimpleNoSQL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FRxSimpleNoSQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FRxSimpleNoSQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FRxSimpleNoSQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xmartlabs%2FRxSimpleNoSQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xmartlabs","download_url":"https://codeload.github.com/xmartlabs/RxSimpleNoSQL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228567009,"owners_count":17937983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:45.751Z","updated_at":"2024-12-07T05:30:43.030Z","avatar_url":"https://github.com/xmartlabs.png","language":"Java","readme":"# RxSimpleNoSQL\n\nReactive extensions for [SimpleNoSQL](https://github.com/Jearil/SimpleNoSQL). Manipulate entities using `Observable`s\nand `Completable`s.\n\n## Examples\n\nSuppose we have the following entity we want to manipulate:\n\n```java\nclass SampleBean implements Entity {\n    private String name;\n    private String id;\n    private Map\u003cString, String\u003e mapping;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public Map\u003cString, String\u003e getMapping() {\n        return mapping;\n    }\n\n    public void setMapping(Map\u003cString, String\u003e mapping) {\n        this.mapping = mapping;\n    }\n}\n```\n\nWe first start creating a bucket:\n\n```java\nBucket\u003cSampleBean\u003e bucket = new Bucket\u003c\u003e(context, SampleBean.class, \"bucketId\");\n```\n\n### Save\n\n#### Single\n\n```java\nSampleBean entity = new SampleBean();\nentity.setId(\"1\");\nentity.setName(\"Colin\");\nMap\u003cString, Integer\u003e birthday = new HashMap\u003cString, Integer\u003e();\nbirthday.put(\"day\", 17);\nbirthday.put(\"month\", 2);\nbirthday.put(\"year\", 1982);\nentity.setMapping(birthday);\n\nbucket.newQuery()\n        .save(entity)\n        .subscribe();\n```\n\n#### Multiple\n\n```java\nSampleBean entity2 = new SampleBean();\nentity2.setId(\"2\");\nentity2.setName(\"Santiago\");\n\nSampleBean entity3 = new SampleBean();\nentity3.setId(\"3\");\nentity3.setName(\"Xmartlabs\");\n\nbucket.newQuery()\n        .save(Arrays.asList(entity2, entity3))\n        .subscribe();\n```\n\n### Retrieve\n\n#### Single\n\n```java\nbucket.newQuery()\n        .entityId(\"entityId\")\n        .retrieve()\n        .subscribe(sampleBean -\u003e System.out.println(\"Name: %s\", sampleBean.getName()));\n```\n\n#### Multiple\n\n```java\nbucket.newQuery()\n        .filter(sampleBean -\u003e sampleBean.getName().startsWith(\"S\"))\n        .retrieve()\n        .subscribe(sampleBean -\u003e System.out.println(\"Name: %s\", sampleBean.getName()));\n```\n\n#### All\n\n```java\nbucket.newQuery()\n        .retrieve()\n        .subscribe(sampleBean -\u003e System.out.println(\"Name: %s\", sampleBean.getName()));\n```\n\n### Delete\n\n#### Single\n\n```java\nbucket.newQuery()\n        .entityId(\"entityId\")\n        .delete()\n        .subscribe();\n```\n\n#### Multiple\n\nCurrently, SimpleNoSQL does not support the usage of `filter` for the `delete` operation.\nThere's an issue [opened](https://github.com/Jearil/SimpleNoSQL/issues/34).\n\nNevertheless, this functionality can be achieved by first retrieving the entities to be deleted and then performing the actual `delete` operation individually:\n\n```java\nObservable\u003cSampleBean\u003e itemsToDelete = bucket.newQuery()\n        .filter(sampleBean -\u003e sampleBean.getName().startsWith(\"S\"))\n        .retrieve()\n\nCompletable deleteCompletable = Completable.concat(\n                                  itemsToDelete\n                                      .map(item -\u003e bucket.newQuery()\n                                                      .entityId(item.getId()))\n                                                      .delete());\n```\n\n#### All\n\n```java\nbucket.newQuery()\n        .delete()\n        .subscribe();\n```\n\n### Sorting\n\n[As SimpleNoSQL sorts the results in memory]\n(https://github.com/Jearil/SimpleNoSQL/blob/master/SimpleNoSQL/src/main/java/com/colintmiller/simplenosql/threading/DataDispatcher.java#L140),\nyou can carry this out the same way with `Observable#toSortedList`.\n\n## Development\n\nAs SimpleNoSQL, this project still isn't stable (the API can change at any time). You can use it with Gradle and\n[JitPack](https://jitpack.io):\n\n```groovy\nrepositories {\n    maven { url \"https://jitpack.io\" }\n}\n```\n\nThen adding the dependency:\n\n```groovy\nimplementation 'com.github.xmartlabs:RxSimpleNoSQL:-SNAPSHOT'\n```\n\nRxSimpleNoSQL requires at minimum Java 7 or Android 2.2.\n\n## Build\n\n[![Build Status](https://travis-ci.org/xmartlabs/RxSimpleNoSQL.svg?branch=master)](https://travis-ci.org/xmartlabs/RxSimpleNoSQL)\n\nTo build:\n\n```shell\ngit clone https://github.com/xmartlabs/RxSimpleNoSQL.git\ncd RxSimpleNoSQL/\n./gradlew build\n```\n\n## License\n\n```\nCopyright 2016 Xmartlabs SRL.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":["NoSQL","Libraries","Libs"],"sub_categories":["Database","\u003cA NAME=\"Orm\"\u003e\u003c/A\u003eOrm"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmartlabs%2FRxSimpleNoSQL","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxmartlabs%2FRxSimpleNoSQL","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxmartlabs%2FRxSimpleNoSQL/lists"}