feat(monitor): admin channel monitor MVP with SSRF protection and batch aggregation
新增 admin「渠道监控」模块(参考 BingZi-233/check-cx),独立于现有 Channel 体系。
admin 配置 + 后台定时调用上游 LLM chat completions 健康检查 + 所有登录用户只读可见。
后端:
- ent: channel_monitor + channel_monitor_history(AES-256-GCM 加密 api_key)
- service 按职责拆分:service/aggregator/validate/checker/runner/ssrf
- provider strategy map 替代 switch(openai/anthropic/gemini)
- repository batch 聚合(ListLatestForMonitorIDs + ComputeAvailabilityForMonitors)消除 N+1
- runner: ticker(5s) + pond worker pool(5) + inFlight 防并发 + TrySubmit 防雪崩
+ 凌晨 3 点 cron 清理 30 天历史
- SSRF 防护:强制 https + 私网/loopback/云元数据 IP 拒绝(127/8、10/8、172.16/12、
192.168/16、169.254/16、100.64/10、::1、fc00::/7、fe80::/10)+ DialContext
在 socket 层防 DNS rebinding
- API key sanitize:擦除 url.Error 与上游响应 body 中的 sk-/sk-ant-/AIza/JWT 模式
- APIKeyDecryptFailed 标志位 + 单 monitor 路径检测,避免空 key 调用上游
handler:
- admin: CRUD + 手动触发 + 历史接口(api_key 脱敏)
- user: 只读列表 + 状态详情(去除 api_key/endpoint)
- ParseChannelMonitorID 共用 + dto.ChannelMonitorExtraModelStatus 共用
前端:
- 路由 /admin/channels/{pricing,monitor} + /monitor(用户只读)
- AppSidebar 父项 expandOnly 支持
- ChannelMonitorView 拆为 8 个子组件 + ChannelStatusView 拆出 detail dialog
- composables/useChannelMonitorFormat + constants/channelMonitor 共享
- i18n monitorCommon namespace 消除 admin/user 两 view 重复
合规:所有文件符合 CLAUDE.md(Go ≤ 500 行 / Vue ≤ 300 行 / 函数 ≤ 30 行)
CI: go build / gofmt / golangci-lint(0 issues) / make test-unit / pnpm build 全绿
This commit is contained in:
158
backend/ent/channelmonitorhistory/channelmonitorhistory.go
Normal file
158
backend/ent/channelmonitorhistory/channelmonitorhistory.go
Normal file
@@ -0,0 +1,158 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package channelmonitorhistory
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the channelmonitorhistory type in the database.
|
||||
Label = "channel_monitor_history"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldMonitorID holds the string denoting the monitor_id field in the database.
|
||||
FieldMonitorID = "monitor_id"
|
||||
// FieldModel holds the string denoting the model field in the database.
|
||||
FieldModel = "model"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// FieldLatencyMs holds the string denoting the latency_ms field in the database.
|
||||
FieldLatencyMs = "latency_ms"
|
||||
// FieldPingLatencyMs holds the string denoting the ping_latency_ms field in the database.
|
||||
FieldPingLatencyMs = "ping_latency_ms"
|
||||
// FieldMessage holds the string denoting the message field in the database.
|
||||
FieldMessage = "message"
|
||||
// FieldCheckedAt holds the string denoting the checked_at field in the database.
|
||||
FieldCheckedAt = "checked_at"
|
||||
// EdgeMonitor holds the string denoting the monitor edge name in mutations.
|
||||
EdgeMonitor = "monitor"
|
||||
// Table holds the table name of the channelmonitorhistory in the database.
|
||||
Table = "channel_monitor_histories"
|
||||
// MonitorTable is the table that holds the monitor relation/edge.
|
||||
MonitorTable = "channel_monitor_histories"
|
||||
// MonitorInverseTable is the table name for the ChannelMonitor entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "channelmonitor" package.
|
||||
MonitorInverseTable = "channel_monitors"
|
||||
// MonitorColumn is the table column denoting the monitor relation/edge.
|
||||
MonitorColumn = "monitor_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for channelmonitorhistory fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldMonitorID,
|
||||
FieldModel,
|
||||
FieldStatus,
|
||||
FieldLatencyMs,
|
||||
FieldPingLatencyMs,
|
||||
FieldMessage,
|
||||
FieldCheckedAt,
|
||||
}
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
if column == Columns[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var (
|
||||
// ModelValidator is a validator for the "model" field. It is called by the builders before save.
|
||||
ModelValidator func(string) error
|
||||
// DefaultMessage holds the default value on creation for the "message" field.
|
||||
DefaultMessage string
|
||||
// MessageValidator is a validator for the "message" field. It is called by the builders before save.
|
||||
MessageValidator func(string) error
|
||||
// DefaultCheckedAt holds the default value on creation for the "checked_at" field.
|
||||
DefaultCheckedAt func() time.Time
|
||||
)
|
||||
|
||||
// Status defines the type for the "status" enum field.
|
||||
type Status string
|
||||
|
||||
// Status values.
|
||||
const (
|
||||
StatusOperational Status = "operational"
|
||||
StatusDegraded Status = "degraded"
|
||||
StatusFailed Status = "failed"
|
||||
StatusError Status = "error"
|
||||
)
|
||||
|
||||
func (s Status) String() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save.
|
||||
func StatusValidator(s Status) error {
|
||||
switch s {
|
||||
case StatusOperational, StatusDegraded, StatusFailed, StatusError:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("channelmonitorhistory: invalid enum value for status field: %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the ChannelMonitorHistory queries.
|
||||
type OrderOption func(*sql.Selector)
|
||||
|
||||
// ByID orders the results by the id field.
|
||||
func ByID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMonitorID orders the results by the monitor_id field.
|
||||
func ByMonitorID(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMonitorID, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByModel orders the results by the model field.
|
||||
func ByModel(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldModel, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByLatencyMs orders the results by the latency_ms field.
|
||||
func ByLatencyMs(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldLatencyMs, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByPingLatencyMs orders the results by the ping_latency_ms field.
|
||||
func ByPingLatencyMs(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldPingLatencyMs, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMessage orders the results by the message field.
|
||||
func ByMessage(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldMessage, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCheckedAt orders the results by the checked_at field.
|
||||
func ByCheckedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCheckedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMonitorField orders the results by monitor field.
|
||||
func ByMonitorField(field string, opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMonitorStep(), sql.OrderByField(field, opts...))
|
||||
}
|
||||
}
|
||||
func newMonitorStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MonitorInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MonitorTable, MonitorColumn),
|
||||
)
|
||||
}
|
||||
444
backend/ent/channelmonitorhistory/where.go
Normal file
444
backend/ent/channelmonitorhistory/where.go
Normal file
@@ -0,0 +1,444 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package channelmonitorhistory
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
"github.com/Wei-Shaw/sub2api/ent/predicate"
|
||||
)
|
||||
|
||||
// ID filters vertices based on their ID field.
|
||||
func ID(id int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// MonitorID applies equality check predicate on the "monitor_id" field. It's identical to MonitorIDEQ.
|
||||
func MonitorID(v int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldMonitorID, v))
|
||||
}
|
||||
|
||||
// Model applies equality check predicate on the "model" field. It's identical to ModelEQ.
|
||||
func Model(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldModel, v))
|
||||
}
|
||||
|
||||
// LatencyMs applies equality check predicate on the "latency_ms" field. It's identical to LatencyMsEQ.
|
||||
func LatencyMs(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldLatencyMs, v))
|
||||
}
|
||||
|
||||
// PingLatencyMs applies equality check predicate on the "ping_latency_ms" field. It's identical to PingLatencyMsEQ.
|
||||
func PingLatencyMs(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldPingLatencyMs, v))
|
||||
}
|
||||
|
||||
// Message applies equality check predicate on the "message" field. It's identical to MessageEQ.
|
||||
func Message(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldMessage, v))
|
||||
}
|
||||
|
||||
// CheckedAt applies equality check predicate on the "checked_at" field. It's identical to CheckedAtEQ.
|
||||
func CheckedAt(v time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldCheckedAt, v))
|
||||
}
|
||||
|
||||
// MonitorIDEQ applies the EQ predicate on the "monitor_id" field.
|
||||
func MonitorIDEQ(v int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldMonitorID, v))
|
||||
}
|
||||
|
||||
// MonitorIDNEQ applies the NEQ predicate on the "monitor_id" field.
|
||||
func MonitorIDNEQ(v int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldMonitorID, v))
|
||||
}
|
||||
|
||||
// MonitorIDIn applies the In predicate on the "monitor_id" field.
|
||||
func MonitorIDIn(vs ...int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldMonitorID, vs...))
|
||||
}
|
||||
|
||||
// MonitorIDNotIn applies the NotIn predicate on the "monitor_id" field.
|
||||
func MonitorIDNotIn(vs ...int64) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldMonitorID, vs...))
|
||||
}
|
||||
|
||||
// ModelEQ applies the EQ predicate on the "model" field.
|
||||
func ModelEQ(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelNEQ applies the NEQ predicate on the "model" field.
|
||||
func ModelNEQ(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelIn applies the In predicate on the "model" field.
|
||||
func ModelIn(vs ...string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldModel, vs...))
|
||||
}
|
||||
|
||||
// ModelNotIn applies the NotIn predicate on the "model" field.
|
||||
func ModelNotIn(vs ...string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldModel, vs...))
|
||||
}
|
||||
|
||||
// ModelGT applies the GT predicate on the "model" field.
|
||||
func ModelGT(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGT(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelGTE applies the GTE predicate on the "model" field.
|
||||
func ModelGTE(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGTE(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelLT applies the LT predicate on the "model" field.
|
||||
func ModelLT(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLT(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelLTE applies the LTE predicate on the "model" field.
|
||||
func ModelLTE(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLTE(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelContains applies the Contains predicate on the "model" field.
|
||||
func ModelContains(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldContains(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelHasPrefix applies the HasPrefix predicate on the "model" field.
|
||||
func ModelHasPrefix(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldHasPrefix(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelHasSuffix applies the HasSuffix predicate on the "model" field.
|
||||
func ModelHasSuffix(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldHasSuffix(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelEqualFold applies the EqualFold predicate on the "model" field.
|
||||
func ModelEqualFold(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEqualFold(FieldModel, v))
|
||||
}
|
||||
|
||||
// ModelContainsFold applies the ContainsFold predicate on the "model" field.
|
||||
func ModelContainsFold(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldContainsFold(FieldModel, v))
|
||||
}
|
||||
|
||||
// StatusEQ applies the EQ predicate on the "status" field.
|
||||
func StatusEQ(v Status) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusNEQ applies the NEQ predicate on the "status" field.
|
||||
func StatusNEQ(v Status) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusIn applies the In predicate on the "status" field.
|
||||
func StatusIn(vs ...Status) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// StatusNotIn applies the NotIn predicate on the "status" field.
|
||||
func StatusNotIn(vs ...Status) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// LatencyMsEQ applies the EQ predicate on the "latency_ms" field.
|
||||
func LatencyMsEQ(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldLatencyMs, v))
|
||||
}
|
||||
|
||||
// LatencyMsNEQ applies the NEQ predicate on the "latency_ms" field.
|
||||
func LatencyMsNEQ(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldLatencyMs, v))
|
||||
}
|
||||
|
||||
// LatencyMsIn applies the In predicate on the "latency_ms" field.
|
||||
func LatencyMsIn(vs ...int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldLatencyMs, vs...))
|
||||
}
|
||||
|
||||
// LatencyMsNotIn applies the NotIn predicate on the "latency_ms" field.
|
||||
func LatencyMsNotIn(vs ...int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldLatencyMs, vs...))
|
||||
}
|
||||
|
||||
// LatencyMsGT applies the GT predicate on the "latency_ms" field.
|
||||
func LatencyMsGT(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGT(FieldLatencyMs, v))
|
||||
}
|
||||
|
||||
// LatencyMsGTE applies the GTE predicate on the "latency_ms" field.
|
||||
func LatencyMsGTE(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGTE(FieldLatencyMs, v))
|
||||
}
|
||||
|
||||
// LatencyMsLT applies the LT predicate on the "latency_ms" field.
|
||||
func LatencyMsLT(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLT(FieldLatencyMs, v))
|
||||
}
|
||||
|
||||
// LatencyMsLTE applies the LTE predicate on the "latency_ms" field.
|
||||
func LatencyMsLTE(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLTE(FieldLatencyMs, v))
|
||||
}
|
||||
|
||||
// LatencyMsIsNil applies the IsNil predicate on the "latency_ms" field.
|
||||
func LatencyMsIsNil() predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIsNull(FieldLatencyMs))
|
||||
}
|
||||
|
||||
// LatencyMsNotNil applies the NotNil predicate on the "latency_ms" field.
|
||||
func LatencyMsNotNil() predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotNull(FieldLatencyMs))
|
||||
}
|
||||
|
||||
// PingLatencyMsEQ applies the EQ predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsEQ(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldPingLatencyMs, v))
|
||||
}
|
||||
|
||||
// PingLatencyMsNEQ applies the NEQ predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsNEQ(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldPingLatencyMs, v))
|
||||
}
|
||||
|
||||
// PingLatencyMsIn applies the In predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsIn(vs ...int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldPingLatencyMs, vs...))
|
||||
}
|
||||
|
||||
// PingLatencyMsNotIn applies the NotIn predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsNotIn(vs ...int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldPingLatencyMs, vs...))
|
||||
}
|
||||
|
||||
// PingLatencyMsGT applies the GT predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsGT(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGT(FieldPingLatencyMs, v))
|
||||
}
|
||||
|
||||
// PingLatencyMsGTE applies the GTE predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsGTE(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGTE(FieldPingLatencyMs, v))
|
||||
}
|
||||
|
||||
// PingLatencyMsLT applies the LT predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsLT(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLT(FieldPingLatencyMs, v))
|
||||
}
|
||||
|
||||
// PingLatencyMsLTE applies the LTE predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsLTE(v int) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLTE(FieldPingLatencyMs, v))
|
||||
}
|
||||
|
||||
// PingLatencyMsIsNil applies the IsNil predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsIsNil() predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIsNull(FieldPingLatencyMs))
|
||||
}
|
||||
|
||||
// PingLatencyMsNotNil applies the NotNil predicate on the "ping_latency_ms" field.
|
||||
func PingLatencyMsNotNil() predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotNull(FieldPingLatencyMs))
|
||||
}
|
||||
|
||||
// MessageEQ applies the EQ predicate on the "message" field.
|
||||
func MessageEQ(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageNEQ applies the NEQ predicate on the "message" field.
|
||||
func MessageNEQ(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageIn applies the In predicate on the "message" field.
|
||||
func MessageIn(vs ...string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldMessage, vs...))
|
||||
}
|
||||
|
||||
// MessageNotIn applies the NotIn predicate on the "message" field.
|
||||
func MessageNotIn(vs ...string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldMessage, vs...))
|
||||
}
|
||||
|
||||
// MessageGT applies the GT predicate on the "message" field.
|
||||
func MessageGT(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGT(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageGTE applies the GTE predicate on the "message" field.
|
||||
func MessageGTE(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGTE(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageLT applies the LT predicate on the "message" field.
|
||||
func MessageLT(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLT(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageLTE applies the LTE predicate on the "message" field.
|
||||
func MessageLTE(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLTE(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageContains applies the Contains predicate on the "message" field.
|
||||
func MessageContains(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldContains(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageHasPrefix applies the HasPrefix predicate on the "message" field.
|
||||
func MessageHasPrefix(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldHasPrefix(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageHasSuffix applies the HasSuffix predicate on the "message" field.
|
||||
func MessageHasSuffix(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldHasSuffix(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageIsNil applies the IsNil predicate on the "message" field.
|
||||
func MessageIsNil() predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIsNull(FieldMessage))
|
||||
}
|
||||
|
||||
// MessageNotNil applies the NotNil predicate on the "message" field.
|
||||
func MessageNotNil() predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotNull(FieldMessage))
|
||||
}
|
||||
|
||||
// MessageEqualFold applies the EqualFold predicate on the "message" field.
|
||||
func MessageEqualFold(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEqualFold(FieldMessage, v))
|
||||
}
|
||||
|
||||
// MessageContainsFold applies the ContainsFold predicate on the "message" field.
|
||||
func MessageContainsFold(v string) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldContainsFold(FieldMessage, v))
|
||||
}
|
||||
|
||||
// CheckedAtEQ applies the EQ predicate on the "checked_at" field.
|
||||
func CheckedAtEQ(v time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldEQ(FieldCheckedAt, v))
|
||||
}
|
||||
|
||||
// CheckedAtNEQ applies the NEQ predicate on the "checked_at" field.
|
||||
func CheckedAtNEQ(v time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNEQ(FieldCheckedAt, v))
|
||||
}
|
||||
|
||||
// CheckedAtIn applies the In predicate on the "checked_at" field.
|
||||
func CheckedAtIn(vs ...time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldIn(FieldCheckedAt, vs...))
|
||||
}
|
||||
|
||||
// CheckedAtNotIn applies the NotIn predicate on the "checked_at" field.
|
||||
func CheckedAtNotIn(vs ...time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldNotIn(FieldCheckedAt, vs...))
|
||||
}
|
||||
|
||||
// CheckedAtGT applies the GT predicate on the "checked_at" field.
|
||||
func CheckedAtGT(v time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGT(FieldCheckedAt, v))
|
||||
}
|
||||
|
||||
// CheckedAtGTE applies the GTE predicate on the "checked_at" field.
|
||||
func CheckedAtGTE(v time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldGTE(FieldCheckedAt, v))
|
||||
}
|
||||
|
||||
// CheckedAtLT applies the LT predicate on the "checked_at" field.
|
||||
func CheckedAtLT(v time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLT(FieldCheckedAt, v))
|
||||
}
|
||||
|
||||
// CheckedAtLTE applies the LTE predicate on the "checked_at" field.
|
||||
func CheckedAtLTE(v time.Time) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.FieldLTE(FieldCheckedAt, v))
|
||||
}
|
||||
|
||||
// HasMonitor applies the HasEdge predicate on the "monitor" edge.
|
||||
func HasMonitor() predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, MonitorTable, MonitorColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasMonitorWith applies the HasEdge predicate on the "monitor" edge with a given conditions (other predicates).
|
||||
func HasMonitorWith(preds ...predicate.ChannelMonitor) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(func(s *sql.Selector) {
|
||||
step := newMonitorStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// And groups predicates with the AND operator between them.
|
||||
func And(predicates ...predicate.ChannelMonitorHistory) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.ChannelMonitorHistory) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.ChannelMonitorHistory) predicate.ChannelMonitorHistory {
|
||||
return predicate.ChannelMonitorHistory(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user