Files
OpenFlare/internal/model/openflare_origin.go
T
ryan 943818f7d4 refactor(repository): 收敛 model/repository 分层为唯一持久化入口
将 OpenFlare 与平台业务的数据访问从 model 与 apps 直连迁入 repository,
model 仅保留实体与无 IO 规则;补充 code-check 架构守卫与开发规范。
2026-07-24 17:00:17 +08:00

46 lines
1.3 KiB
Go

// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
package model
import (
"time"
)
// Origin OpenFlare 源站实体。
type Origin struct {
ID uint `json:"id" gorm:"primaryKey;autoIncrement"`
Name string `json:"name" gorm:"size:255;not null"`
Address string `json:"address" gorm:"uniqueIndex;size:255;not null"`
Remark string `json:"remark" gorm:"size:255"`
CreatedAt time.Time `json:"created_at" gorm:"autoCreateTime"`
UpdatedAt time.Time `json:"updated_at" gorm:"autoUpdateTime"`
}
// TableName 表名。
func (Origin) TableName() string {
return "of_origins"
}
// OriginRouteCount 源站关联的代理规则数量。
type OriginRouteCount struct {
OriginID uint `json:"origin_id"`
RouteCount int64 `json:"route_count"`
}
// OriginProxyRoute 源站模块查询代理规则时使用的最小字段集。
type OriginProxyRoute struct {
ID uint `gorm:"column:id;primaryKey"`
OriginID *uint `gorm:"column:origin_id"`
Domain string `gorm:"column:domain"`
OriginURL string `gorm:"column:origin_url"`
Upstreams string `gorm:"column:upstreams"`
Enabled bool `gorm:"column:enabled"`
UpdatedAt time.Time `gorm:"column:updated_at"`
}
// TableName 表名。
func (OriginProxyRoute) TableName() string {
return tableOfProxyRoutes
}