Skip to content

Commit

Permalink
Adding some docs on a few criteria methods. Fixes #1224 (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink authored Sep 13, 2023
1 parent 4ae7177 commit 45cbe62
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/actions/guides/database/querying.cr
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,28 @@ class Guides::Database::Querying < GuideAction
UserQuery.new.name.upper.eq("GAR")
```
### TRIM A = B
Find rows where (trimming blankspace from `A`) is equal to `B`
`SELECT COLUMNS FROM posts WHERE TRIM(posts.title) = 'First Post'`
```crystal
PostQuery.new.title.trim.eq("First Post")
```
### A as DATE = B
Find rows where (casting `A` to a DATE()) is equal to `B`
`SELECT COLUMNS FROM schedules WHERE DATE(schedules.starts_at) = '2017-03-11'`
```crystal
ScheduleQuery.new.starts_at.as_date.eq(Time.utc.to_s("%F"))
```
> The dates are compared with Strings, so a date formatted String object must be passed in.
### A gt/lt B
* gt: >
Expand Down

0 comments on commit 45cbe62

Please sign in to comment.