Skip to content

Conversation

Songmu
Copy link
Contributor

@Songmu Songmu commented Nov 8, 2020

Support slice of custom types like []UserID(type UserID int64).

In this change, The expandSliceArgs expand if the slice element implements driver.Valuer or is of a named primitive type.

If the slice itself is of a certain type and implements driver.Valuer, expandSliceArgs does not expand the slice. So it keeps backward compatibility.

Typing as follows is reassuring in terms of type safety, and we define types in that way on our production.

In that case, this change is beneficial. What do you think?

type UserID int64

type User struct {
    ID UserID `db:"id"`
}

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.

1 participant