Commit Graph

5 Commits

Author SHA1 Message Date
Jean Hadrien Chabran
01c87d1bf7 Handle integer conversion errors (#425)
When converting a double larger or equal to math.MaxInt64 to an integer, it previously overflowed silently. It now returns an explicit error.

This fixes along the way, the math.abs(-9223372036854775808) issue.
2021-07-25 18:25:02 +02:00
Asdine El Hrychy
43a9b3e560 Parse blob literal (#423)
We now have a literal representation for BLOBs. Any string literal starting
with '\x' is parsed as an hex encoded blob. This mimics PostgreSQL's behavior.

```sql
SELECT '\xAAFF';
```
2021-07-23 21:15:29 +04:00
Jean Hadrien Chabran
1659ae24e5 Add more math functions (#421)
* Add math.acos and math.abs

* Add acosh, asin, asinh, atan and atan2

* Test for proper function documentation

* Cast to double on math functions

* Use the new types.Value interface
2021-07-22 15:47:56 +02:00
Asdine El Hrychy
f966172cee Introduce Value interface (#422)
This replaces the Value struct by an interface to allow us to override some
values behavior in the future.
It also introduces a new package types, which contains type definitions, comparison,
and arithmetics.
Concerning encoding, Genji now only uses on type of encoding for values. This simplifies
indexing logic as well as table access in general.
2021-07-21 22:05:44 +04:00
Jean Hadrien Chabran
e556fc3048 Add functions packages support (#419)
* Add packaged functions support

* Add tests for math.floor func

* Export FunctionsTable

* Extract func stuff into its own package

* Rename stuff

* Fix tests

* Move doc package to cmd/genji

* Adjust naming, typos
2021-07-17 13:07:16 +02:00