Proposal to have sqlc generate string constants for constraints #3763
Unanswered
andrewmbenton
asked this question in
Ideas
Replies: 1 comment
-
I agree this would be a great feature for sqlc to have. package postgres
const (
// UNIQUE KEYS
UniqueUsersId = "users_id_key"
UniqueGroupId = "group_id_key"
UniqueUsersToGroupsUserIdGroupId = "users_to_groups_user_id_group_id_key"
// FOREIGN KEYS
FKeyUsersToGroupsUserId = "users_to_groups_user_id_fkey"
FKeyUsersToGroupsGroupId = "users_to_groups_group_id_fkey"
) Of course, this takes manual effort and isn't foolproof. Having sqlc generate the exhaustive set of available constraints (with commented metadata) if possible would be a massive boon. If this gets implemented, it would be a good idea to have #835 in mind, as constraints are general to a database and can be centralised in a single file (or package) rather than being repeated per-model. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have some code that looks like:
It would be nice if I had string constants for all of my constraint names to compare against, and I think sqlc should be capable of building that for me.
Beta Was this translation helpful? Give feedback.
All reactions