DBFlow


Source link: https://github.com/Raizlabs/DBFlow

A robust, powerful, and very simple ORM android database library with annotation processing.

The library is built on speed, performance, and approachability. It not only eliminates most boiler-plate code for dealing with databases, but also provides a powerful and simple API to manage interactions.

Let DBFlow make SQL code flow like a steady stream so you can focus on writing amazing apps.

Why Use DBFlow

DBFlow is built from a collection of the best features of many database libraries in the most efficient way possible. Also, it is built to not only make it significantly easier to deal with databases on Android, but also to provide extensibility. Don't let an ORM or library get in your way, let the code you write in your applications be the best as possible.

  • Extensibility: No restrictions on inheritance of your table classes. They can be plain POJOs, no subclass required, but as a convenience we recommend using BaseModel. You can extend non- Model classes in different packages and use them as your DB tables. Also you can subclass other tables to join the @Column together, and again they can be in different packages.
  • Speed: Built with java's annotation processing code generation, there's almost zero runtime performance hit by using this library (only reflection is creation of the main, generated database module's constructor). This library saves hours of boilerplate code and maintenance by generating the code for you. With powerful model caching (multiple primary key Model too), you can surpass the speed of SQLite by reusing where possible. We have support for lazy-loading relationships on-demand such as @ForeignKey or @OneToMany that make queries happen super-fast.
  • SQLite Query Flow: The queries in this library adhere as closely as possible to SQLite native queries. select(name, screenSize).from(Android.class).where(name.is("Nexus 5x")).and(version.is(6.0)).querySingle()
  • Open Source: This library is fully open source and contributions are not only welcomed, but encouraged.
  • Robust: We support Trigger, ModelView, Index, Migration, built-in ways to manage database access, and many more features. SQLCipher, RXJava, and more!
  • Multiple Databases, Multiple Modules: we seamlessly support multiple database files, database modules using DBFlow in other dependencies, simultaneously.
  • Built On SQLite: SQLite is the most widely used database engine in world and using it as your base, you are not tied to a limited set of platforms or libraries.

Changelog

Changes exist in the releases tab.

Usage Docs

For more detailed usage, check out it out here

Including in your project

allProjects {

repositories {

  // required to find the project's artifacts
  maven {
 url "https://www.jitpack.io" 
}

}
 
}

Add the library to the project-level build.gradle, using the apt plugin to enable Annotation Processing:

  apply plugin: 'kotlin-kapt' // required for kotlin.
 def dbflow_version = "4.1.2"
// dbflow_version = 10-digit short-hash of a specific commit. (Useful for bugs fixed in develop, but not in a release yet)
 dependencies {

// if Java use this. If using Kotlin do NOT use this.
  annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${
dbflow_version
}
"

// Use if Kotlin user.
  kapt "com.github.Raizlabs.DBFlow:dbflow-processor:${
dbflow_version
}
"

compile "com.github.Raizlabs.DBFlow:dbflow-core:${
dbflow_version
}
"
  compile "com.github.Raizlabs.DBFlow:dbflow:${
dbflow_version
}
"

// sql-cipher database encryption (optional)
  compile "com.github.Raizlabs.DBFlow:dbflow-sqlcipher:${
dbflow_version
}
"
  compile "net.zetetic:android-database-sqlcipher:${
sqlcipher_version
}
@aar"

// kotlin extensions
  compile "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:${
dbflow_version
}
"

// RXJava 1 support
  compile "com.github.Raizlabs.DBFlow:dbflow-rx:${
dbflow_version
}
"

// RXJava 1 Kotlin Extensions Support
  compile "com.github.Raizlabs.DBFlow:dbflow-rx-kotlinextensions:${
dbflow_version
}
"

// RXJava 2 support
  compile "com.github.Raizlabs.DBFlow:dbflow-rx2:${
dbflow_version
}
"

// RXJava 2 Kotlin Extensions Support
  compile "com.github.Raizlabs.DBFlow:dbflow-rx2-kotlinextensions:${
dbflow_version
}
"
 
}
 

Pull Requests

I welcome and encourage all pull requests. Please read over these guidelines to ensure smooth PR attention:

  1. Match coding style (braces, spacing, etc.) This is best achieved using Reformat Code shortcut, command+ option+ L on Mac and Ctrl+ Alt+ L on Windows, with Android Studio defaults.
  2. If its a feature, bugfix, or anything please only change code to what you specify.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
  4. Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Have fun!

Maintained By

agrosner ( @agrosner)

Resources

This demo aims shows practical way of clean architecture, MVP in android with Kotlin.

An example app to download pdf from url and saved into your internal storage.

A sample app that shows basic usage of Firebase Auth and Database in form of a very simple chat hub app.

A sample project based on the new Android Component Architecture.

Lifecycle, LiveData, MVVM, ViewModels, DataBinding, Dagger

Using DragableView you can merge various views into one layout with drag and drop animation. For example if you have 3 ImageViews(source view) and one MainImageView(destination view) and you want to implement drag-drop animation to drag one of the ImageView (source) and drop on MainImageView (destination view).

Record moments of your life or choose exist video or gif animation as watch face for your Android Wear device.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes