fix out of range error
This commit is contained in:
parent
f5ac40e395
commit
8492af206f
@ -122,7 +122,7 @@ func (p *processor) Execute(db *DB) *DB {
|
|||||||
stmt.ReflectValue = stmt.ReflectValue.Elem()
|
stmt.ReflectValue = stmt.ReflectValue.Elem()
|
||||||
}
|
}
|
||||||
if (stmt.ReflectValue.Kind() == reflect.Slice || stmt.ReflectValue.Kind() == reflect.Array) &&
|
if (stmt.ReflectValue.Kind() == reflect.Slice || stmt.ReflectValue.Kind() == reflect.Array) &&
|
||||||
(stmt.ReflectValue.Len() > 0 || stmt.ReflectValue.Index(0).Kind() == reflect.Interface) {
|
(stmt.ReflectValue.Len() > 0 && stmt.ReflectValue.Index(0).Kind() == reflect.Interface) {
|
||||||
len := stmt.ReflectValue.Len()
|
len := stmt.ReflectValue.Len()
|
||||||
firstElem := stmt.ReflectValue.Index(0)
|
firstElem := stmt.ReflectValue.Index(0)
|
||||||
for firstElem.Kind() == reflect.Interface || firstElem.Kind() == reflect.Ptr {
|
for firstElem.Kind() == reflect.Interface || firstElem.Kind() == reflect.Ptr {
|
||||||
@ -140,7 +140,6 @@ func (p *processor) Execute(db *DB) *DB {
|
|||||||
structArrayReflectValue = reflect.Append(structArrayReflectValue, elem)
|
structArrayReflectValue = reflect.Append(structArrayReflectValue, elem)
|
||||||
}
|
}
|
||||||
stmt.ReflectValue = structArrayReflectValue
|
stmt.ReflectValue = structArrayReflectValue
|
||||||
fmt.Println(stmt.ReflectValue.Type())
|
|
||||||
}
|
}
|
||||||
if !stmt.ReflectValue.IsValid() {
|
if !stmt.ReflectValue.IsValid() {
|
||||||
db.AddError(ErrInvalidValue)
|
db.AddError(ErrInvalidValue)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user