Replies: 1 comment 3 replies
-
Does it make sense to add a list of fields to reload as an optional part of p.Reload()? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would it be possible/ a good idea to add convenience functions to database models to load/reload a specific field.
For example
type Post { UserID uint Text string }
(an already loaded model)
p := &model.Post{}
....
err := p.LoadText(ctx, db)
I only raise the question as it occurred to me that I can either p.Reload(ctx, db) or run model.Posts(...) for the specific field, but it seems slightly redundant if I'm dealing with an already loaded object.
Beta Was this translation helpful? Give feedback.
All reactions