From a28fc592d183ad3e03260881f5de732f0099ec2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Thu, 7 Nov 2024 00:52:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/database.go | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/internal/biz/database.go b/internal/biz/database.go index c7986559..0cd30474 100644 --- a/internal/biz/database.go +++ b/internal/biz/database.go @@ -10,17 +10,25 @@ import ( "github.com/TheTNB/panel/internal/app" ) +type DatabaseType string + +const ( + DatabaseTypeMysql DatabaseType = "mysql" + DatabaseTypePostgresql DatabaseType = "postgresql" + DatabaseTypeRedis DatabaseType = "redis" +) + type Database struct { - ID uint `gorm:"primaryKey" json:"id"` - Name string `gorm:"not null;unique" json:"name"` - Type string `gorm:"not null" json:"type"` - Host string `gorm:"not null" json:"host"` - Port int `gorm:"not null" json:"port"` - Username string `gorm:"not null" json:"username"` - Password string `gorm:"not null" json:"password"` - Remark string `gorm:"not null" json:"remark"` - CreatedAt time.Time `json:"created_at"` - UpdatedAt time.Time `json:"updated_at"` + ID uint `gorm:"primaryKey" json:"id"` + Name string `gorm:"not null;unique" json:"name"` + Type DatabaseType `gorm:"not null" json:"type"` + Host string `gorm:"not null" json:"host"` + Port int `gorm:"not null" json:"port"` + Username string `gorm:"not null" json:"username"` + Password string `gorm:"not null" json:"password"` + Remark string `gorm:"not null" json:"remark"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` DatabaseItems []*DatabaseItem `json:"-"` }