Kotlin Datastore

By pjain      Published Dec. 15, 2019, 7:17 a.m. in blog Programming   

iOS/Android DBI Strategy - Keys, Takeaways

IOS-Android DBI libraries STR - mostly SQLite - pre-kotlin

STR Kotlinish - Multplat SQLite only ios/andr

Resources BE DBI Other Src, Sort

  • BE oriented vs IOS/Android "pointer to secure file/perms"

QueryDSL

Focus on Mobile Only = SQLite

Realm

How to set primary key auto increment in realm android - Stack Overflow Realm Database Android - YouTube

Tutorials

SQLDelight

Doppl

Jasync

  • For a long time I was using jooq. But moved on do to hard time mapping join records, and being tied to jdbc. I've been using jasync and getting much better performance.

Hand Crafted Android SQLite libs

r Kotlin SQLite DBI - Hand built

https://github.com/ScottPeterJohnson/kdbgen

Kotlinish DBI

Exposed Kotlin SQL Framework

JetBrains/Exposed: Kotlin SQL Framework

  • boilerplate is a bit much - Doesn't make too much sense and data access is generally through weakly typed runtime maps, unless you write twice the boilerplate to get it in POJO
  • to add just one column, you have to add the same field in many places: 1. The table schema object 2. The data class 3. The mapper for object -> class 4. Mapper for class -> object
  • And add another one for any read/update you want to do in the Service class to actually access your model SO Really high scope for human error and this would be a nightmare to maintain.

Kotlinish DBI

  • https://github.com/seratch/kotliquery

JDBCish DBI

STR AR

  • jOOQ was a much easier replacement for legacy plain SQL & JDBC than some ORM would be .. but also added it to some older projects that primarily used Hibernate, in cases where I needed extra control over my queries, and it works great, the two mix quite happily.

jOOQ

https://www.jooq.org/ - WHY? Query composition, of course. No pasting of SQL strings - jOOQ can be written extremely modular and composed in code. Fully type & injection safe. - well designed library. It let's you write what is basically normal sql but in a completely typesafe way. The maintainer is also wonderful. He answers questions all the time and is very responsive to bugs and feature requests. - +HikariCP just helps manage the connection pool - + Flyway helps you manage your db schema and migrations. You can use them independently of jooq, but they compliment it nicely.

jdbi.org

  • Super easy and straight forward. If you're like me in that you dislike ORMs and are comfortable writing SQL, but want to abstract away the tedious things like mapping to/from POJO/POKOs jdbi is best in class.
  • I've been using the fluent interface with the actual SQL statements in multi-line strings. I find it easier to debug than the object interface and there's not not too much boilerplate

  • https://github.com/vsch/kotlin-jdbc

  • spring-data-jdbc is really good. https://spring.io/projects/spring-data-jdbc

Java JPA and other Frameworks

JPAish

ebean orm - https://ebean.io It uses JPA mappings, it's aware of Kotlin non-nullable types, type safe queries (Kotlin and Java), avoids N+1, partial object support, db migration generation and running, testing via docker container support, sql 2011 history support etc.

Advanced Local Storage, File Systems, NoSQL

Local Storage - file systems

Sync, Store

https://github.com/NYTimes/Store

r NoSQL


0 comments

There are no comments yet

Add new comment

Similar posts

Serverless Computing

Android Layouts Design 101

Drawing, Canvas in Kotlin

Custom Views