wip: list
This commit is contained in:
1 parent
b2c13508f4
commit
5e0885f22d
13 files changed
+241
-19
No files matched your search
+30
-4
@@ -1,9 +1,35 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm"
|
||||
import (
|
||||
"github.com/loveuer/nf-disk/internal/opt"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func Init(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
func Init(tx *gorm.DB) (err error) {
|
||||
if err = tx.AutoMigrate(
|
||||
&Connection{},
|
||||
)
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if opt.Debug {
|
||||
if err = tx.Create([]*Connection{
|
||||
{
|
||||
Name: "dev-minio",
|
||||
Endpoint: "http://10.220.10.15:9000",
|
||||
Access: "8ALV3DUZI31YG4BDRJ0Z",
|
||||
Key: "CRqwS1MsiUj27TbRK+3T2n+LpKWd07VvaDKuzU0H",
|
||||
},
|
||||
{
|
||||
Name: "test",
|
||||
Endpoint: "http://10.220.10.14:19000",
|
||||
Access: "",
|
||||
Key: "",
|
||||
},
|
||||
}).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
@@ -11,6 +11,8 @@ type Connection struct {
|
||||
Endpoint string `json:"endpoint" gorm:"column:endpoint"`
|
||||
Access string `json:"access" gorm:"column:access"`
|
||||
Key string `json:"key" gorm:"column:key"`
|
||||
|
||||
Active bool `json:"active" gorm:"-"`
|
||||
}
|
||||
|
||||
func (c *Connection) Create(tx *gorm.DB) error {
|
||||
|
||||
Reference in new issue
Block a user