Sometimes a column needs to be unique only as long as one or more other columns are the same as well.
Often these would be an unique index, e.g. from psql output:
"idx_unique_type_name" UNIQUE, btree (type, name)
The order also matters - in this case the unique index will be usable for WHERE type = ? queries as well, but not WHERE name = ? queries without type filtered as well. This order might want to be different than the order the fields are in the struct.
Sometimes a column needs to be unique only as long as one or more other columns are the same as well.
Often these would be an unique index, e.g. from psql output:
"idx_unique_type_name" UNIQUE, btree (type, name)The order also matters - in this case the unique index will be usable for
WHERE type = ?queries as well, but notWHERE name = ?queries withouttypefiltered as well. This order might want to be different than the order the fields are in the struct.