Skip to content

Opt-in struct field persistence #284

@Deiz

Description

@Deiz

👋 I have a few wants I'll likely be implementing in the coming days and would be curious as to whether you'd accept them upstream. Generally, these are centred around using goqu in an opt-in, rather than opt-out manner: I only want goqu to concern itself with explicitly-tagged fields.

Currently, only the db:"-" struct tag can be used to avoid including a field in the select column set. There are no magic values like "-" from the columnRenameFunction that can be used to control this, either.

I'm planning to add one (or both?) of these:

  1. Likely a global goqu.IgnoreUntaggedFields() or similar that skips fields during Select() etc. that don't have a tag set
  2. Some flavour of goqu.SetExtendedColumnRenameFunction(func(field *reflect.StructField) (colname string, ok bool)) where, if ok == false, the field is ignored during Select() and others - with the side benefit of exposing the raw *reflect.StructField to the rename function.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions