Skip to content

Conversation

skandragon
Copy link

I have a case where I want to wrap some of the database calls in some internal layers, and would like to have a single params structure that is exposed between my hand-rolled wrapped code and the generated names.

Specifically, I am making a function called UpsertFooUncached using code gen and I want a cached version:

func (q *Queries) UpsertFoo(ctx context.Context, args UpsertFooParams) (uuid.UUID, error) {
  // caching would go here
  id, err := q.UpsertFooUncached(ctx, args)
  if err != nil {
    return uuid.Nil, err
  }
  // cache the result
  return id, nil
}

In this case, I could use type UpsertFooParams UpsertFooUncachedParams but this doesn't work well for users as it doesn't always expand with VSCode, so the internals are a mystery. I could recreate the structure, but then I need to keep it in sync. I could embed the Uncached version, but then using it is a pain.

I'd like to rename, and this change seems to do the trick.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🔧 golang size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Mar 11, 2025
@skandragon
Copy link
Author

Any chance this can be merged, or feedback on what it would take?

@skandragon
Copy link
Author

bump.

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files. 🔧 golang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant