rss
01/21/2023, 3:17 AMIIDR Configuration not allowing Oracle Parameters▾
Management Console not allowing Oracle either▾
rss
01/21/2023, 3:17 AMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMjson:"id" gorm:"primaryKey"
OwnerId int `json:"owner_id" // foreign key to User model
Title string json:"title"
Body string json:"body"
Likes []Like json:"likes"
}
// Like model
type Like struct {
PostId int json:"post_id"
// foreign key to Post model
LikerId int json:"liker_id"
// foreign key to User model
}
I want to run a query which gets...rss
01/27/2023, 2:47 PMhttps://i.stack.imgur.com/dqk7T.png▾
rss
01/27/2023, 2:47 PMlibraries▾
Here is my struct▾
Here is how I connect with database▾
Here is How I do auto migrate ▾
rss
01/27/2023, 2:47 PMgorm:"primary_key;column:employee_id"
EmployeeCode string gorm:"column:employee_code"
FirstName string gorm:"column:first_name"
LastName string gorm:"column:last_name"
DesignationID int64 gorm:"column:designation_id;"
Designation *Designation gorm:"foreignkey:DesignationID"
}
type Designation struct {
DesignationID int64...rss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMjson:"template_id"
Name string json:"template_name"
FlowUI string json:"flowUI"
Tags pq.StringArray gorm:"type:varchar(255)[]" json:"tags"
}
But if I instead do
model := dbconn.Where(?=ANY(tags), tagstring).Find(&templates)...rss
01/27/2023, 2:47 PMhttps://i.stack.imgur.com/bR3kd.jpg▾
rss
01/27/2023, 2:47 PMgorm:"primary_key"
Index int gorm:"uniqueIndex:unique_order"
ParentID int gorm:"uniqueIndex:unique_order"
}
The problem I'm running into is when I create and delete multiple elements I start to get an error like
ERROR: duplicate key value violates unique constraint "unique_order" (SQLSTATE 23505)
This is happening...rss
01/27/2023, 2:47 PMgorm:"index"
InstanceId string gorm:"primaryKey"
InstanceName string
InstanceType string...rss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMgorm:"primaryKey" json:"threadId"
Title string gorm:"not null" json:"title"
Body string gorm:"not null" json:"body"
CreatedAt time.Time
UpdatedAt time.Time
// Foreign keys
UserID uuid.UUID json:"userId"
// Has many association
Comments []Comment...rss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMgorm:"type:uuid;primary_key;default:uuid_generate_v4()"
}
type Table2 struct {
Id uuid.UUID gorm:"type:uuid;primary_key;default:uuid_generate_v4()"
Table2ID uuid.UUID gorm:"type:uuid;default:uuid_generate_v4()"
Table2 Table2
}
type Table3 struct...rss
01/27/2023, 2:47 PMgorm:"primaryKey" json:"threadId"
Title string gorm:"not null" json:"title"
Body string gorm:"not null" json:"body"
CreatedAt time.Time json:"createdAt"
UpdatedAt time.Time json:"updatedAt"
// Foreign keys
UserID uuid.UUID json:"userId"
// Has many association
Comments...rss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMDELETE
)
.WithArgs(expirationDate)
.WillReturnResult(sqlmock.NewResult(1, 1))
Receiving...rss
01/27/2023, 2:47 PMusers
(name
,age
,created_at
) VALUES ("jinzhu", 18, "2020-07-04 11:05:21.775")
What configuration should I do to achieve this ?rss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PMgorm:"primary_key;type:bigint(20) not null" sql:"nextval('user_tfa_info_seq')"
}rss
01/27/2023, 2:47 PMrss
01/27/2023, 2:47 PM