You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Except for Create, all other generics APIs are using T rather than *T. Does this mean it is recommend to use struct value type and pointer type (like the doc https://gorm.io/docs/the_generics_way.html)?
Take(context.Context) (T, error)
Find(ctx context.Context) ([]T, error)
Updates(ctx context.Context, t T) (rowsAffected int, err error)
Create(ctx context.Context, r *T) error
Asking it in the opposite way, is it still a valid choice to use pointer like:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Except for
Create
, all other generics APIs are usingT
rather than*T
. Does this mean it is recommend to use struct value type and pointer type (like the doc https://gorm.io/docs/the_generics_way.html)?Asking it in the opposite way, is it still a valid choice to use pointer like:
In many cases, a slice of pointers is preferred than a slice of values.
Beta Was this translation helpful? Give feedback.
All reactions