zu1k 5 лет назад
Родитель
Сommit
30e46c6ace
2 измененных файлов с 8 добавлено и 8 удалено
  1. 2 2
      internal/database/proxy.go
  2. 6 6
      pkg/proxy/base.go

+ 2 - 2
internal/database/proxy.go

@@ -7,9 +7,9 @@ import (
 
 type Proxy struct {
 	gorm.Model
-	proxy.Base `gorm:"index"`
+	proxy.Base
 	Link       string
-	Identifier string `gorm:"primaryKey"`
+	Identifier string `gorm:"unique"`
 }
 
 func InitTables() {

+ 6 - 6
pkg/proxy/base.go

@@ -1,13 +1,13 @@
 package proxy
 
 type Base struct {
-	Name    string `yaml:"name" json:"name"`
-	Server  string `yaml:"server" json:"server"`
-	Port    int    `yaml:"port" json:"port"`
-	Type    string `yaml:"type" json:"type"`
+	Name    string `yaml:"name" json:"name" gorm:"index"`
+	Server  string `yaml:"server" json:"server" gorm:"index"`
+	Port    int    `yaml:"port" json:"port" gorm:"index"`
+	Type    string `yaml:"type" json:"type" gorm:"index"`
 	UDP     bool   `yaml:"udp,omitempty" json:"udp,omitempty"`
-	Country string `yaml:"country,omitempty" json:"country,omitempty"`
-	Useable bool   `yaml:"useable,omitempty" json:"useable,omitempty"`
+	Country string `yaml:"country,omitempty" json:"country,omitempty" gorm:"index"`
+	Useable bool   `yaml:"useable,omitempty" json:"useable,omitempty" gorm:"index"`
 }
 
 func (b *Base) TypeName() string {