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

Add method of extraction condition in SqlEntityQuery #152

Closed
shout-star opened this issue Feb 1, 2019 · 1 comment
Closed

Add method of extraction condition in SqlEntityQuery #152

shout-star opened this issue Feb 1, 2019 · 1 comment
Assignees
Milestone

Comments

@shout-star
Copy link
Contributor

Since SqlEntityQuery only supports equality of extraction conditions, why not add the following support?

method generated sql comment
paramNotEqual("col", "value") col != 'value' or col <> 'value' Do you support both operators?
paramIn("col", "val1", "val2") paramInList("col", List.of("val1", "val2") col in ('val1', 'val2') Is the method overloaded?
paramLike("col", "%val%") col like '%val%' Do you want '%' to autocomplete?
paramBetween("col", 1, 2) col between 1 and 2
paramIsNull("col") col is null
paramIsNotNull("col") col is not null
paramGreaterThan("col", 1) col > 1
paramLessThan("col", 1) col < 1
paramGreaterEqual("col", 1) col >= 1
paramLessEqual("col", 1) col <= 1
paramRaw("col = 1 or col = 2") (col = 1 or col = 2)
orderByAsc("col1", "col2") order by col1, col2 asc Do you support null first?
orderByDesc("col1", "col2") order by col1, cols desc
offset(10) offset 10
limit(10) limit 10
HidekiSugimoto189 added a commit that referenced this issue Feb 11, 2019
refs #152
limit and offset method is not implemented.
shout-star pushed a commit that referenced this issue Feb 18, 2019
* Work In Progress.
refs #152
limit and offset method is not implemented.

* - fix change request.
- add limit and offset api
- refactoring

* - fix change request.
- add limit and offset api
- refactoring

* fix review

* fix review

* fix javadoc comment
@HidekiSugimoto189
Copy link
Contributor

The following extraction conditions are supported.

method generated sql comment
equal("col", "value") col = 'value'
notEqual("col", "value") col != 'value'
greaterThan("col", 1) col > 1
lessThan("col", 1) col < 1
greaterEqual("col", 1) col >= 1
lessThan("col", 1) col <= 1
in("col", "val1", "val2") col in ('val1', 'val2')
in("col", List.of("val1", "val2")) col in ('val1', 'val2')
notIn("col", "val1", "val2") col not in ('val1', 'val2')
notIn("col", List.of("val1", "val2")) col not in ('val1', 'val2')
like("col", "%val%") like '%val%' "%val%" does not escape
startsWith("col", "val") like 'val%' "val" does escape
endsWith("col", "val") like '%val' "val" does escape
contains("col", "val") like '%val%' "val" does escape
notLike("col", "%val%") not like '%val%' "%val%" does not escape
notStartsWith("col", "val") not like 'val%' "val" does escape
notEndsWith("col", "val") not like '%val' "val" does escape
notContains("col", "val") not like '%val%' "val" does escape
between("col", 1, 2) col between 1 and 2
isNull("col") col is null
isNotNull("col") col is not null
where("col = 1 or col = 2") (col = 1 or col = 2) If specified with more than one or other extraction conditions, it is combined with an AND operator
asc("col1", "col2") order by col1 asc, col2 asc Specify NULLS LAST if NULLS is available
asc("col1", Nulls.FIRST) order by col1 asc NULLS FIRST When specified more than once, they are arranged in call order
desc("col1", "col2") order by col1 desc, col2 desc Specify NULLS LAST if NULLS is available
desc("col1", Nulls.FIRST) order by col1 desc NULLS FIRST When specified more than once, they are arranged in call order
limit(10) LIMIT 10 Throw UroborosqlRuntimeException if the limit database can not be used. The sentence to be output is switched depending on the dialect of the database.
offset(10) OFFSET 10 Throw UroborosqlRuntimeException if the offset database can not be used. The sentence to be output is switched depending on the dialect of the database.

@HidekiSugimoto189 HidekiSugimoto189 added this to the v0.11.0 milestone Mar 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants