Skip to content

Conversation

@brandur
Copy link
Contributor

@brandur brandur commented Jan 11, 2026

Here, introduce a new rivershared/structtag package, extracted from
some of the previous implementation of dbunique. We modify the
previous implementation so that it can handle river tag values with
any arbitrary value (previously, only unique worked) so that we can
reuse the implementation or other features.

@brandur brandur force-pushed the brandur-struct-field branch from 5c54adb to dfa9fae Compare January 11, 2026 17:27
@brandur
Copy link
Contributor Author

brandur commented Jan 11, 2026

Renamed this from structfield to structtag. Seems a liittle better maybe.

@brandur brandur changed the title Add shared structfield package for use across features Add shared structtag package for use across features Jan 11, 2026
@brandur brandur requested a review from bgentry January 11, 2026 17:50
Copy link
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, with the caveat that this isn't in rivershared and thus can't be utilized by riverpro.

@brandur brandur force-pushed the brandur-struct-field branch from dfa9fae to cc074fc Compare January 11, 2026 23:00
@brandur
Copy link
Contributor Author

brandur commented Jan 11, 2026

Looks great, with the caveat that this isn't in rivershared and thus can't be utilized by riverpro.

Ah, what the heck. I must've added the folder in the wrong place. My pro changes seem to import the package, but I guess I must've forgotten to run the tests there. Fixed!

@brandur brandur force-pushed the brandur-struct-field branch 2 times, most recently from 68189cd to 338de47 Compare January 11, 2026 23:06

// SortedFieldsWithTag retrieves unique fields with caching to avoid
// extracting fields from the same struct type repeatedly.
func SortedFieldsWithTag(args rivertype.JobArgs, tagValue string) ([]string, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also renamed this from GetSortedTagFieldsCached to SortedFieldsWithTag. Seems a little better for a public API name.

Here, introduce a new `rivershared/structtag` package, extracted from
some of the previous implementation of `dbunique`. We modify the
previous implementation so that it can handle `river` tag values with
any arbitrary value (previously, only `unique` worked) so that we can
reuse the implementation or other features.
@brandur brandur force-pushed the brandur-struct-field branch from 338de47 to ed31354 Compare January 11, 2026 23:09
@brandur
Copy link
Contributor Author

brandur commented Jan 12, 2026

thx! Verified this works with River Pro.

@brandur brandur merged commit 8fba32c into master Jan 12, 2026
14 checks passed
@brandur brandur deleted the brandur-struct-field branch January 12, 2026 02:18
brandur added a commit that referenced this pull request Jan 12, 2026
Contains one small bug fix, but mainly exposes a new `rivershared`
package for common tag extraction logic (see #1120).
@brandur brandur mentioned this pull request Jan 12, 2026
brandur added a commit that referenced this pull request Jan 12, 2026
Contains one small bug fix, but mainly exposes a new `rivershared`
package for common tag extraction logic (see #1120).

[skip ci]
brandur added a commit that referenced this pull request Jan 12, 2026
Contains one small bug fix, but mainly exposes a new `rivershared`
package for common tag extraction logic (see #1120).

[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants