添加访问日志表及相关字段,更新模型字段注释

This commit is contained in:
2025-05-08 10:46:21 +08:00
parent 0e0affb008
commit c93d0bf467
37 changed files with 664 additions and 242 deletions

View File

@@ -31,10 +31,12 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
_channel.UserID = field.NewInt32(tableName, "user_id")
_channel.ProxyID = field.NewInt32(tableName, "proxy_id")
_channel.NodeID = field.NewInt32(tableName, "node_id")
_channel.ProxyHost = field.NewString(tableName, "proxy_host")
_channel.ProxyPort = field.NewInt32(tableName, "proxy_port")
_channel.UserHost = field.NewString(tableName, "user_host")
_channel.NodeHost = field.NewString(tableName, "node_host")
_channel.Protocol = field.NewInt32(tableName, "protocol")
_channel.AuthIP = field.NewBool(tableName, "auth_ip")
_channel.UserHost = field.NewString(tableName, "user_host")
_channel.AuthPass = field.NewBool(tableName, "auth_pass")
_channel.Username = field.NewString(tableName, "username")
_channel.Password = field.NewString(tableName, "password")
@@ -42,8 +44,6 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
_channel.CreatedAt = field.NewField(tableName, "created_at")
_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()
@@ -58,10 +58,12 @@ type channel struct {
UserID field.Int32 // 用户ID
ProxyID field.Int32 // 代理ID
NodeID field.Int32 // 节点ID
ProxyHost field.String // 代理地址
ProxyPort field.Int32 // 转发端口
UserHost field.String // 用户地址
NodeHost field.String // 节点地址
Protocol field.Int32 // 协议类型1-http2-https3-socks5
AuthIP field.Bool // IP认证
UserHost field.String // 用户地址
AuthPass field.Bool // 密码认证
Username field.String // 用户名
Password field.String // 密码
@@ -69,8 +71,6 @@ type channel struct {
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
ProxyHost field.String
Protocol field.Int32 // 协议类型1-http2-https3-socks5
fieldMap map[string]field.Expr
}
@@ -91,10 +91,12 @@ func (c *channel) updateTableName(table string) *channel {
c.UserID = field.NewInt32(table, "user_id")
c.ProxyID = field.NewInt32(table, "proxy_id")
c.NodeID = field.NewInt32(table, "node_id")
c.ProxyHost = field.NewString(table, "proxy_host")
c.ProxyPort = field.NewInt32(table, "proxy_port")
c.UserHost = field.NewString(table, "user_host")
c.NodeHost = field.NewString(table, "node_host")
c.Protocol = field.NewInt32(table, "protocol")
c.AuthIP = field.NewBool(table, "auth_ip")
c.UserHost = field.NewString(table, "user_host")
c.AuthPass = field.NewBool(table, "auth_pass")
c.Username = field.NewString(table, "username")
c.Password = field.NewString(table, "password")
@@ -102,8 +104,6 @@ func (c *channel) updateTableName(table string) *channel {
c.CreatedAt = field.NewField(table, "created_at")
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()
@@ -125,10 +125,12 @@ func (c *channel) fillFieldMap() {
c.fieldMap["user_id"] = c.UserID
c.fieldMap["proxy_id"] = c.ProxyID
c.fieldMap["node_id"] = c.NodeID
c.fieldMap["proxy_host"] = c.ProxyHost
c.fieldMap["proxy_port"] = c.ProxyPort
c.fieldMap["user_host"] = c.UserHost
c.fieldMap["node_host"] = c.NodeHost
c.fieldMap["protocol"] = c.Protocol
c.fieldMap["auth_ip"] = c.AuthIP
c.fieldMap["user_host"] = c.UserHost
c.fieldMap["auth_pass"] = c.AuthPass
c.fieldMap["username"] = c.Username
c.fieldMap["password"] = c.Password
@@ -136,8 +138,6 @@ func (c *channel) fillFieldMap() {
c.fieldMap["created_at"] = c.CreatedAt
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 {