优化数据库结构与数据插入逻辑
This commit is contained in:
@@ -32,7 +32,6 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
|
||||
_channel.ProxyID = field.NewInt32(tableName, "proxy_id")
|
||||
_channel.NodeID = field.NewInt32(tableName, "node_id")
|
||||
_channel.ProxyPort = field.NewInt32(tableName, "proxy_port")
|
||||
_channel.Protocol = field.NewString(tableName, "protocol")
|
||||
_channel.UserHost = field.NewString(tableName, "user_host")
|
||||
_channel.NodeHost = field.NewString(tableName, "node_host")
|
||||
_channel.AuthIP = field.NewBool(tableName, "auth_ip")
|
||||
@@ -44,6 +43,7 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
|
||||
_channel.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||
_channel.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
_channel.ProxyHost = field.NewString(tableName, "proxy_host")
|
||||
_channel.Protocol = field.NewInt32(tableName, "protocol")
|
||||
|
||||
_channel.fillFieldMap()
|
||||
|
||||
@@ -59,7 +59,6 @@ type channel struct {
|
||||
ProxyID field.Int32 // 代理ID
|
||||
NodeID field.Int32 // 节点ID
|
||||
ProxyPort field.Int32 // 转发端口
|
||||
Protocol field.String // 协议
|
||||
UserHost field.String // 用户地址
|
||||
NodeHost field.String // 节点地址
|
||||
AuthIP field.Bool // IP认证
|
||||
@@ -71,6 +70,7 @@ type channel struct {
|
||||
UpdatedAt field.Field // 更新时间
|
||||
DeletedAt field.Field // 删除时间
|
||||
ProxyHost field.String
|
||||
Protocol field.Int32
|
||||
|
||||
fieldMap map[string]field.Expr
|
||||
}
|
||||
@@ -92,7 +92,6 @@ func (c *channel) updateTableName(table string) *channel {
|
||||
c.ProxyID = field.NewInt32(table, "proxy_id")
|
||||
c.NodeID = field.NewInt32(table, "node_id")
|
||||
c.ProxyPort = field.NewInt32(table, "proxy_port")
|
||||
c.Protocol = field.NewString(table, "protocol")
|
||||
c.UserHost = field.NewString(table, "user_host")
|
||||
c.NodeHost = field.NewString(table, "node_host")
|
||||
c.AuthIP = field.NewBool(table, "auth_ip")
|
||||
@@ -104,6 +103,7 @@ func (c *channel) updateTableName(table string) *channel {
|
||||
c.UpdatedAt = field.NewField(table, "updated_at")
|
||||
c.DeletedAt = field.NewField(table, "deleted_at")
|
||||
c.ProxyHost = field.NewString(table, "proxy_host")
|
||||
c.Protocol = field.NewInt32(table, "protocol")
|
||||
|
||||
c.fillFieldMap()
|
||||
|
||||
@@ -126,7 +126,6 @@ func (c *channel) fillFieldMap() {
|
||||
c.fieldMap["proxy_id"] = c.ProxyID
|
||||
c.fieldMap["node_id"] = c.NodeID
|
||||
c.fieldMap["proxy_port"] = c.ProxyPort
|
||||
c.fieldMap["protocol"] = c.Protocol
|
||||
c.fieldMap["user_host"] = c.UserHost
|
||||
c.fieldMap["node_host"] = c.NodeHost
|
||||
c.fieldMap["auth_ip"] = c.AuthIP
|
||||
@@ -138,6 +137,7 @@ func (c *channel) fillFieldMap() {
|
||||
c.fieldMap["updated_at"] = c.UpdatedAt
|
||||
c.fieldMap["deleted_at"] = c.DeletedAt
|
||||
c.fieldMap["proxy_host"] = c.ProxyHost
|
||||
c.fieldMap["protocol"] = c.Protocol
|
||||
}
|
||||
|
||||
func (c channel) clone(db *gorm.DB) channel {
|
||||
|
||||
Reference in New Issue
Block a user