-
Notifications
You must be signed in to change notification settings - Fork 348
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
IO monad #21
Comments
How this would be translated to Quill? If you add parametrised quotations to this, where that IO monad would sit? I guess it would have an impact on the AST.... new AST elements to represent parametrised quotations with their argument but that haven't yet run? I don't know if this make sense :/ so let's use and example. I have this two Cassandra queries (I'm using Cassandra because you are more constraint as you can't join column families): val getByName = quoted((name: String) => query[User].filter(_.name == name))
val getByID = quoted((id: String) => query[Books].filter(_.id == id)) If we wanted to combine those queries to get all books for a given user, we would have to combine them by running the first one using one of the What you want to add is an |
@lvicentesanchez This is more or less what I have in mind: val getByName = quoted((name: String) => query[User].filter(_.name == name))
val getByID = quoted((id: String) => query[Books].filter(_.id == id))
val io = IO(db)
for {
user <- io.run(getByName)("John").map(_.head)
books <- io.run(getById)(user.id)
} yield {
books
}
wdyt? |
Yes, that's more or less what I had in mind, I will probably called it a source transformer. Would the return type of the for-comprehension be a |
Yes, val getByName = quoted((name: String) => query[User].filter(_.name == name))
val getByID = quoted((id: String) => query[Books].filter(_.id == id))
val io = IO(db)
val res: IO[List[Book]]
for {
user <- io.run(getByName)("John").map(_.head)
books <- io.run(getById)(user.id)
} yield {
books
}
res.run // returns Future, Stream, etc |
@fwbrasil Can we have something like |
@jilen Yes, |
Hey, guys, do you really think that this is an essencial feature for version 1.0 release? I was thinking, I am really ok with the current feature set of the snapshot version. Maybe, we should just concentrate on fixing all critical bugs in order to release RC 1.0 as soon as possible? WDYT? |
@gustavoamigo makes sense. I'm removing the |
I think for certain use cases at work its a blocker. We basically need atomic transactions that we can rollback incase something fails (its pretty much a requirement for any serious database work) Personally I think I am fine with it being delayed, but thats only due to us using stored procedures as a work around. I also have no idea what "delayed" means, are we looking at a year or something? |
The IO monad is not a requirement for providing atomic transactions. You can use |
Does it exist for |
@mdedetrich yes, it does :) |
Ah, ignore my silliness then! |
Not your fault at all! It's still undocumented as of the latest release and we're working on improving it. There should be a release candidate soon with the documentation and improvements. |
Similar to Slick's
DBIO
. It should be possible to use it with any of theSource
implementations.The text was updated successfully, but these errors were encountered: