I want to put multiple unique constraints on a single column in Gorm

Asked 2 months ago, Updated 2 months ago, 3 views

I'd like to place multiple unique constraints on a single column in Gorm.

typeObject structure{
    Z string `gorm: "unique_index:unique_a;unique_index:unique_b"`
    A string `gorm: "unique_index:unique_a"`
    B string `gorm: "unique_index:unique_b"`
}

The constraint does not apply to z when described above.

How can I describe it?

mysql go gorm

2022-09-30 11:51

1 Answers

unique_index:unique_uid, unique_username resolved.

--This answer is a community wik that asks questions posted as CommentReposted by i.


2022-09-30 11:51

If you have any answers or tips


© 2022 OneMinuteCode. All rights reserved.