Skip to content
/ RxGreenDao Public

RxGreenDao: Reactive Extensions for GreenDao

Notifications You must be signed in to change notification settings

llp/RxGreenDao

Repository files navigation

RxGreenDao

RxGreenDao: Reactive Extensions for GreenDao

使GreenDao支持Rxjava的补丁包

#Download

      compile 'io.github.llp:RxGreenDao:0.1'

注意:

  1. 使用DaoGenerator生成出来的XXXDao要把继承关系从AbstractDao修改为RxAbstractDao
  2. RxGreenDao提供的方法以rx开头,例如:xxxDao.rxCount(),xxxDao.rxInsert()...
  3. 提供xxxDao.rxQueryBuilder()

#TODO

  1. 扩展DaoGenerator,使其自动生成继承RxAbstractDao的xxxDao
  2. 添加测试类

#Sample Note note = new Note(); note.setText("hello world!"); noteDao.rxInsert(note) .doOnNext(new Action1() { @Override public void call(Long aLong) { Log.e(TAG, "#-----doOnNext---->>>" + aLong); } }) .flatMap(new Func1<Long, Observable<List>>() { @Override public Observable<List> call(Long aLong) { return noteDao.rxQueryBuilder().list(); } }) .flatMap(new Func1<List, Observable>() { @Override public Observable call(List notes) { return Observable.from(notes); } }) .flatMap(new Func1<Note, Observable>() { @Override public Observable call(Note note) { return Observable.just(note.getText()); } }) .subscribe(new Subscriber() { @Override public void onCompleted() { Log.e(TAG, "#-----onCompleted---->>>"); }

                @Override
                public void onError(Throwable e) {
                    Log.e(TAG, "#-----onError---->>>");
                }

                @Override
                public void onNext(String s) {
                    Log.e(TAG, "#------onNext--->>>" + s);
                }
            });

About

RxGreenDao: Reactive Extensions for GreenDao

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages