Joe Schafer

Results 78 comments of Joe Schafer

Thanks for reporting. I can provide a fix faster if you're able to provide: - Current version `pggen version` - Minimal schema. Specifically, where does the `date` column appear in...

Can you post a minimal schema, query, and pggen invocation to reproduce? Inferring from the error message, it looks like you have a custom type `ProductIn` used as input to...

I can reproduce and looking for a fix.

The panic occurs because we're setting a pgtype.Interval to another Interval which should be supported by pgtype. The relevant code is https://github.com/jackc/pgtype/blob/d846dbcb75b2ac38a1c6fd0390cd18472fe72dee/interval.go#L35: ```go if value, ok := src.(interface{ Get() interface{}...

> What do you think to optionally define separate pgx type / destination types? I think this implemented in https://github.com/jschaf/pggen/commit/0056cfbec4a2258e1e0d14a9464613861a06e551. I still need to test the type override logic but...

Yea, in retrospect, I think the Batch and Scan variants should live in a separate `BatchQuerier` interface. That would at least solve large number of similarly named methods on `Querier`....

> But will it generate a separate file for the interface or the interface will share the same file with original Querier interface. Same file. I like 1 file per...

For the short term, the easiest option is to use 2 separate queries, one for each column. SQL has pretty limited abstractions for dealing with idents. Then use an if-statement...

Interesting. Do you mean something like: ```sql -- name: FetchJsonExample :one SELECT 1 as col_one, '{"foo": "bar"}'::jsonb as json_col ``` Would generate this Go code: ```go type JsonColType struct {...

Awesome, thank you for the explanation and code. Makes sense and definitely fits in with the goals of generating human-like code.