All Projects → codersgarage → Belleorm

codersgarage / Belleorm

Licence: mit
A Sqlite ORM library for Kotlin, Java & Android.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Belleorm

Delphi Orm
Delphi ORM
Stars: ✭ 16 (-86.32%)
Mutual labels:  orm, sqlite
Sqlite orm
❤️ SQLite ORM light header only library for modern C++
Stars: ✭ 1,121 (+858.12%)
Mutual labels:  orm, sqlite
Zeeql3
The ZeeQL (EOF/CoreData/AR like) Database Toolkit for Swift
Stars: ✭ 29 (-75.21%)
Mutual labels:  orm, sqlite
Servicestack.ormlite
Fast, Simple, Typed ORM for .NET
Stars: ✭ 1,532 (+1209.4%)
Mutual labels:  orm, sqlite
Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+15428.21%)
Mutual labels:  orm, sqlite
Xorm
Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3,mssql,oracle, Moved to https://gitea.com/xorm/xorm
Stars: ✭ 6,464 (+5424.79%)
Mutual labels:  orm, sqlite
Hunt Entity
An object-relational mapping (ORM) framework for D language (Similar to JPA / Doctrine), support PostgreSQL and MySQL.
Stars: ✭ 51 (-56.41%)
Mutual labels:  orm, sqlite
Sequelize
An easy-to-use and promise-based multi SQL dialects ORM tool for Node.js
Stars: ✭ 25,422 (+21628.21%)
Mutual labels:  orm, sqlite
Alchemy
Reactive ORM for Android
Stars: ✭ 88 (-24.79%)
Mutual labels:  orm, sqlite
Chloe
A lightweight and high-performance Object/Relational Mapping(ORM) library for .NET --C#
Stars: ✭ 1,248 (+966.67%)
Mutual labels:  orm, sqlite
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+562.39%)
Mutual labels:  orm, sqlite
Reactiveandroid
🚀 Simple and powerful ORM for Android
Stars: ✭ 102 (-12.82%)
Mutual labels:  orm, sqlite
Bookshelf
A simple Node.js ORM for PostgreSQL, MySQL and SQLite3 built on top of Knex.js
Stars: ✭ 6,252 (+5243.59%)
Mutual labels:  orm, sqlite
Diesel
A safe, extensible ORM and Query Builder for Rust
Stars: ✭ 7,702 (+6482.91%)
Mutual labels:  orm, sqlite
Nano Sql
Universal database layer for the client, server & mobile devices. It's like Lego for databases.
Stars: ✭ 717 (+512.82%)
Mutual labels:  orm, sqlite
Pop
A Tasty Treat For All Your Database Needs
Stars: ✭ 1,045 (+793.16%)
Mutual labels:  orm, sqlite
Go Sqlbuilder
A flexible and powerful SQL string builder library plus a zero-config ORM.
Stars: ✭ 539 (+360.68%)
Mutual labels:  orm, sqlite
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+22600%)
Mutual labels:  orm, sqlite
Ebean
Ebean ORM
Stars: ✭ 1,172 (+901.71%)
Mutual labels:  orm, sqlite
Entityworker.core
EntityWorker is an object-relation mapper(ORM) that enable .NET developers to work with relations data using objects. EntityWorker is an alternative to entityframwork. is more flexible and much faster than entity framework.
Stars: ✭ 91 (-22.22%)
Mutual labels:  orm, sqlite

BelleORM

A Sqlite ORM library for Kotlin, Java & Android.

Status : Active
Version : v1.8

Features

Currently implemented:

  • Insert
  • Retrieve
  • Update
  • Delete
  • Drop

Usages

In your build file add

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

And

dependencies {
    implementation 'ninja.sakib:BelleORM:v1.8'
}
Maven
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
	</repository>
</repositories>

And

<dependency>
    <groupId>ninja.sakib</groupId>
    <artifactId>BelleORM</artifactId>
    <version>v1.8</version>
</dependency>

In case you need jar download is available here .

More option can be found here.

Examples

Open database connection
Kotlin
In Kotlin,
val belleORM: BelleORM = BelleORM("test.db", "/Users/s4kib/")
val belleORM: BelleORM = BelleORM("test.db")    // DB will take place in user.home directory

In Android,
val appPath: String = getApplicationContext().getFilesDir().getAbsolutePath()  // Output : /data/data/application_package_name/files/
val belleORM: BelleORM = BelleORM("test.db", appPath)
Java
In Java,
BelleORM belleORM = new BelleORM("test.db", "/Users/s4kib/")
BelleORM belleORM = new BelleORM("test.db", )  // DB will take place in user.home directory

In Android,
String appPath = getApplicationContext().getFilesDir().getAbsolutePath()  // Output : /data/data/application_package_name/files/
val belleORM = new BelleORM("test.db", appPath)
Insert value
class Student {
    @PrimaryKey
    @AutoIncrement
    var studentId: Int = 0
    var name: String? = null
    var department: String? = null
    var cgpa: Double = 0.0
    var dateOfBirth: java.util.Date? = null
    @Ignore
    var section: String? = null
}

val student: Student = Student()
student.name = "Sakib Sayem"
student.department = "CSE"
student.cgpa = 2.3
student.dateOfBirth = Date()
belleORM.save(student)
belleORM.close()
Retrieve Values
val students = belleORM.find(Student())
for (it in students) {
    val student = it as Student
    println(student.studentId)
    println(student.name)
    println(student.department)
    println(student.cgpa)
    println(student.dateOfBirth)
    println()
}
Result
1
Sakib Sayem
CSE
2.3
Wed Sep 27 23:21:52 BDT 2017
Retrieve values based on condition
val condition: BelleORMCondition = BelleORMCondition.Builder()
            .eq("name", "sakib")
            .and()
            .greaterEq("cgpa", 18)
            .or()
            .startsWith("name", "sami")
            .sort("name", BelleORMQuery.Sort.DESCENDING)
            .sort("department", BelleORMQuery.Sort.ASCENDING)
            .build()

val students = belleORM.find(Student(), condition)
for (it in students) {
    val student = it as Student
    println("${student.studentId}")
    println("${student.name}")
}
Update value
// values will be updated based on this condition
val condition: BelleORMCondition = BelleORMCondition.Builder()
            .eq("name", "Sakib")
            .build()

val updater: BelleORMUpdater = BelleORMUpdater.Builder()
            .set("name", "Sayan Nur")
            .condition(condition)   // condition is optional
            .build()

belleORM.update(Student(), updater)
Delete values
belleORM.delete(Student())
Drop Table
belleORM.drop(Student())

Check out more examples & API docs here


Note

Tables will be created on fly if not exists using class name and columns based on class fields.
Currently supported types:

  • String
  • Int
  • Long
  • Float
  • Double
  • Boolean
  • Date (java.util)

Autoincrement annotated fields values will be skipped as that will be handled by sqlite.

License

Copyright © Sakib Sami

Distributed under MIT license

Patreon Me !!!

If you want to support this project Patreon Me!

Buy Me a Coffee

Checkout with Paypal

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].