henvic / henvic/pgq

Custom Valuer interface breaks inter-operability with packages that implement driver.Valuer

Open
#4 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
72
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Hi! I'm experiencing a problem with the package where because of the custom `Valuer` interface, the types that do implement `driver.Valuer` are not recognized.

For context, I'm using `github.com/google/uuid` type and since it [does implement `driver.Valuer` interface](https://github.com/google/uuid/blob/master/sql.go#L57-L59) I expected it to automatically convert to string, so doing something like this would just work:
```go
func myFunc(ctx context.Context, id uuid.UUID) error {
q := pgq.Update("table").Where(pgq.Eq{"id": id})
}
```

Is there a reason to not use `driver.Valuer` interface? It's semantically the same since `driver.Valuer` is `Value() (driver.Value, error)` where `driver.Value` is just an alias to `any`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.