Skip to content

Commit 6435310

Browse files
committed
Ignore fields not found in the table
1 parent 2a7ee65 commit 6435310

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

oracle/common.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
"database/sql/driver"
4545
"encoding/json"
4646
"reflect"
47+
"slices"
4748
"strings"
4849
"time"
4950

@@ -707,8 +708,10 @@ func isZeroFor(t reflect.Type, v interface{}) bool {
707708
func filterFields(s *schema.Schema, predicate func(f *schema.Field) bool) []string {
708709
var fields []string
709710
for _, f := range s.Fields {
710-
if predicate(f) {
711-
fields = append(fields, f.DBName)
711+
if slices.Contains(s.DBNames, f.DBName) {
712+
if predicate(f) {
713+
fields = append(fields, f.DBName)
714+
}
712715
}
713716
}
714717
return fields

0 commit comments

Comments
 (0)