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

Restrict Relational Operators to the appropriate DML #9

Open
calvinlfer opened this issue Feb 6, 2022 · 2 comments
Open

Restrict Relational Operators to the appropriate DML #9

calvinlfer opened this issue Feb 6, 2022 · 2 comments
Assignees

Comments

@calvinlfer
Copy link
Member

I still need to do some more research on this but it seems like certain relations in WHERE clauses are not allowed for UPDATE vs SELECT statements. Initially, I was thinking of doing it like the following:

final case class Relation[A: Writer, Operator <: RelationOperator](
  columnName: ColumnName,
  operator: Operator,
  value: A
)

sealed trait RelationOperator
object RelationOperator {
  sealed trait DeleteRelationOperator extends RelationOperator
  sealed trait UpdateRelationOperator extends RelationOperator

  case object Equal              extends RelationOperator with UpdateRelationOperator with DeleteRelationOperator
  case object NotEqual           extends RelationOperator with UpdateRelationOperator
  case object GreaterThan        extends RelationOperator with UpdateRelationOperator
  case object GreaterThanOrEqual extends RelationOperator with UpdateRelationOperator
  case object LessThan           extends RelationOperator with UpdateRelationOperator
  case object LessThanOrEqual    extends RelationOperator with UpdateRelationOperator
  case object Like               extends RelationOperator
  case object In                 extends RelationOperator with DeleteRelationOperator
}

Then in the Update query builder, we can restrict inputs to use Relation[ScalaType, UpdateRelationOperator]

@FrancisToth
Copy link
Collaborator

I can help on this.

@calvinlfer
Copy link
Member Author

We'll need to go through the Cassandra documentation and figure out what is possible in certain queries

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

No branches or pull requests

2 participants