Comments (4)
I've looked into updating doobie
to 1.0.0-RC4
and have a branch where things compile BUT: the KleisliInterpreter
now requires a LogHandler
instance as a parameter which poses a challenge. I have a few ideas how to solve this but none of them are ideal:
- Just use
LogHandler.noop
=> this is bad because query logging will be disabled which would break peoples expectations at runtime - Update the api to take a
LogHandler
inconnectionFromJdbc
(andfromConnectionSource
) => this is bad for multiple reasons. It's a breaking change and more importantly it would leakdoobie
specific details into the api (and would make this PR impossible: #45) - Update
io.github.gaelrenoux.tranzactio.doobie.Database
to be a class that takes aLogHandler
instance in the constructor => this is a breaking api change but it's the most flexible solution I can think of - Create a custom
LogHandler
instance insideio.github.gaelrenoux.tranzactio.doobie.Database
=> this is bad because it would remove the option of customizing theLogHandler
by users of this library but this is the least intrusive change(other than usingLogHandler.noop
) and might be a good temporary solution until the finaldoobie-1.0.0
is released(because things might change again while it's in RC).
What do you think @gaelrenoux ? I'd be happy to submit a PR if we can agree on a direction to take.
from tranzactio.
I just encountered this. We needed to upgrade doobie for effectful logging. @gaelrenoux, is there anything you need to move this forward? Would be happy to send a PR (if @erdeszt doesn't beat me to it first :))
from tranzactio.
A custom LogHandler
is indeed the easiest solution. Honestly I think I'd use the noop
in that case, rather that force logging of queries through a custom-built LogHandler
instance: it's not perfect, but there are other ways to see the queries being executed, and forcing the logs would have performance implications. Obviously, that's still not a very good solution.
Changing the Database to to take a LogHandler instance on creation: I don't think that would work. All the layer-building methods (such as DatabaseModuleBase.fromDatasourceAndErrorStrategies`) wouldn't work without passing the LogHandler, which would again require changing the general API.
The best idea I can think of is to introduce a general Context
trait, passed on creation, which would have a different implementation based on which library you are using. The Doobie implementation of Context
would contain the LogHandler
. This would also be a more flexible solution, that will allow other library-specific information to be carried when necessary. I'll try and see what I can do.
from tranzactio.
I've created PR #48 for this topic. I'd gladly have one of you guys review it, see what you think.
from tranzactio.
Related Issues (20)
- Getting this error with ZIO 1.0.0 HOT 4
- question about transaction management? HOT 3
- Using tzio with single connections HOT 3
- Testing with TranzactIO HOT 4
- Problem with restoring connection HOT 6
- Lack of support for doobie streams HOT 5
- Remove *R methods HOT 4
- Please add cross-compile for 2.12 HOT 1
- Support doobie 1.0.0 (cats-effect 3 compatible) HOT 1
- May be we can deprecate this repository HOT 1
- Upgrade to ZIO 2.0 HOT 17
- Scala 3 artefacts? HOT 2
- Handling multiple databases HOT 1
- Adds Doobie Stream handling to the README HOT 3
- Remove the somethingR methods HOT 1
- Add wrapper for Anorm
- Upgrade zio-interop-cats version HOT 3
- [doobie][scala3] ZEnvironment missings layer HOT 7
- Option to commit transaction on a failure
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tranzactio.