This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-15
Channels
- # alda (1)
- # beginners (24)
- # biff (9)
- # calva (55)
- # cherry (1)
- # clj-kondo (36)
- # cljs-dev (3)
- # clojure (37)
- # clojure-austin (2)
- # clojure-brasil (1)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (24)
- # clojure-spec (3)
- # clojure-uk (1)
- # community-development (6)
- # core-typed (1)
- # datalevin (5)
- # datomic (28)
- # emacs (14)
- # events (1)
- # gratitude (9)
- # hyperfiddle (27)
- # instaparse (3)
- # joker (16)
- # lsp (89)
- # malli (24)
- # missionary (2)
- # nbb (5)
- # off-topic (59)
- # re-frame (12)
- # reitit (17)
- # releases (4)
- # sci (14)
- # spacemacs (1)
- # squint (7)
- # xtdb (41)
I want to string search on a field called name
but i want to ensure im lower casing the values im searching on.. how do I accomplish this?
(q db '{:find [name (pull workout [*])]
:in [[search user]]
:where [[workout :workout/name name]
[(clojure.string/includes? name search)]]
:order-by [[name]]}
[(string/lower-case (or (:search params) "")) (:uid session)])
Lucene index is best for FTS, calling the includes function needs to consider every doc that has the name attr.
You can call clojure fn to do the lowering in query as well [(clojure.string/lower-case name) lower-name] and use that
you can use <
and >
etc on strings as well, but that obviously works from the start of the string only
Can a transaction function access the operations submitted before it (during the same transaction)?
Right, but can I actually get e.g. the list of put ops and documents that come before it?
I'm imagining a final tx fn that would determine what else might need to be done, based on what was transacted before it.
I could do this before submitting the tx, but then I might need to think about staleness.
you could potentially also put a separate event-like document earlier in your tx that you then query for in the tx-fn?
Hm, I'll consider that. > would it also be an option to widen the scope of your tx-fn? How do you mean? (If the msg below wasn't a continuation of that thought :))
as in, make the tx-fn your whole transaction - the prior operations, and the part that needs to react to them?
although maybe that wouldn't work if you needed to query the results of the earlier operations - you only get chance to mutate the DB with the return value of the tx-fn
but you could perhaps query enough to see what those operations would do (i.e. it'd be like doing it at submit but without the staleness issue)
> although maybe that wouldn't work if you needed to query the results of the earlier operations That is a good point. Would be more convenient to be able to do that, but should be workaround-able 🙂 Thanks for the quick reply, James. Cheers!
Is it possible to rollback of the database to before a transaction if i know the transaction id?
I don't think so? You should have enough information to generate a new transaction such that the data in the db after it will be as if it was rolled back. In other words, you would 'revert' all intermediate transactions.
Hey @U05F70RT9RQ I'm curious, is this just a dev / testing thing? Or do you have some production use case for that?
It's about migrating, and then rolling back if something goes wrong. What would be the best practice?
How do you define/measure "if something goes wrong"? XT's transactions are ideally usable for this, although I appreciate the atomicity may not be appropriate, especially if you have a LOT of data and need to avoid stalling concurrent transactions. How much data are you likely migrating? Roughly what size are the smallest boundaries of atomicity you could use? Is there a concurrent workload (i.e. it's a 'live' migration)? In the worst case I think you should be able to build up some userspace 'transaction' metadata that re-creates the kind of atomicity you are looking for.
Hey folks 👋 I'm going to run an 'office hours' style Virtual Meetup session today, starting in 20m if anyone's about to chat and wants to ask questions / listen to others! There's no fixed agenda or presentation, with exception of attempting to tackle @hairfire’s recent question about adapting one of the Learn XTDB Datalog Today examples into a 2.x query 🙂 you can sign up here: https://www.eventbrite.com/e/xtdb-virtual-meetup-tickets-526824956627
...or you can join direct if that's preferable: https://meet.google.com/bcu-sqkw-ckf
great to meet & chat just now @U0CKDV6DB, @UGNMGFJG3 - whilst I'm no expert on statecharts or ClojureDart (currently!) I hope the tips on Lucene and transaction functions tests will be of use. Always feel free to ping me if you ever want more tips :)
Thank you @U899JBRPF
thanks! it was nice to meet you both. ClojureDart does look intriguing and I love the history lesson on datalog
Just FYI @U899JBRPF. I implemented a simple state machine in 2 lines! Thanks for getting me out of my head there.
@U899JBRPF did this happen to get saved anywhere? I was away and didn’t get to join.
unfortunately not this time - sorry @U050N4M9Z - but I will run another session on Wednesday and try to give everyone some more notice...and get into the habit of recording again 🙂