{"id":25045169,"url":"https://github.com/petruki/dblite-library","last_synced_at":"2026-05-15T08:03:51.665Z","repository":{"id":102027831,"uuid":"345453624","full_name":"petruki/dblite-library","owner":"petruki","description":"DbLite is a simple and versatile SQLite interface","archived":false,"fork":false,"pushed_at":"2021-03-09T22:45:27.000Z","size":169,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T05:35:18.548Z","etag":null,"topics":["android-library","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petruki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-07T21:08:26.000Z","updated_at":"2021-03-09T22:44:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"605b948a-c487-4308-b2c4-88ccbcb34eee","html_url":"https://github.com/petruki/dblite-library","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petruki%2Fdblite-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petruki%2Fdblite-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petruki%2Fdblite-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petruki%2Fdblite-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petruki","download_url":"https://codeload.github.com/petruki/dblite-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246399172,"owners_count":20770878,"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":["android-library","sqlite"],"created_at":"2025-02-06T05:32:43.727Z","updated_at":"2025-10-18T21:54:34.496Z","avatar_url":"https://github.com/petruki.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![](https://jitpack.io/v/petruki/dblite-library.svg)](https://jitpack.io/#petruki/dblite-library)\n\n### About\n\nDbLite is a simple Android library that allows you to interact with SQLite DB.\nMost of the libraries provide better and clean implementaion to interact with SQLite, but they lack of features when the data can be both relational and non-relational. This common scenario happens when you consume JSON data from external APIs and need to store it on a local DB.\n\nThis solution provides with a versatile way to implement and resolve model object dependencies easier.\n\nHere are some of the features:\n- Independent object persistence implementation (Wrappers)\n- CRUD operations out-of-the-box\n- Entity resolver for creating relationship from non-relational data\n\n### Installation\n\n\u003e Step 1 - Add Jitpack to the project build.gradle file\n\n```\nallprojects {\n\trepositories {\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n```\n\n\u003e Step 2 - Add DbLite dependency to the module app of your project\n\n```\ndependencies {\n\timplementation 'com.github.petruki:dblite-library:0.1.1-rc'\n}\n``` \n\n\n### How-to (Sample usage)\n\nBelow is the step-by-step you must follow to implement new Repository classes.\nYou can also check the playground demo included to this library source code for more detail.\n\n1. Create model class: model/User.java\n```java\npublic class User {\n    String _id;\n    String name;\n    String email;\n}\n```\n\n\n2. Create wrapper class: repository/UserWrapper.java\n```java\n@DbLiteWrapper(entityName = \"USER\", columns = { \"id\", \"name\", \"email\" })\npublic class UserWrapper implements EntityWrapper\u003cUser\u003e {\n\n    @Override\n    public User unWrap(Cursor cursor) {\n        User user = new User();\n        user.setId(getString(cursor, \"id\"));\n        user.setName(getString(cursor, \"name\"));\n        user.setEmail(getString(cursor, \"email\"));\n        return user;\n    }\n\n    @Override\n    public ContentValues wrap(User user) {\n        ContentValues values = new ContentValues();\n        values.put(\"id\", user.getId());\n        values.put(\"name\", user.getName());\n        values.put(\"email\", user.getEmail());\n        return values;\n    }\n}\n```\n\n3. Create repository class: repository/UserRepository.java\n```java\npublic class UserRepository extends AbstractRepository\u003cUser\u003e {\n\n    public UserRepository(Context context) {\n        super(context, new UserWrapper(), MyDatabase.class);\n    }\n}\n```\n\n\n4. Create DB class that configures wrappers and DB arguments (repository/MyDatabase.java)\n```java\n@DbLite(dbName = \"BOOKING_DB\", version = 1, wrappers = {\n        UserWrapper.class,\n        BookingWrapper.class\n})\nabstract class MyDatabase extends DbLiteFactory {\n\n    protected MyDatabase(Context context) {\n        super(context);\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetruki%2Fdblite-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetruki%2Fdblite-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetruki%2Fdblite-library/lists"}