From 288feb822c552fb0516a62eb52fc5ad2391be352 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Mon, 3 Jun 2024 17:07:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?video=E4=BD=BF=E7=94=A8=E5=8E=9F=E6=9D=A5?= =?UTF-8?q?=E7=9A=84id=E4=B8=8D=E4=BD=BF=E7=94=A8gorm.model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/video.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dao/video.go b/dao/video.go index 8c4fb72..b5fcbb8 100644 --- a/dao/video.go +++ b/dao/video.go @@ -1,12 +1,11 @@ package dao import ( - "gorm.io/gorm" "time" ) type Video struct { - gorm.Model + ID uint `gorm:"primarykey column:id"` CameraID int `gorm:"column:camera_id"` VideoPath string `gorm:"column:video_path"` VideoName string `gorm:"column:video_name"` From d002a4cb453c1c405a5a87cf46d945b13d516abf Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Mon, 3 Jun 2024 17:13:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?video,user=E4=BD=BF=E7=94=A8gorm.model?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dao/user.go | 3 ++- dao/video.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dao/user.go b/dao/user.go index a085829..2786d3d 100644 --- a/dao/user.go +++ b/dao/user.go @@ -2,10 +2,11 @@ package dao import ( "fmt" + "gorm.io/gorm" ) type User struct { - ID uint `gorm:"primarykey column:id"` + gorm.Model Name string `gorm:"column:name"` Age int `gorm:"column:age"` Email string `gorm:"column:email"` diff --git a/dao/video.go b/dao/video.go index b5fcbb8..8c4fb72 100644 --- a/dao/video.go +++ b/dao/video.go @@ -1,11 +1,12 @@ package dao import ( + "gorm.io/gorm" "time" ) type Video struct { - ID uint `gorm:"primarykey column:id"` + gorm.Model CameraID int `gorm:"column:camera_id"` VideoPath string `gorm:"column:video_path"` VideoName string `gorm:"column:video_name"`