-
Notifications
You must be signed in to change notification settings - Fork 801
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
mysql时间字符串(varchar "2018-11-20 10:10:10")支持转为ES的date类型 #305
Open
tiankonghewo
wants to merge
13
commits into
go-mysql-org:master
Choose a base branch
from
tiankonghewo:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7dfd042
Update sync.go
tiankonghewo 7350dff
Update README.md
tiankonghewo c31ee19
Update river.toml
tiankonghewo 99e1dd0
Update sync.go
tiankonghewo d2c9fb4
Update sync.go
tiankonghewo a23070d
Update river.toml
tiankonghewo df184c6
Update sync.go
tiankonghewo 7fd7157
Update sync.go
tiankonghewo 94620e3
Update sync.go
tiankonghewo 1e4a7ab
Update sync.go
tiankonghewo c2db5d7
Update river.toml
tiankonghewo d8f6d36
Update river.toml
tiankonghewo 3086cd2
Update sync.go
tiankonghewo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -514,7 +514,15 @@ func (r *River) getFieldValue(col *schema.TableColumn, fieldType string, value i | |
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: | ||
fieldValue = r.makeReqColumnData(col, time.Unix(v.Int(), 0).Format(mysql.TimeFormat)) | ||
} | ||
} | ||
} else if col.Type == schema.TYPE_STRING { | ||
v := r.makeReqColumnData(col, value) | ||
str, _ := v.(string) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. switch v.(type) {
case string:
case []byte:
default:
} I think you can check string and []byte here. |
||
stamp, _ := time.ParseInLocation(time.RFC3339 , str, time.Local) | ||
t := int64(stamp.Unix()) | ||
col.Type = schema.TYPE_DATETIME | ||
fieldValue = r.makeReqColumnData(col, time.Unix(t, 0).Format(mysql.TimeFormat)) | ||
|
||
} | ||
} | ||
|
||
if fieldValue == nil { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Em, are you sure we can support ES 6 directly? Seem ES 6 has already removed doc Type?