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

[Good First Issues]: implement function "today" - 4 points #429

Closed
Michaelg22 opened this issue Feb 13, 2023 · 6 comments
Closed

[Good First Issues]: implement function "today" - 4 points #429

Michaelg22 opened this issue Feb 13, 2023 · 6 comments
Labels
good first issue help-wanted Extra attention is needed

Comments

@Michaelg22
Copy link
Contributor

Michaelg22 commented Feb 13, 2023

Motivation

Vanus Functions are a series of pre-built functions worked within Vanus transformer. By choosing a function, users can specify the way that events will be changed.

It will be a good start if you decide to contribute to Vanus codes.

Details

Function name: today

Args

  • targetJsonPath - The name of an existing column.
  • timeZone - Optional. The name of the country and city. If no time zone is specified, then the default is Universal Coordinated Time (UTC).

Description

The function is used to get the current date(format: YYYY-MM-DD) in a specific TimeZone. And assign it to the target JSON path.
The Time Zone will be UTC if users don't specify it.

Example

{
    "specversion" : "1.0",
    "type" : "com.example.someevent",
    "source" : "/mycontext",
    "subject": null,
    "id" : "C234-1234-1234",
    "time" : "2018-04-05T17:31:00Z",
    "comexampleextension1" : "value",
    "comexampleothervalue" : 5,
    "datacontenttype" : "application/json",
    "data" : {
        appinfoA : "Hello world",
       

    }
}

After the function.

"pipeline":[
    {"command":["today","$.data.time", "Europe/Madrid"]}
]

The transformed event should look like this:

{
    "specversion" : "1.0",
    "type" : "com.example.someevent",
    "source" : "/mycontext",
    "subject": null,
    "id" : "C234-1234-1234",
    "time" : "2018-04-05T17:31:00Z",
    "comexampleextension1" : "value",
    "comexampleothervalue" : 5,
    "datacontenttype" : "application/json",
    "data" : {
        appinfoA : "Hello world",
        time : "2023-01-12"

How to implement

  1. Fork the vanus repository.
  2. Create a branch function-today
  3. Create today.go under internal/primitive/transform/action/datatime, and then implement the function.
  4. Create today.go under internal/primitive/transform/action/datatime for unit test.
  5. Register your function in internal/primitive/transform/runtime/init.go.
  6. Submit your PR

Contribution points

Each issue counts specific points based on its difficulty. Contributors earn the corresponding points if they solve that issue. Contribution points are used to describe the contributions contributors have made. They can also be used to get rewards when there are community events.

This issue counts 4 points.

How to claim to solve the issue

If you want to implement this function, please leave a comment in this issue like:

I'd like to implement this function, please assign this issue to me.

Vanus community will assign the issue to you on time.

@Michaelg22 Michaelg22 added help-wanted Extra attention is needed good first issue labels Feb 13, 2023
@Michaelg22 Michaelg22 changed the title [Good First Issues]: implement function "today" - 7 points [Good First Issues]: implement function "today" - 4 points Feb 13, 2023
@thiyagarajan17
Copy link

Could you assign the issue to me.. free to help out

@Michaelg22
Copy link
Contributor Author

Michaelg22 commented Feb 20, 2023

Hi @thiyagarajan17 Join our slack community if you haven't already for better communication

@Michaelg22
Copy link
Contributor Author

How is your progress on developing the function looking forward to your PR

@Michaelg22
Copy link
Contributor Author

Please make sure to make the function in internal/primitive/transform/action/datatime

@Michaelg22
Copy link
Contributor Author

Hello @thiyagarajan17 , I wanted to check in with you regarding the issue you expressed interest in writing a function for. I haven't heard from you in a while, so I was wondering if you're still interested in working on it. Please let me know if you are, otherwise, I will need to assign the task to someone else who is available and willing to work on it.

@Michaelg22
Copy link
Contributor Author

This issue will be closed and was recreated #462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue help-wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants