Describe the feature
Being able to add a derived column along with the default ones generated by Model or Dest (and joined tables)
Motivation
In my case, I would like to get a similary score with pgvector, however I would like to get it along with my model and its relationships. Select is erasing the default model querying if you add anything else than * in the function.
here is the original query I wanted to achieve:
articles := []models.AssetArticle{}
db.Select("*, 1 - (embedding <-> ?) AS similarity_score").Model(models.AssetArticle{}).Joins("Publisher").Omit("Embedding", "Log").Find(&articles)
the problem with this one is that Publisher won't be populated by the result.
Failed attempts: - I tried to first use a dry run query and copy the select clause to edit it but it is erased after the query is processed - I tried to write a callback but after digging into the query callback, i discovered that the whole processing is done and the query executed right after, preventing any mutation in the between
I'm happy to make a PR if you imagine a correct implementation of this issue.