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

fix: Columns and Values should recognize Slice values too #68

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

max-stytch
Copy link
Contributor

Continues work done in #67 with the same rationale - this worked in 1.3 and no longer works in 2.0. This fix allows us to continue to use scan to pull the column names and values out for slice and array elements.

A more concerete example:

We use arrays for lots of filter operations - for example if I wanted to find all Widgets owned by a group of users, I might define

type WidgetFilter struct {
    OwnerIDs []string `db:"owner_id"`
}

and then

WidgetFilter{OwnerIDs: []string{"123", "456"}

would be evaluated as

select * from widgets where owner_id in (?, ?), ["123", "456"]

We're hoping to release some of this stuff that builds on scan soon!

@coveralls
Copy link

Coverage Status

coverage: 99.627%. remained the same when pulling b312ee8 on max-stytch:max/fix-scan-slices into 9c197bf on blockloop:master.

Copy link
Owner

@blockloop blockloop left a comment

Choose a reason for hiding this comment

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

LGTM

@blockloop blockloop merged commit 644ce11 into blockloop:master Aug 23, 2023
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