Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for scanning joined assoc #290

Merged
merged 1 commit into from Jun 4, 2022

Conversation

Fs02
Copy link
Member

@Fs02 Fs02 commented Jun 4, 2022

Scan query result to embedded has one or belongs to association when the returned query result have field path to the association (example: "assoc_name.field_name")

example:

var users []Users
err := repo.FindAll(ctx, &users, rel.Select("*", "follower_stats.followers_count").Join("follower_stats").Where(where.Gt("follower_stats.followers_count", 100)))

related: #287

@codecov
Copy link

codecov bot commented Jun 4, 2022

Codecov Report

Merging #290 (8858030) into master (115ffc0) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #290   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           33        33           
  Lines         2778      2802   +24     
=========================================
+ Hits          2778      2802   +24     
Impacted Files Coverage Δ
document.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 115ffc0...8858030. Read the comment docs.

@Fs02 Fs02 merged commit 08e54aa into master Jun 4, 2022
@Fs02 Fs02 deleted the add-support-for-scanning-joined-assoc branch June 4, 2022 02:19
@lafriks
Copy link
Contributor

lafriks commented Jun 8, 2022

how does it distinguish columns with same name but form different tables in select?

@Fs02
Copy link
Member Author

Fs02 commented Jun 9, 2022

@lafriks the field name have to be prefixed with table name, my above example is probably not valid, probably it should be "follower_stats.followers_count" as "follower_stats.followers_count"

@Fs02 Fs02 mentioned this pull request Jun 19, 2022
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.

None yet

2 participants