13992b0526
Ignoring fields with struct tag expr:"-" and make "in" return false for unexported fields ( #806 )
...
* allow ignoring struct member using a - in expr struct tag
* fix in operator
* simplify logic
* add regression test for #807
* fixes #807 : make in operator return false for unexported struct fields
---------
Co-authored-by: Anton Medvedev <[email protected] >
2025-06-30 20:14:08 +02:00
2pac and GitHub
9e10dcd6b4
fix(785): get to work when return is nil ( #786 )
...
* fix(785): `get` to work when return is `nil`
* improve testing
2025-05-12 18:32:48 +02:00
Anton Medvedev and GitHub
452d355706
Make expr.Eval faster ( #775 )
...
* Make expr.Eval faster
* Add bench_call_test.go
* Make parser config optional
2025-03-24 14:48:41 +01:00
Anton Medvedev
31f0ab00dc
Remove duplicated dereferences
2025-03-10 13:52:54 +01:00
Anton Medvedev
6022ffd21d
Add support deref in all builtins
2025-03-10 13:38:02 +01:00
Anton Medvedev
82ec7571df
Correctly add OpDeref if needed
...
Fixes #739
2025-03-09 13:07:38 +01:00
Anton Medvedev
80eb95bf5f
Make sure get() returns nil for map[string]string on missing keys
...
Fixes #723
2025-03-08 17:28:39 +01:00
Anton Medvedev
3fc6c1f535
Make all builtins working with deref
...
Fixes #730
2025-03-08 17:01:31 +01:00
Anton Medvedev
8cab964afb
Improve type checker for named types
2025-03-08 15:33:37 +01:00
Anton Medvedev
454f913c95
Make len() return runes count for string
...
Fixes #746
2025-03-07 16:58:35 +01:00
OlgaNovg and GitHub
a99736f447
Add uniq() function ( #705 )
2024-09-04 16:59:48 +02:00
OlgaNovg and GitHub
95c433cd06
Add flatten builtin ( #684 )
2024-07-15 11:19:33 +02:00
Anton Medvedev and GitHub
fee5690347
Refactor checker to use Nature ( #665 )
...
This PR introduces a new concept inside Expr's type checker - Nature.
It's an abstraction other reflect.Type which carries additional information about possible type, methods and builtin function.
I was able to find and fix a few bugs in type checker and optimizer. Implementation of nature concept has proven itself. As well nature will allow to bring more feature for type checker in future.
Why Nature? I was looking for a name to replace Type. Type name already carries much information, as well can be confused with reflect.Type. Nature name should be understood as "nature of the node", same as "type of the node".
2024-06-01 00:09:22 +02:00
Anton Medvedev
7af1ec6a15
Improve now() and date() validation
2024-05-08 22:27:02 +02:00
Anton Medvedev
77e80fe655
Remove implicit date's timezone set on parse
2024-05-08 10:04:54 +02:00
Anton Medvedev and GitHub
68e3148c1f
Vendor testify ( #642 )
2024-05-08 00:24:35 +02:00
Anton Medvedev
c6cd675d6b
Add default timezone option expr.Timezone()
2024-05-07 23:19:39 +02:00
Anton Medvedev
1659126046
Add timezone() builtin
2024-05-07 21:36:22 +02:00
Christian G. Warden and GitHub
cb48887b9f
Preserve The Specified Timezone In Parse ( #633 )
...
* Preserve The Specified Timezone In Parse
When parsing a string into a Time using the optional timezone
parameter, set the location of the Time to the timezone's location so
that Format uses that timezone.
* Add More Tests for Preserving Timezone
Add test when timezone is used to parse a date-time.
Add test when timezone is irrelevant because it's a date.
2024-04-24 14:08:49 +02:00
Anton Medvedev and GitHub
772eaba1ca
Add predicate to sum() builtin ( #592 )
...
* Add predicate to sum() builtin
* go mod tidy
2024-04-13 15:37:02 +02:00
Sergey and GitHub
3f12ea7559
builtin int unwraps underlying int value ( #611 )
2024-03-20 20:06:04 +01:00
Ganesan Karuppasamy and GitHub
20d784fe9b
Enable Support for Arrays in Sum, Mean, and Median Functions ( #580 )
2024-03-03 16:44:32 +01:00
Ganesan Karuppasamy and GitHub
2f8f25a68d
Enhanced min and max built-in functions to Support Arrays of Integers and Floats ( #576 )
...
* Enhanced min and max built-in functions to Support Arrays of Integers and Floats
* Enhanced min and max built-in functions to Support Arrays of Integers and Floats
2024-02-24 21:12:51 +01:00
Anton Medvedev and GitHub
0d43107999
Add concat() builtin ( #565 )
...
* Add concat() builtin
* Use pkg deref in builtin
* Use pkg deref in checker
* Use pkg deref in types_table.go
* Use pkg deref in docgen.go
* Use pkg deref in vm
2024-02-16 22:32:35 +01:00
Anton Medvedev and GitHub
b1e82de54a
Refactor groupBy and sortBy ( #562 )
...
* Rearrange opcodes
* Refactor groupBy
* Fix tests
* Super opcodes for GroupBy
* Refactor sortBy builtin
* Fix sortBy bench
2024-02-15 19:53:35 +01:00
Anton Medvedev
fdae534aa9
Add OpCallSafe
2024-02-12 22:15:17 +01:00
Anton Medvedev
5e6f8ebb30
Move bitFunc to utils.go
2024-02-11 22:49:25 +01:00
Anton Medvedev
db8de638f6
Code style
2024-02-11 22:48:38 +01:00
Yuriy Panarin and GitHub
8ec7fe3be8
code(builtin) - add reverse function ( #553 )
...
* code(builtin) - add reverse function
* docs(language-definition.md) - add reverse function
2024-02-11 22:21:49 +01:00
Anton Medvedev
d645265cd1
Fix pipeline and call parsing
2024-01-24 23:49:57 +01:00
Anton Medvedev and GitHub
6c60616e35
Fix context patcher ( #526 )
2024-01-14 17:27:22 +01:00
Anton Medvedev and GitHub
e7b1a64b58
Allow to override builtins ( #522 )
...
* Allow to override builtins
* Add :: syntax to access builtin in case of override
2024-01-13 15:56:49 +01:00
Anton Medvedev
9352898016
Simplify abs
2024-01-12 22:03:10 +01:00
Anton Medvedev and GitHub
d903980830
Add mem grow to builtin ( #505 )
...
* Add mem grow to builtin
* Add OpValidateArgs opcode
2023-12-30 12:49:43 +01:00
Anton Medvedev
1dca2cbdc2
Move ast.Function to builtin.Function
2023-12-29 21:04:25 +01:00
Anton Medvedev
092c84aab1
Rename func.go to lib.go
2023-12-29 21:00:43 +01:00
a0db9a6c19
feat: Implement Bitwise and Shift Operator Support ( #496 )
...
Co-authored-by: Ganesan Karuppasamy <[email protected] >
2023-12-25 18:25:26 +01:00
Anton Medvedev
551d2a7e0f
Use expr-lang/expr
2023-12-03 21:53:01 +01:00
Anton Medvedev
b842f902b4
Add ceil(), floor() and round() function
...
Fixes #476
2023-11-24 17:26:54 +01:00
Anton Medvedev
86ce3b78ca
Add support for float in sort() builtin
...
Fixes #448
2023-11-16 16:29:52 +01:00
Anton Medvedev
6d8d2390cf
Remove countBy
2023-08-30 14:55:05 +02:00
Anton Medvedev
714dd08022
Add mean() and median()
2023-08-30 14:31:40 +02:00
Anton Medvedev
5023b3005d
Add reduce()
2023-08-30 13:33:16 +02:00
Anton Medvedev
66706467ba
Add take()
2023-08-30 12:54:13 +02:00
Anton Medvedev
7d18813005
Add toPairs() and fromPairs()
2023-08-30 12:47:22 +02:00
Anton Medvedev
cea6c64ab2
Move tests to builtin_test.go
2023-08-30 12:11:57 +02:00
Anton Medvedev
7f85c0551f
Add countBy()
2023-08-30 12:07:16 +02:00
Anton Medvedev
32f5fde2eb
Replace interface{} with any
2023-08-30 11:25:15 +02:00
Anton Medvedev
3f57b885d4
Add groupBy
2023-08-30 11:14:54 +02:00
Anton Medvedev
9a9cab2e4a
Add sort builtin
2023-08-28 14:55:44 +02:00