jackc / pgx

PostgreSQL driver and toolkit for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Map / register an ULID type

rafaelsousa opened this issue · comments

Hello.

I have the following domain on my postgresql database :
create domain ulid as char(26) check (value ~ '^[0-9A-Z]{26}$');

We decided to adopt sqlc from our new microservices and we have the following type we've been using

type ULID string

I'm having a few difficulties trying to use it with and often I'm blocked because I have the error "cannot find encode plan" when trying to use a query with filters.

What's the best way of registering my type so pgx can find the plan correctly?

Thanks