Skip to content

Short-circuiting, date localization

Latest
Compare
Choose a tag to compare
@Knetic Knetic released this 01 May 02:26
· 39 commits to master since this release

API Breaks

Multiple API breaks occurred between the previous release and this one. They are minor, and most users won't see any impact, but they measurably change the public interface and semantic meaning of some expressions.

Date localization
Previously, literal dates were parsed as UTC dates and always turned into the same value no matter what locale the expression ran. However, this quickly led to confusing situations where users would pass time.Now() (which is localized) as a parameter, compare it against a literal date (which was not localized) and would see results that seemed wrong. For example, on December 31st, 2015, at 9:00pm in Pacific Time, the expression now > '2016-01-01' would evaluate to true.

Per #49 , all literal dates are parsed in the current locale (unless they explicitly include the locale in the date string).

GetTokenKindString removed
Previously, an exported function called GetTokenKindString existed. It has been removed, and is exactly replaced by the String() function, which can be called from any OperatorToken. This makes it more idiomatic, and also matches the convention used elsewhere in the library. See #37

Privatized constants
The library used to expose a lot of constants which weren't useful to users, and were only used internally (mostly for stage planning). Some of them weren't even used at all. These have been privatized or removed. See #38

Features

  • Short-circuiting is now implemented in cases where both sides of an operation don't need to be known in order for the operation to complete. See #36 and #53 .
  • complex and struct types can now be passed as parameters. Before expression functions were available, these types made no sense in an expression. However, they can be perfectly valid now. See #57

Version tags

This entire repo has been re-tagged to match the gopkg.in standard. This means that instead of import "github.com/Knetic/govaluate" (which always pulls master branch), users can now pin to a specific released version by doing import "gopkg.in/Knetic/govaluate.v3" - where v3 is the tag of the major release that you'd like.