Code Monkey home page Code Monkey logo

persist's Issues

Enable usage of lists

We want to be able to store list of storable properties.
Example :

@Persist
interface TestData {
    @PersistentId
    val id: Long
    val names: List<String>
}

@Persist
interface AnotherTestData {
    @PersistentId
    val id: Long
    val testDatas: List<TestData>
}

Add observability

We want to be able to observe properties of the record. We should find a nice way of getting a Flow from a property.

Add all types supported by sqldelight

sqldelight supports many other types than string and long. We want to implement them all.

CREATE TABLE some_types (
  some_long INTEGER,           -- Stored as INTEGER in db, retrieved as Long
  some_double REAL,            -- Stored as REAL in db, retrieved as Double
  some_string TEXT,            -- Stored as TEXT in db, retrieved as String
  some_blob BLOB,              -- Stored as BLOB in db, retrieved as ByteArray
  some_int INTEGER AS Int,     -- Stored as INTEGER in db, retrieved as Int
  some_short INTEGER AS Short, -- Stored as INTEGER in db, retrieved as Short
  some_float REAL AS Float     -- Stored as REAL in db, retrieved as Float
);

https://cashapp.github.io/sqldelight/multiplatform_sqlite/types/

Add mutability

We want to be able to have var in the interface defining the data. When setting a new value to the var, we should save the value in the db.

Add factory method instead of a provider

example :

fun TestData(name: String?, description: String): TestData {
    val database = PersistDatabaseProvider.getDatabase()
    val rawData = database.testData_DataQueries.transactionWithResult<TestData_Data> {
        database.testData_DataQueries.createNew(name, description)
        database.testData_DataQueries.getLastRecord().executeAsOne()
    }
    return retrieve(rawData.id)
}
fun TestData(id) = object : TestData {
          override val id = id
          override val name: kotlin.String?
              get() =
                  PersistDatabaseProvider.getDatabase().testData_DataQueries.getName(id).executeAsOne().name
          override var description: kotlin.String
              get() =
                  PersistDatabaseProvider.getDatabase().testData_DataQueries.getDescription(id).executeAsOne()
              set(value) = PersistDatabaseProvider.getDatabase().testData_DataQueries.setDescription(
                  value,
                  id
              )
      }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.