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

Branch 0.8 #16

Merged
merged 6 commits into from
May 11, 2024
Merged

Branch 0.8 #16

merged 6 commits into from
May 11, 2024

Conversation

mark-kar
Copy link
Collaborator

@mark-kar mark-kar commented May 8, 2024

No description provided.

@mark-kar mark-kar mentioned this pull request May 8, 2024
BinPredOp := EQ | NEQ | GT | LT | GEQ | LEQ
RefColOp := IN | NOTIN
RefRangeOp := BETWEEN | NOTBETWEEN
RegexOp := LIKE
```
Copy link
Collaborator Author

@mark-kar mark-kar May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I tried to fix this Backus–Naur form in order to describe actual form of criteria
But now it looks a little bit complicated and actually I think it should be (just look at the formal expressions of postgresql commands😁)

In my opinion, we could exclude this theoretical part from README and add more practical examples below🙂

What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeaa.. well, actually it isn't necessary to be a perfect Bakus-Naur form at the moment. It could be just tentative following a pseudo-bn form.

I was thinking in something like that:

Criteria    :=  Conjuction Criteria Criteria | Predicate | Value<Boolean>
Predicate   :=  UnaryPred Ref | BinaryPred Ref Ref
Ref         :=  Value<T> | Col
Conjuction  :=  AND | OR
UnaryPred   :=  IS_NULL | IS_NOT_NULL ...
BinaryPred  :=  EQ | NEQ | GT | LT | GEQ | LEQ | IN | LIKE ...

We can iterate over this in the future. I don't mind to exclude it from README, but I would like to persist it in somewhere just to keep in mind or at least pointing the PostgreSQL expression reference.

Something like "Following the formal definition of blabla..." 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I get it, then I'll make it as you say :)

Copy link
Collaborator

@rafafrdz rafafrdz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, great job! :) I really love

I put again some questions that I asked you in the older PR that I would like to know and to really understand. The rest of suggestion that I wrote you are perfect now.

trait Collection[D <: CriteriaTag, +V] extends Ref[D, Seq[V]]
trait Col[D <: CriteriaTag] extends Ref[D, Column]
trait Bool[D <: CriteriaTag] extends Value[D, Boolean] with Criteria[D]
trait Range[D <: CriteriaTag, +V] extends Ref[D, (V, V)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I copy-paste the question written in the older PR:

I have a question just to really understand the reason. Why did yo switch the position of the Value type constructors? Was it just for aesthetics? in order to fix the same position the same constructor (always the D on the left and the rest on the right? or was it because of some Variance/Covariance position reason?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, it was just for aesthetics, but I think covariance is redundant here, I'll fix it (don't remember why did i do it🤔)

}

class Column(val colName: String) extends AnyVal
Copy link
Collaborator

@rafafrdz rafafrdz May 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(The same copy-paste question)

Here just a question, why do not define Column as another trait? Will it be used for something else apart of typing the column expressions? Will the colName parameter be uses for something particular? And if it will, Why didn't you define it as a case class? I mean, it's just to know your point of view 😉

Suggested change
class Column(val colName: String) extends AnyVal
trait Column

or

Suggested change
class Column(val colName: String) extends AnyVal
case class Column(colName: String) extends AnyVal

Copy link
Collaborator Author

@mark-kar mark-kar May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the idea to use trait here as it should be just a new type of string to use implicits for it

I guess the second variant you suggest is the best choice here

build.sbt Outdated
@@ -28,3 +30,4 @@ lazy val examples: Project =
name := "criteria4s-examples"
)
.dependsOn(core, sql)
.withKindProjector
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a blank line please :)

BinPredOp := EQ | NEQ | GT | LT | GEQ | LEQ
RefColOp := IN | NOTIN
RefRangeOp := BETWEEN | NOTBETWEEN
RegexOp := LIKE
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeaa.. well, actually it isn't necessary to be a perfect Bakus-Naur form at the moment. It could be just tentative following a pseudo-bn form.

I was thinking in something like that:

Criteria    :=  Conjuction Criteria Criteria | Predicate | Value<Boolean>
Predicate   :=  UnaryPred Ref | BinaryPred Ref Ref
Ref         :=  Value<T> | Col
Conjuction  :=  AND | OR
UnaryPred   :=  IS_NULL | IS_NOT_NULL ...
BinaryPred  :=  EQ | NEQ | GT | LT | GEQ | LEQ | IN | LIKE ...

We can iterate over this in the future. I don't mind to exclude it from README, but I would like to persist it in somewhere just to keep in mind or at least pointing the PostgreSQL expression reference.

Something like "Following the formal definition of blabla..." 😅

Copy link
Collaborator

@rafafrdz rafafrdz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@rafafrdz rafafrdz merged commit 9fc2f65 into eff3ct0:branch-0.8 May 11, 2024
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

Successfully merging this pull request may close these issues.

2 participants