rafafrdz / criteria4s

Criteria4s is a simple domain-specific language (DSL) to define criteria and predicate expressions for any data stores by using Scala type class mechanisms in a type-safe way. It pretends to be agnostic to any data store, and it is extensible to support any kind of data stores.
Apache License 2.0
16 stars 1 forks source link

Add arrays support #15

Closed mark-kar closed 1 week ago

mark-kar commented 1 month ago

Support collections draft https://github.com/rafafrdz/criteria4s/issues/6

I had to rewrite a lib's arch for implementing it It will be really nice to hear your opinion about it. I've thought that too many types String is a little bit dirty here so instead of Sym I introduced Show that defines how different types are encoded in different data stores.

You can see example of using arrays in ArraysExample. Also I think it'll cool to use kind-projector while using this lib in tagless final style. Now it also a little bit dirty with all of this ({type =...})#A things.

rafafrdz commented 1 month ago

Wow! what a PR, let me review ๐Ÿ‘€

mark-kar commented 1 month ago

Wow! what a PR, let me review ๐Ÿ‘€

Well :)) It's not finished yet as you can see but I just wanted to introduce a little bit another approach for encoding

Also such approach allows to encode between expression quite easily, so I think this PR can be also related to https://github.com/rafafrdz/criteria4s/issues/12

mark-kar commented 3 weeks ago

Hi! In general, It's a great job. I really appreciate it. You come with some brilliant changes that I would love include in the code.

  • I did the Sym trait in order to "show" in someway the symbolic expression that the datastore will catch/understand as a correct value/reference/column. But you idea of using Show is more elegant IMO.
  • I like the rename of PredOp to PredicateUnary and PredicateBinary

I asked you some question and some suggestions about some changes that I really would like to know just to understand your reasons. But everything else is really good.

Related to the kind projection expressions, It would be nice to use the kind projection sbt plugin (as I told you in one of the following comments below).

And finally, I would like to rename some old methods and move all yours Predicates traits in a package instead of letting them in the same scala file. But I prefer to merge this PR before ๐Ÿ˜ƒ

BTW: I created a new branch branch-0.8 for these changes. Do you mind to point this PR to that new one?

Thank you๐Ÿ˜‰ I'm happy to know that you liked the way of changing the encoding style :) So yes, I'm going to explain some changes that you pointed at below. And yes, sure, I can push the future changes to the new branch

(Don't pay attention the closing of PR, it's just a misclick๐Ÿ˜„)

And also do you mind if I fix the README.md file in this PR? Because it was conceptual changes here and I'd like to keep lib description fresh

rafafrdz commented 3 weeks ago

And also do you mind if I fix the README.md file in this PR? Because it was conceptual changes here and I'd like to keep lib description fresh

Sure! feel free to change it!

rafafrdz commented 1 week ago

any news? @mark-kar

mark-kar commented 1 week ago

any news? @mark-kar

Hi! =) Just opened a new pull request pointing to branch-0.8 https://github.com/rafafrdz/criteria4s/pull/16 I guess we can just close this PR and continue there

Also I think it's already can be not-draft PR

rafafrdz commented 1 week ago

Close this PR. Instead https://github.com/rafafrdz/criteria4s/pull/16