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

mysql时间字符串(varchar "2018-11-20 10:10:10")支持转为ES的date类型 #305

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

tiankonghewo
Copy link

No description provided.

@@ -203,7 +203,7 @@ Although there are some other MySQL rivers for Elasticsearch, like [elasticsearc
## Todo

+ MySQL 8
+ ES 6
+ ES 6 (After verification (version 6.4.2), it is now supported. Delete and update are supported)
Copy link
Collaborator

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?

if col.Type == schema.TYPE_STRING {
col.Type = schema.TYPE_DATETIME
v := r.makeReqColumnData(col, value)
str, _ := v.(string)
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.

river/sync.go Outdated
@@ -514,6 +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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

please use else if col.Type == schema.TYPE_STRING

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

Successfully merging this pull request may close these issues.

2 participants