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

[ADP-2565] Implement SQL expressions for WHERE clauses #4696

Merged
merged 5 commits into from
Jul 24, 2024

Conversation

HeinrichApfelmus
Copy link
Contributor

@HeinrichApfelmus HeinrichApfelmus commented Jul 23, 2024

This pull request

  • Implements facilities for working with variables: a type VarName, a type Bindings, and a Lets monad.
  • Implements a type Expr a that represents expression in the SQL language. Specifically, Expr Bool can be used in a WHERE clause.
  • Implements a function selectWhere that works with the Table type and computes a SELECT … WHERE clause.
  • Implements a function deleteWhere that works with the Table type

Comments

  • I have skipped extensive property testing for now, as I want to stabilize the API first. The module Demo.Database provides a basic functionality check.

Issue Number

ADP-2565

@HeinrichApfelmus HeinrichApfelmus self-assigned this Jul 23, 2024
@HeinrichApfelmus HeinrichApfelmus force-pushed the HeinrichApfelmus/ADP-2565/sql-expr-where branch 2 times, most recently from e1c15ad to 04310ba Compare July 23, 2024 15:18
@HeinrichApfelmus HeinrichApfelmus changed the title [ADP-2565] Implement SQL expressions and selectWhere [ADP-2565] Implement SQL expressions for WHERE clauses Jul 23, 2024
Copy link
Member

@Anviking Anviking left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines 202 to 207
text :: Text -> Var.Lets Text
text = pure

-- | Render a variable name
var :: Var.VarName -> Var.Lets Text
var = pure
Copy link
Member

Choose a reason for hiding this comment

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

Worth making VarName a newtype to distinguish var from text?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤔 Yes. Making the type VarName abstract is a good idea, because the only sensible way to create variable names should be newVarName anyway.

@HeinrichApfelmus HeinrichApfelmus force-pushed the HeinrichApfelmus/ADP-2565/sql-expr-where branch from 04310ba to 8e40026 Compare July 24, 2024 10:19
@HeinrichApfelmus HeinrichApfelmus force-pushed the HeinrichApfelmus/ADP-2565/sql-expr-where branch from 8e40026 to 2e5deca Compare July 24, 2024 10:22
@HeinrichApfelmus HeinrichApfelmus added this pull request to the merge queue Jul 24, 2024
Merged via the queue into master with commit eeb4322 Jul 24, 2024
23 checks passed
@HeinrichApfelmus HeinrichApfelmus deleted the HeinrichApfelmus/ADP-2565/sql-expr-where branch July 24, 2024 11:37
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