We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 57581d8 commit 2cba851Copy full SHA for 2cba851
orm/query_where.go
@@ -64,7 +64,7 @@ func (q *Query[T]) WherePrimaryIfNotZero(val any) *Query[T] {
64
}
65
66
67
-func (q *Query[T]) WhereFirstFieldIfNotZero(val any) *Query[T] {
+func (q *Query[T]) WhereStructPrimaryIfNotZero(val any) *Query[T] {
68
rval := reflect.ValueOf(val)
69
if rval.IsZero() {
70
return q
@@ -78,6 +78,9 @@ func (q *Query[T]) WhereFirstFieldIfNotZero(val any) *Query[T] {
78
if rval.NumField() == 0 {
79
80
81
+ if rval.Field(0).IsZero() {
82
+ return q
83
+ }
84
return q.WherePrimary(rval.Field(0).Interface())
85
86
0 commit comments