Skip to content

Commit fff4b42

Browse files
committed
fix timestamp type
1 parent 4a31b0d commit fff4b42

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

src/constants/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const (
66
ErrorSliceCreation = "InterfaceSlice() given a non-slice type"
77
ErrorNoColumn = "There is no column %s in %s.%s"
88
ErrorDBConnect = "Can't connect to \"%s\""
9-
ErrorSave = "Can't %s model in \"%s\" data: %v"
9+
ErrorSave = "Can't %s model in \"%s\""
1010
ErrorExecQuery = "Can't exec query. Type: \"%s\" error: \"%v\""
1111
ErrorNoModelFile = "Model file \"%s\" not exists"
1212
ErrorModelFileExists = "Model file \"%s\" already exists"

src/models/slave/model.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,5 @@ func (slave Slave) DeleteAll(header *Header, positionSet func()) {
216216
}
217217

218218
func (slave Slave) logError(operationType string) {
219-
out, _ := json.Marshal(slave)
220-
221-
log.Warnf(constants.ErrorSave, operationType, slave.TableName(), string(out))
219+
log.Warnf(constants.ErrorSave, operationType, slave.TableName())
222220
}

src/parser/parser.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,7 @@ func prepareType(fieldName string, fieldType string, value interface{}, params m
116116
params[fieldName] = float64(0)
117117
}
118118
case "timestamp":
119-
switch value.(type) {
120-
case string:
121-
params[fieldName] = value.(string)
122-
default:
123-
t, _ := time.Parse("2006-01-02 15:04:05", value.(string))
124-
params[fieldName] = t
125-
}
119+
t, _ := time.Parse("2006-01-02 15:04:05", value.(string))
120+
params[fieldName] = t
126121
}
127122
}

0 commit comments

Comments
 (0)