Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Commit

Permalink
add greatest and least
Browse files Browse the repository at this point in the history
typo fix

Signed-off-by: Juanjo Alvarez <juanjo@sourced.tech>
  • Loading branch information
Juanjo Alvarez committed May 6, 2019
1 parent bb8122d commit 9c0402d
Show file tree
Hide file tree
Showing 6 changed files with 574 additions and 22 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ We support and actively test against certain third-party clients to ensure compa
|`DAYOFYEAR(date)`|Returns the day of the year of the given date.|
|`FLOOR(number)`|Return the largest integer value that is less than or equal to `number`.|
|`FROM_BASE64(str)`|Decodes the base64-encoded string str.|
|`GREATEST(...)`|Returns the greatest numeric or string value.|
|`HOUR(date)`|Returns the hours of the given date.|
|`IFNULL(expr1, expr2)`|If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.|
|`IS_BINARY(blob)`|Returns whether a BLOB is a binary file or not.|
|`JSON_EXTRACT(json_doc, path, ...)`|Extracts data from a json document using json paths.|
|`LEAST(...)`|Returns the smaller numeric or string value.|
|`LN(X)`|Return the natural logarithm of X.|
|`LOG(X), LOG(B, X)`|If called with one parameter, this function returns the natural logarithm of X. If called with two parameters, this function returns the logarithm of X to the base B. If X is less than or equal to 0, or if B is less than or equal to 1, then NULL is returned.|
|`LOG10(X)`|Returns the base-10 logarithm of X.|
Expand Down
46 changes: 24 additions & 22 deletions SUPPORTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,48 +85,50 @@

## Functions
- ARRAY_LENGTH
- CEIL
- CEILING
- COALESCE
- CONCAT
- CONCAT_WS
- CONNECTION_ID
- DATABASE
- FLOOR
- FROM_BASE64
- GREATEST
- IS_BINARY
- SPLIT
- SUBSTRING
- IS_BINARY
- LOWER
- UPPER
- CEILING
- CEIL
- FLOOR
- ROUND
- COALESCE
- CONNECTION_ID
- SOUNDEX
- JSON_EXTRACT
- DATABASE
- SQRT
- LEAST
- LN
- LOG10
- LOG2
- LOWER
- LPAD
- POW
- POWER
- ROUND
- RPAD
- LPAD
- LN
- LOG2
- LOG10
- SLEEP
- SOUNDEX
- SPLIT
- SQRT
- SUBSTRING
- TO_BASE64
- FROM_BASE64
- UPPER

## Time functions
- DATE
- DATE_ADD
- DATE_SUB
- DAY
- WEEKDAY
- DAYOFMONTH
- DAYOFWEEK
- DAYOFYEAR
- HOUR
- MINUTE
- MONTH
- NOW
- SECOND
- WEEKDAY
- YEAR
- YEARWEEK
- NOW
- DATE_ADD
- DATE_SUB
8 changes: 8 additions & 0 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,14 @@ var queries = []struct {
"SELECT DATE_ADD('9999-12-31 23:59:59', INTERVAL 1 DAY)",
[]sql.Row{{nil}},
},
{
`SELECT GREATEST(1, 2, 3, 4)`,
[]sql.Row{{int64(4)}},
},
{
`SELECT LEAST(1, 2, 3, 4)`,
[]sql.Row{{int64(1)}},
},
}

func TestQueries(t *testing.T) {
Expand Down
Loading

0 comments on commit 9c0402d

Please sign in to comment.