Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neat! #1

Open
bmeike opened this issue Mar 27, 2020 · 5 comments
Open

Neat! #1

bmeike opened this issue Mar 27, 2020 · 5 comments

Comments

@bmeike
Copy link

bmeike commented Mar 27, 2020

There's some cool stuff in here. I especially like the use of Flows.

... I'm curious about the generalized result set mapping. Do you find that valuable? Better than mapping per query? I've ended up writing query routines, like an old DAO, that run the query and convert the results to Data objects. Trying to make it generic never seemed an advantage.

I promise to change the argument to ".inBatch" (as soon as they will let me) to allow it to throw an Exception. Pinky swear.

If you are looking to do something really awesome, you could have a shot at Co-routines.

Thanks for this!

@damianogiusti
Copy link
Contributor

damianogiusti commented Mar 30, 2020

Thank you @bmeike for the review!

I'm curious about the generalized result set mapping. Do you find that valuable?

Actually, the map-to-object extension is meant to simplify a task that we find to be very common during every day development. Reading some data from the database and being able to consume it as an object is made so simple thanks to Map delegation.

Better than mapping per query

I think that it depends on the use case. As you can see in the demo app, the Map delegation makes things easier. But you lose the R8 shrinking on models. In case of complex data structures or other requirements, I agree with you about using a "mapping per query" approach.

I must say the CBLite SDK is nearly perfectly suitable for Kotlin. There are just a few interoperability issues that we've already reported to your team. Just wanted to add some sugar. Moreover, the use of Flow make things way straight forward for Android devs, also thanks to the asLiveData extension provided by Google.

Thanks for your time and precious support! Very appreciated.

– Damiano

@jeffdgr8
Copy link
Contributor

Great Kotlin extensions for Couchbase! I was writing some similar extensions, including property map delegation, when I came across your library.

@bmeike another advantage of the property map delegation is it handles cases where an older client may be unaware of a newer schema, where fields may have been added to a document by a newer client. The older client will preserve these field values in the map, even if they're not part of its object schema, if it were to modify such a document.

I'm curious if anyone's looked into a Kotlin Multiplatform Mobile Couchbase SDK?

@bmeike
Copy link
Author

bmeike commented Oct 29, 2020

@jeffdgr8 : please say more: what is a Kotlin Multiplatform Mobile Couchbase SDK?

I am once-bit-twice shy on this kind of automatic Object-NoSQL-Model from my days of using ORMs. It is my opinion that they never worked: They made easy stuff slightly easier and hard stuff impossible.

NoSQL, less likely to generate 1->* and * -> * mappings, might be able to side-step the worst of the ORM problems. If the map-to-object extensions work, in a particular app that's awesome. I hope nobody gets the urge to try to make them general...

@jeffdgr8
Copy link
Contributor

A Kotlin Multiplatform Mobile SDK would be a pure Kotlin library that would provide an API to interface Coucbase Lite that could be used in a KMM app in both Android and iOS. Since CBL is native under the hood of both the Android Java and iOS Objective-C/Swift APIs, it'd be a great fit for a KMM library. Currently SQLDelight is one of a few databases that currently supports KMM. There are a growing number of KMM libraries as the platform continues to mature.

@jeffdgr8
Copy link
Contributor

jeffdgr8 commented Nov 6, 2023

I want to give a shoutout here, as one of the first public conversations I had on the idea of a Kotlin Multiplatform library for Couchbase Lite. I recently publicly released that KMP CBL library, Kotbase!

I've also integrated many of this library's great Kotlin extension functions into Kotbase as part of the KTX extensions. I want to also express appreciation and thank you for this contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants