Skip to content

support TYPE_DATETIME to es date (RFC3339 UTC) #143

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

Merged
merged 6 commits into from
Oct 2, 2017
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions river/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ func (r *River) makeReqColumnData(col *schema.TableColumn, value interface{}) in
if err == nil && f != nil {
return f
}
case schema.TYPE_DATETIME:
switch v := value.(type) {
case string:
vt, _ := time.Parse("2006-01-02 15:04:05", string(v))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem you can use mysql.TimeFormat directly.

timezone := time.Now().Local().Format("-0700")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why -0700 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks :-)

return vt.Format("2006-01-02T15:04:05") + timezone
}
}

return value
Expand Down