FireRecord is a framework written in kotlin which brings the ActiveRecord architecture as a wrapper to Firebase SDK on Android. The main idea is to make Android developing with Firebase (Firestore and Storage) still more productive with the well-known Active Record Pattern from Rails community.
If you liked this library take a look at the iOS Swift version
class User: FireRecord() {
companion object: FireRecordCompanion<User>()
var name: String? = null
var age: Int? = null
var birthDate: Date? = null
@ServerTimestamp var createdAt: Date? = null
}val user = User()
user.name = "Jhon"
user.age = 19user.save { print("User saved on Firestore") }User.all { users ->
users.forEach { print(it.name)}
}
User.load(id = "documentId") { user ->
print(user.name)
}user.name = "My new Name"
user.update { print("updated user um Firestore") }user.destroy { print("this user was deleted on Firestore") }- Basic CRUD functionality with Firestore
- Map queries from firestore
- Manage image/file properties (send/retrieve from Storage)
- Add realtime capabilities
- Add offline capabilities
Add Firestore and FireRecord to your app build.gradle
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.sanford.firerecord:firerecord:0.1'
}FireRecord is available under the MIT license. See the LICENSE file for more info.