Skip to content

Conversation

@tburgin
Copy link
Contributor

@tburgin tburgin commented Nov 13, 2024

Given a table like:

CREATE TABLE TestTable (Key INT64, IP BYTES(MAX), Duration INT64) PRIMARY KEY (Key)

I propose supporting writing and scanning from/to type aliases.

_, err = tx.ExecContext(ctx,
	"INSERT INTO TestTable (key, ip, duration) VALUES (@key, @ip, @duration)",
	123, net.IPv6loopback, time.Duration(1))

When using a struct as a model in an ORM (gorm for example), supporting type aliases makes those abstractions much more ergonomic.

@tburgin tburgin requested a review from a team as a code owner November 13, 2024 20:07
@olavloite
Copy link
Collaborator

This looks good to me.

@egonelbre Would you mind taking a look as well? As far as I can see, this retains the behavior that you introduced with the current implementation, and should as such not break anything on your side, but it would be good if you could confirm.

@egonelbre
Copy link
Contributor

@olavloite looks like all our tests passed. But valuerReflectType and callValuerValue can now also be removed.

@olavloite
Copy link
Collaborator

@olavloite looks like all our tests passed. But valuerReflectType and callValuerValue can now also be removed.

Thanks for the quick response! I'll indeed remove the (now) unused methods before merging.

@olavloite olavloite merged commit 5cb6fc6 into googleapis:main Nov 14, 2024
14 checks passed
@tburgin
Copy link
Contributor Author

tburgin commented Nov 14, 2024

Thanks for the quick review.

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