Skip to content

abstracted out gamer activity repo sql queries using sqlc#41

Merged
Woe4 merged 1 commit intomainfrom
gamer-activity-sqlc
Mar 4, 2026
Merged

abstracted out gamer activity repo sql queries using sqlc#41
Woe4 merged 1 commit intomainfrom
gamer-activity-sqlc

Conversation

@Woe4
Copy link
Contributor

@Woe4 Woe4 commented Mar 3, 2026

Migrating gamer_activity like #37

@Woe4
Copy link
Contributor Author

Woe4 commented Mar 3, 2026

My one concern is that the per activity error handling has been lost

@joshhwuu
Copy link
Contributor

joshhwuu commented Mar 3, 2026

My one concern is that the per activity error handling has been lost

why did we lose this?

return nil, fmt.Errorf("failed to scan activity: %w", err)
}
activities = append(activities, activity)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@Woe4 do you mean that we lost the error handling here? I don't think we did? In the old version we had to scan every row since we were getting a SQL result from go and had to put it into the models ourselves. If you look in the sqlc files that were generated, it does that for loop scan check for us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see that sqlc does check row by row. I guess I was concerned with how the error is returned (different error messages) but letting sqlc handle the different errors and returning the errors in row, err := queries.(Get...) makes more sense than having three different error checks.

Copy link
Contributor

@Jaden51 Jaden51 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@joshhwuu joshhwuu left a comment

Choose a reason for hiding this comment

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

🚢

@Woe4 Woe4 merged commit 789baa4 into main Mar 4, 2026
3 checks passed
@Woe4 Woe4 deleted the gamer-activity-sqlc branch March 4, 2026 23:43
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