question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SQL generation like in AndroidX Room

See original GitHub issue

I know that the readme states that SQLDelight generates typesafe kotlin APIs from your SQL statements. Is it also possible to generate SQL from Kotlin classes like in AndroidX Room? Or at least write a Kotlin class once and use it in both KotlinX serialization and this library without the need of a mapping function like shown in this example? I think it is not possible to add Annotation like @SerialName to the auto generated class, right?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
AlecStrongcommented, Dec 7, 2020

I thought it was directly covered in the documentation but it’s not, we should add that. It’s the same syntax as custom column types:

TEXT AS @Annotation String

0reactions
AlecStrongcommented, Dec 22, 2020

See the mapper param here https://cashapp.github.io/sqldelight/android_sqlite/custom_projections/

On Tue, Dec 22, 2020 at 8:39 AM Jemo Mgebrishvili notifications@github.com wrote:

Thanks and do you have any documentation? Or example? How can I do that?

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/cashapp/sqldelight/issues/2105#issuecomment-749544469, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMZBQGIDVIKRXGQU6MV6XDSWCOP5ANCNFSM4UQPYVDA .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Save data in a local database using Room | Android Developers
Compile-time verification of SQL queries. · Convenience annotations that minimize repetitive and error-prone boilerplate code. · Streamlined database migration ...
Read more >
Abstracting SQL queries with Room Database in Android
Room, an alternative to traditional SQL​​ The folks working on the Android platform noticed this and introduced Room, which is a solution that...
Read more >
Using the Room framework as SQL object mapping library
This tutorial describes how to work with the Room framework to manage SQLite database in Android applications. It also describes the direct ...
Read more >
Using Room Database | Android Jetpack | by Ashish Rawat
Android Jetpack is a collection of Android software components to make it easier for you to ... But in Room, there is SQL...
Read more >
How to dynamically query the room database at runtime?
Notes · 2. Is @RawQuery subject to risk of SQL injection attack and therefore a security risk? – AJW · 2. No. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found