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

Predicates Support #11

Closed
flycash opened this issue Sep 20, 2021 · 3 comments
Closed

Predicates Support #11

flycash opened this issue Sep 20, 2021 · 3 comments
Labels
Milestone

Comments

@flycash
Copy link
Contributor

flycash commented Sep 20, 2021

English Only

Please check existing issues first to avoid duplication and answer the questions below before submitting your issue.

Use case(s)

(Please state use cases, what problem will this feature solve?)

Predicates are used to filter rows. Predicate can be used in WHERE clause.

Proposed Solution

(Please describe your proposed design/solution, if any)
Here are the major APIs and you can find them in predicate.go:

// P creates a Predicate
// left could be string or Expr
func P(left interface{}) Predicate {
	panic("implement me")
}

// Not indicates "NOT"
func Not(p Predicate) Predicate {
	panic("implement me")
}

// And indicates "AND"
func (p Predicate) And(pred Predicate) Predicate {
	panic("implement me")
}

// Or indicates "OR"
func (p Predicate) Or(pred Predicate) Predicate {
	panic("implement me")
}

// EQ =
func (p Predicate) EQ(val interface{}) Predicate {
	panic("implement")
}

// LT <
func (p Predicate) LT(val interface{}) Predicate {
	panic("implement me")
}

// GT >
func (p Predicate) GT(val interface{}) Predicate {
	panic("implement me")
}

But the most important things is to convert the predicates to string. For example:

P("id").LT(10)// `id` < 10

Alternatives Considered

(Other possible options for solving the problem?)

Additional Context

It relies on #10

(Paste any relevant logs - please use code blocks (```) to format console output,
logs, and code as it's very hard to read otherwise.)

(If you can, link to the line of code that might be helpful to explain the context)

@flycash flycash mentioned this issue Sep 20, 2021
@flycash flycash added this to the 0.0.1 - CURD milestone Sep 21, 2021
This was referenced Sep 21, 2021
@flycash
Copy link
Contributor Author

flycash commented Sep 23, 2021

For this issue, we don't need to support complicate expression, we just support simple comparison.

@xingjigongsi
Copy link
Collaborator

ok,I will complete this method

@github-actions
Copy link

This issue is inactive for a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants