Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions default_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ func simpleKeyToFields(idFieldName string) dal.KeyToFieldsFunc {
}
}
// If value is not a pointer, also check a pointer to it (for pointer receiver methods)
if v.Kind() != reflect.Ptr {
if v.Kind() != reflect.Pointer {
pv := reflect.New(v.Type())
if m := pv.MethodByName("SetID"); m.IsValid() {
t := m.Type()
if t.NumIn() == 1 {
return true
}
}
} else if v.Kind() == reflect.Ptr {
} else if v.Kind() == reflect.Pointer {
// Additionally check the element (for value receiver methods)
e := v.Elem()
if e.IsValid() {
Expand All @@ -82,7 +82,7 @@ func simpleKeyToFields(idFieldName string) dal.KeyToFieldsFunc {

// Check for exported field named `idFieldName` on struct or pointer to struct
t := v.Type()
if t.Kind() == reflect.Ptr {
if t.Kind() == reflect.Pointer {
t = t.Elem()
}
if t.Kind() == reflect.Struct {
Expand Down Expand Up @@ -124,7 +124,7 @@ func simpleFieldsToKey(idFieldName string) dal.DataToKeyFunc {
}
}
// If pointer, also check value receiver; if value, also check pointer receiver
if v.Kind() == reflect.Ptr {
if v.Kind() == reflect.Pointer {
e := v.Elem()
if e.IsValid() {
if m := e.MethodByName("GetID"); m.IsValid() {
Expand Down Expand Up @@ -159,7 +159,7 @@ func simpleFieldsToKey(idFieldName string) dal.DataToKeyFunc {
}
// Dereference pointer if needed
vt := v.Type()
if vt.Kind() == reflect.Ptr {
if vt.Kind() == reflect.Pointer {
v = v.Elem()
vt = v.Type()
}
Expand Down
2 changes: 1 addition & 1 deletion getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func getSelectFields(includePK bool, options DbOptions, records ...dal.Record) (
}
val := reflect.ValueOf(data)
kind := val.Kind()
if kind == reflect.Ptr || kind == reflect.Interface {
if kind == reflect.Pointer || kind == reflect.Interface {
val = val.Elem()
} // TODO: throw panic

Expand Down
2 changes: 1 addition & 1 deletion reader_recordset.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func getRecordsetReader(ctx context.Context, query dal.Query, execute executeQue
case reflect.Interface:
// Assume it's a nullable []byte/blob if it's an interface (common for some drivers/sqlmock)
c = recordset.UntypedCol(recordset.NewTypedColumn[[]byte](name, nil, dbType))
case reflect.Ptr:
case reflect.Pointer:
elem := scanType.Elem()
switch elem.Kind() {
case reflect.Uint8:
Expand Down
2 changes: 1 addition & 1 deletion sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func buildSingleRecordQuery(o operation, options DbOptions, record dal.Record) (
record.SetError(nil)
data := record.Data()
val := reflect.ValueOf(data)
if kind := val.Kind(); kind == reflect.Interface || kind == reflect.Ptr {
if kind := val.Kind(); kind == reflect.Interface || kind == reflect.Pointer {
val = val.Elem()
}
valType := val.Type()
Expand Down