项目作者: softotalss

项目描述 :
Export Realm Databases to Json and Json File
高级语言: Java
项目地址: git://github.com/softotalss/RealmExport.git
创建时间: 2018-10-20T19:46:23Z
项目社区:https://github.com/softotalss/RealmExport

开源协议:Other

下载


RealmExport

RealmExport is a Realm helper to export Realm Databases to:

  • Json
  • Json File

You can use this Json Object to send by email or for any other things that you need.

Only increase the size of your project by 10 KB ;)

Download

You can download an arr from maven releases page.

Or use Gradle:

  1. repositories {
  2. maven { url 'https://github.com/softotalss/realmexport/raw/master/maven-repository' }
  3. }
  1. dependencies {
  2. implementation 'com.google.code.gson:gson:x.x.x'
  3. implementation 'com.github.softotalss:realm_export:1.1.0'
  4. }

How do I use RealmExport?

You can use RealmExport in any part of your code, but it’s recommended that you use it in a background task.

Simple use

  1. // Export to Json:
  2. JsonObject dbJson = RealmExport.init((new RealmConfiguration.Builder()).build()).toJson();
  1. // Export to Json File:
  2. RealmExport.init((new RealmConfiguration.Builder()).build()).toJsonFile("path/bd.json");

Not forget replace “(new RealmConfiguration.Builder()).build()” for your specific Realm Configuration

Advanced use

  1. // You can use different initializations:
  2. RealmExport.init(RealmConfiguration configuration, String nullValue, DateFormat dateTimeFormatter)
  3. RealmExport.init(RealmConfiguration configuration, String nullValue)

Default values

  1. // For nullValue: "[null]"
  2. // For dateTimeFormatter: SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.LONG, SimpleDateFormat.LONG)

Deployment

  1. update version information
  2. gradlew assemble :real_export:publishMavenPublicationToMavenRepository
  3. git add, commit, push (on master branch)

Author

Alejandro Santana - @softotalss on GitHub

This project is based on stetho-realm

License

BSD, part MIT and Apache 2.0. See the LICENSE file for details.