Skip to content
/ DBFlow Public
forked from agrosner/DBFlow

A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

License

Notifications You must be signed in to change notification settings

grennis/DBFlow

 
 

Repository files navigation

Image

JitPack.io Android Weekly Android Arsenal

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 vs other solutions

DBFlow was built with the intention of bringing the best of all features from other ORM database libraries and to do it even better. It was also built to not limit how you can code your problems, but make it significantly easier to make amazing applications. Don't let an ORM or library get in your way, let the code you write in your applications be the best as possible.

  1. Extensibility: Model is just an interface, 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 Model to join the @Column together, and again they can be in different packages. Also, subclass objects in this library to suit your needs.
  2. Speed: Built with java's annotation processing code generation, there's zero runtime performance hit by using this library. 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.
  3. 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()
  4. Open Source: This library is fully open source and contributions are not only welcomed, but encouraged.
  5. Robust: We support Trigger, ModelView, Index, Migration, built-in database request queue to perform operations on same thread, and many more features.
  6. Multiple Databases, Multiple Modules: we seamlessly support multiple database files, database modules using DBFlow in other dependencies, simultaneously.
  7. 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.

Applications That Use DBFlow

If you wish to have your application featured here, please file a ticket.

  1. Anonymous 1: An application that has over 1.5 million active installs
  2. Anonymous 2: An application that will have over 1 million active installs
  3. University of Oslo DHIS2 Android SDK

Changelog

3.0-beta1

Many large updates to the library. Probably the most significant changes since the library was written. Most major changes are here

for older changes, from other xx.xx versions, check it out here

Usage Docs

For more detailed usage, check out these sections:

Getting Started

Tables and Database Properties

Multiple Instances of DBFlow / Database Modules

SQL Statements Using the Wrapper Classes

Properties & Conditions

Transactions

Type Converters

Powerful Model Caching

Content Provider Generation

Migrations

Model Containers

Observing Models

Queries as Lists

Triggers, Indexes, and More

Including in your project

We need to include the apt plugin in our classpath to enable Annotation Processing:

buildscript {
    repositories {
      // required for this library, don't use mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    }
}

Add this maven url to your project.

allProjects {
  repositories {
    maven { url "https://jitpack.io" }
  }
}

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

  apply plugin: 'com.neenbedankt.android-apt'

  dependencies {
    apt 'com.github.Raizlabs.DBFlow:dbflow-processor:3.0.0-beta1'
    compile "com.github.Raizlabs.DBFlow:dbflow-core:3.0.0-beta1"
    compile "com.github.Raizlabs.DBFlow:dbflow:3.0.0-beta1"
  }

If you wish to grab the latest develop branch in your project, use JitPack dependencies:

  dependencies {
    apt 'com.github.Raizlabs.DBFlow:dbflow-processor:develop-SNAPSHOT'
    compile "com.github.Raizlabs.DBFlow:dbflow-core:develop-SNAPSHOT"
    compile "com.github.Raizlabs.DBFlow:dbflow:develop-SNAPSHOT"
  }

You can also specify a commit hash instead of develop-SNAPSHOT to grab a specific commit.

Pull Requests

I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.) This is best achieved using CMD+Option+L (Reformat code) on Mac (not sure for 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!

Maintainers

agrosner (@agrosner)

Contributors

wongcain

mozarcik

mickele

intrications

mcumings

ktzouno

About

A blazing fast, powerful, and very simple ORM android database library that writes database code for you.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%