Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare time.Time #131

Closed
k2tzumi opened this issue Sep 1, 2022 · 3 comments
Closed

Compare time.Time #131

k2tzumi opened this issue Sep 1, 2022 · 3 comments

Comments

@k2tzumi
Copy link
Collaborator

k2tzumi commented Sep 1, 2022

Proposal

time.Time object can now be handled by the following PR
#129

I want to define a built-in function for comparison.

  • After
  • Before
  • Equal
    May not be necessary as it can be replaced by Compare

Things to consider

  • Should it be a generic comparison function that is supposed to handle objects other than the time.Time object?
  • Is it possible to call a function of struct with antonmedv/expr?
    For example
    current.rows[0].created_at.After(current.rows[0].updated_at)
    The above syntax does not evaluate correctly, but we think it would be best if we could address this by revising the syntax.
@k1LoW
Copy link
Owner

k1LoW commented Sep 1, 2022

Is it possible to call a function of struct with antonmedv/expr?

Maybe, yes.

https://github.com/antonmedv/expr/blob/master/docs/Language-Definition.md#functions-and-methods

@k1LoW
Copy link
Owner

k1LoW commented Sep 2, 2022

How about having a cast function called time() that returns a time.Time type?

Can also be compared with other than DB Runner return values (Only DB Runner return value returns time.Time type).

@k1LoW
Copy link
Owner

k1LoW commented Sep 7, 2022

time() has been added to the built-in functions so that time.Time{} can be compared ⏲️

@k1LoW k1LoW closed this as completed Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants