feat(channel-monitor): request templates with snapshot apply + headers/body override
Problem:
Upstream channels can reject monitor probes based on client fingerprint
(e.g. "only Claude Code clients allowed"). The monitor had no way to
customize the outgoing request to bypass such restrictions.
Solution:
Introduce reusable request templates that carry extra_headers plus an
optional body override; monitors reference a template and receive a
snapshot copy on apply. Template edits do NOT auto-propagate — users
must click "apply to associated monitors" to refresh snapshots, so a
bad template edit cannot instantly break all production monitors.
Data model (migration 112):
- channel_monitor_request_templates: id, name, provider, description,
extra_headers jsonb, body_override_mode ('off'|'merge'|'replace'),
body_override jsonb. Unique (provider, name).
- channel_monitors: +template_id (FK, ON DELETE SET NULL), +extra_headers,
+body_override_mode, +body_override (the three runtime snapshot fields).
Checker (channel_monitor_checker.go):
- callProvider + runCheckForModel accept a CheckOptions carrying the
snapshot fields. mergeHeaders applies user headers on top of adapter
defaults (forbidden list: Host / Content-Length / Transfer-Encoding /
Connection / Content-Encoding).
- buildRequestBody:
off -> adapter default body
merge -> shallow-merge over default; per-provider deny list
(model/messages/contents) protects the challenge contract
replace -> user body verbatim
- Replace mode skips challenge validation; instead HTTP 2xx + non-empty
extracted response text = operational, empty = failed.
- 4 new unit tests cover all three modes + replace/empty-response case.
Admin API:
- /admin/channel-monitor-templates CRUD + /:id/apply (overwrite snapshot
on all template_id=id monitors, returns affected count).
- channel_monitor request/response DTOs gain the 4 new fields.
Frontend:
- channelMonitorTemplate.ts API client.
- MonitorAdvancedRequestConfig.vue shared component for headers textarea
+ body mode radio + body JSON editor; used by both template and monitor
forms.
- MonitorTemplateManagerDialog.vue: provider tabs, list/create/edit/
delete/apply, live "associated monitors" count per row.
- MonitorFiltersBar: new 模板管理 button next to 新增监控.
- MonitorFormDialog: collapsible 高级 section with template dropdown
(filtered by form.provider, clears on provider change) + embedded
AdvancedRequestConfig. Picking a template copies its fields into the
form (snapshot semantics mirrored on the client).
- i18n zh/en entries for all new copy.
chore: bump version to 0.1.114.32
This commit is contained in:
@@ -0,0 +1,172 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package channelmonitorrequesttemplate
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"entgo.io/ent/dialect/sql"
|
||||
"entgo.io/ent/dialect/sql/sqlgraph"
|
||||
)
|
||||
|
||||
const (
|
||||
// Label holds the string label denoting the channelmonitorrequesttemplate type in the database.
|
||||
Label = "channel_monitor_request_template"
|
||||
// FieldID holds the string denoting the id field in the database.
|
||||
FieldID = "id"
|
||||
// FieldCreatedAt holds the string denoting the created_at field in the database.
|
||||
FieldCreatedAt = "created_at"
|
||||
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
|
||||
FieldUpdatedAt = "updated_at"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
// FieldProvider holds the string denoting the provider field in the database.
|
||||
FieldProvider = "provider"
|
||||
// FieldDescription holds the string denoting the description field in the database.
|
||||
FieldDescription = "description"
|
||||
// FieldExtraHeaders holds the string denoting the extra_headers field in the database.
|
||||
FieldExtraHeaders = "extra_headers"
|
||||
// FieldBodyOverrideMode holds the string denoting the body_override_mode field in the database.
|
||||
FieldBodyOverrideMode = "body_override_mode"
|
||||
// FieldBodyOverride holds the string denoting the body_override field in the database.
|
||||
FieldBodyOverride = "body_override"
|
||||
// EdgeMonitors holds the string denoting the monitors edge name in mutations.
|
||||
EdgeMonitors = "monitors"
|
||||
// Table holds the table name of the channelmonitorrequesttemplate in the database.
|
||||
Table = "channel_monitor_request_templates"
|
||||
// MonitorsTable is the table that holds the monitors relation/edge.
|
||||
MonitorsTable = "channel_monitors"
|
||||
// MonitorsInverseTable is the table name for the ChannelMonitor entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "channelmonitor" package.
|
||||
MonitorsInverseTable = "channel_monitors"
|
||||
// MonitorsColumn is the table column denoting the monitors relation/edge.
|
||||
MonitorsColumn = "template_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for channelmonitorrequesttemplate fields.
|
||||
var Columns = []string{
|
||||
FieldID,
|
||||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
FieldName,
|
||||
FieldProvider,
|
||||
FieldDescription,
|
||||
FieldExtraHeaders,
|
||||
FieldBodyOverrideMode,
|
||||
FieldBodyOverride,
|
||||
}
|
||||
|
||||
// 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 (
|
||||
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
|
||||
DefaultCreatedAt func() time.Time
|
||||
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
|
||||
DefaultUpdatedAt func() time.Time
|
||||
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
|
||||
UpdateDefaultUpdatedAt func() time.Time
|
||||
// NameValidator is a validator for the "name" field. It is called by the builders before save.
|
||||
NameValidator func(string) error
|
||||
// DefaultDescription holds the default value on creation for the "description" field.
|
||||
DefaultDescription string
|
||||
// DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
|
||||
DescriptionValidator func(string) error
|
||||
// DefaultExtraHeaders holds the default value on creation for the "extra_headers" field.
|
||||
DefaultExtraHeaders map[string]string
|
||||
// DefaultBodyOverrideMode holds the default value on creation for the "body_override_mode" field.
|
||||
DefaultBodyOverrideMode string
|
||||
// BodyOverrideModeValidator is a validator for the "body_override_mode" field. It is called by the builders before save.
|
||||
BodyOverrideModeValidator func(string) error
|
||||
)
|
||||
|
||||
// Provider defines the type for the "provider" enum field.
|
||||
type Provider string
|
||||
|
||||
// Provider values.
|
||||
const (
|
||||
ProviderOpenai Provider = "openai"
|
||||
ProviderAnthropic Provider = "anthropic"
|
||||
ProviderGemini Provider = "gemini"
|
||||
)
|
||||
|
||||
func (pr Provider) String() string {
|
||||
return string(pr)
|
||||
}
|
||||
|
||||
// ProviderValidator is a validator for the "provider" field enum values. It is called by the builders before save.
|
||||
func ProviderValidator(pr Provider) error {
|
||||
switch pr {
|
||||
case ProviderOpenai, ProviderAnthropic, ProviderGemini:
|
||||
return nil
|
||||
default:
|
||||
return fmt.Errorf("channelmonitorrequesttemplate: invalid enum value for provider field: %q", pr)
|
||||
}
|
||||
}
|
||||
|
||||
// OrderOption defines the ordering options for the ChannelMonitorRequestTemplate 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()
|
||||
}
|
||||
|
||||
// ByCreatedAt orders the results by the created_at field.
|
||||
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByUpdatedAt orders the results by the updated_at field.
|
||||
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByName orders the results by the name field.
|
||||
func ByName(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldName, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByProvider orders the results by the provider field.
|
||||
func ByProvider(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldProvider, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByDescription orders the results by the description field.
|
||||
func ByDescription(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldDescription, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByBodyOverrideMode orders the results by the body_override_mode field.
|
||||
func ByBodyOverrideMode(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldBodyOverrideMode, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByMonitorsCount orders the results by monitors count.
|
||||
func ByMonitorsCount(opts ...sql.OrderTermOption) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborsCount(s, newMonitorsStep(), opts...)
|
||||
}
|
||||
}
|
||||
|
||||
// ByMonitors orders the results by monitors terms.
|
||||
func ByMonitors(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption {
|
||||
return func(s *sql.Selector) {
|
||||
sqlgraph.OrderByNeighborTerms(s, newMonitorsStep(), append([]sql.OrderTerm{term}, terms...)...)
|
||||
}
|
||||
}
|
||||
func newMonitorsStep() *sqlgraph.Step {
|
||||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(MonitorsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, true, MonitorsTable, MonitorsColumn),
|
||||
)
|
||||
}
|
||||
434
backend/ent/channelmonitorrequesttemplate/where.go
Normal file
434
backend/ent/channelmonitorrequesttemplate/where.go
Normal file
@@ -0,0 +1,434 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package channelmonitorrequesttemplate
|
||||
|
||||
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.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDEQ applies the EQ predicate on the ID field.
|
||||
func IDEQ(id int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDNEQ applies the NEQ predicate on the ID field.
|
||||
func IDNEQ(id int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNEQ(FieldID, id))
|
||||
}
|
||||
|
||||
// IDIn applies the In predicate on the ID field.
|
||||
func IDIn(ids ...int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDNotIn applies the NotIn predicate on the ID field.
|
||||
func IDNotIn(ids ...int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotIn(FieldID, ids...))
|
||||
}
|
||||
|
||||
// IDGT applies the GT predicate on the ID field.
|
||||
func IDGT(id int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDGTE applies the GTE predicate on the ID field.
|
||||
func IDGTE(id int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGTE(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLT applies the LT predicate on the ID field.
|
||||
func IDLT(id int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLT(FieldID, id))
|
||||
}
|
||||
|
||||
// IDLTE applies the LTE predicate on the ID field.
|
||||
func IDLTE(id int64) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLTE(FieldID, id))
|
||||
}
|
||||
|
||||
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||||
func CreatedAt(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
|
||||
func UpdatedAt(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
||||
func Name(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ.
|
||||
func Description(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldDescription, v))
|
||||
}
|
||||
|
||||
// BodyOverrideMode applies equality check predicate on the "body_override_mode" field. It's identical to BodyOverrideModeEQ.
|
||||
func BodyOverrideMode(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||||
func CreatedAtEQ(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||||
func CreatedAtNEQ(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNEQ(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||||
func CreatedAtIn(vs ...time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||||
func CreatedAtNotIn(vs ...time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotIn(FieldCreatedAt, vs...))
|
||||
}
|
||||
|
||||
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||||
func CreatedAtGT(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||||
func CreatedAtGTE(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||||
func CreatedAtLT(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLT(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||||
func CreatedAtLTE(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLTE(FieldCreatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||||
func UpdatedAtEQ(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||||
func UpdatedAtNEQ(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNEQ(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||||
func UpdatedAtIn(vs ...time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||||
func UpdatedAtNotIn(vs ...time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotIn(FieldUpdatedAt, vs...))
|
||||
}
|
||||
|
||||
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||||
func UpdatedAtGT(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||||
func UpdatedAtGTE(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||||
func UpdatedAtLT(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLT(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||||
func UpdatedAtLTE(v time.Time) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLTE(FieldUpdatedAt, v))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// NameNEQ applies the NEQ predicate on the "name" field.
|
||||
func NameNEQ(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNEQ(FieldName, v))
|
||||
}
|
||||
|
||||
// NameIn applies the In predicate on the "name" field.
|
||||
func NameIn(vs ...string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIn(FieldName, vs...))
|
||||
}
|
||||
|
||||
// NameNotIn applies the NotIn predicate on the "name" field.
|
||||
func NameNotIn(vs ...string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotIn(FieldName, vs...))
|
||||
}
|
||||
|
||||
// NameGT applies the GT predicate on the "name" field.
|
||||
func NameGT(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGT(FieldName, v))
|
||||
}
|
||||
|
||||
// NameGTE applies the GTE predicate on the "name" field.
|
||||
func NameGTE(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGTE(FieldName, v))
|
||||
}
|
||||
|
||||
// NameLT applies the LT predicate on the "name" field.
|
||||
func NameLT(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLT(FieldName, v))
|
||||
}
|
||||
|
||||
// NameLTE applies the LTE predicate on the "name" field.
|
||||
func NameLTE(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLTE(FieldName, v))
|
||||
}
|
||||
|
||||
// NameContains applies the Contains predicate on the "name" field.
|
||||
func NameContains(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldContains(FieldName, v))
|
||||
}
|
||||
|
||||
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
|
||||
func NameHasPrefix(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldHasPrefix(FieldName, v))
|
||||
}
|
||||
|
||||
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
|
||||
func NameHasSuffix(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldHasSuffix(FieldName, v))
|
||||
}
|
||||
|
||||
// NameEqualFold applies the EqualFold predicate on the "name" field.
|
||||
func NameEqualFold(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEqualFold(FieldName, v))
|
||||
}
|
||||
|
||||
// NameContainsFold applies the ContainsFold predicate on the "name" field.
|
||||
func NameContainsFold(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldContainsFold(FieldName, v))
|
||||
}
|
||||
|
||||
// ProviderEQ applies the EQ predicate on the "provider" field.
|
||||
func ProviderEQ(v Provider) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldProvider, v))
|
||||
}
|
||||
|
||||
// ProviderNEQ applies the NEQ predicate on the "provider" field.
|
||||
func ProviderNEQ(v Provider) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNEQ(FieldProvider, v))
|
||||
}
|
||||
|
||||
// ProviderIn applies the In predicate on the "provider" field.
|
||||
func ProviderIn(vs ...Provider) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIn(FieldProvider, vs...))
|
||||
}
|
||||
|
||||
// ProviderNotIn applies the NotIn predicate on the "provider" field.
|
||||
func ProviderNotIn(vs ...Provider) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotIn(FieldProvider, vs...))
|
||||
}
|
||||
|
||||
// DescriptionEQ applies the EQ predicate on the "description" field.
|
||||
func DescriptionEQ(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionNEQ applies the NEQ predicate on the "description" field.
|
||||
func DescriptionNEQ(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNEQ(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionIn applies the In predicate on the "description" field.
|
||||
func DescriptionIn(vs ...string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIn(FieldDescription, vs...))
|
||||
}
|
||||
|
||||
// DescriptionNotIn applies the NotIn predicate on the "description" field.
|
||||
func DescriptionNotIn(vs ...string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotIn(FieldDescription, vs...))
|
||||
}
|
||||
|
||||
// DescriptionGT applies the GT predicate on the "description" field.
|
||||
func DescriptionGT(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGT(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionGTE applies the GTE predicate on the "description" field.
|
||||
func DescriptionGTE(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGTE(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionLT applies the LT predicate on the "description" field.
|
||||
func DescriptionLT(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLT(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionLTE applies the LTE predicate on the "description" field.
|
||||
func DescriptionLTE(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLTE(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionContains applies the Contains predicate on the "description" field.
|
||||
func DescriptionContains(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldContains(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field.
|
||||
func DescriptionHasPrefix(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldHasPrefix(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field.
|
||||
func DescriptionHasSuffix(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldHasSuffix(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionIsNil applies the IsNil predicate on the "description" field.
|
||||
func DescriptionIsNil() predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIsNull(FieldDescription))
|
||||
}
|
||||
|
||||
// DescriptionNotNil applies the NotNil predicate on the "description" field.
|
||||
func DescriptionNotNil() predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotNull(FieldDescription))
|
||||
}
|
||||
|
||||
// DescriptionEqualFold applies the EqualFold predicate on the "description" field.
|
||||
func DescriptionEqualFold(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEqualFold(FieldDescription, v))
|
||||
}
|
||||
|
||||
// DescriptionContainsFold applies the ContainsFold predicate on the "description" field.
|
||||
func DescriptionContainsFold(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldContainsFold(FieldDescription, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeEQ applies the EQ predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeEQ(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEQ(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeNEQ applies the NEQ predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeNEQ(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNEQ(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeIn applies the In predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeIn(vs ...string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIn(FieldBodyOverrideMode, vs...))
|
||||
}
|
||||
|
||||
// BodyOverrideModeNotIn applies the NotIn predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeNotIn(vs ...string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotIn(FieldBodyOverrideMode, vs...))
|
||||
}
|
||||
|
||||
// BodyOverrideModeGT applies the GT predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeGT(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGT(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeGTE applies the GTE predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeGTE(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldGTE(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeLT applies the LT predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeLT(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLT(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeLTE applies the LTE predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeLTE(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldLTE(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeContains applies the Contains predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeContains(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldContains(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeHasPrefix applies the HasPrefix predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeHasPrefix(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldHasPrefix(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeHasSuffix applies the HasSuffix predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeHasSuffix(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldHasSuffix(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeEqualFold applies the EqualFold predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeEqualFold(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldEqualFold(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideModeContainsFold applies the ContainsFold predicate on the "body_override_mode" field.
|
||||
func BodyOverrideModeContainsFold(v string) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldContainsFold(FieldBodyOverrideMode, v))
|
||||
}
|
||||
|
||||
// BodyOverrideIsNil applies the IsNil predicate on the "body_override" field.
|
||||
func BodyOverrideIsNil() predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldIsNull(FieldBodyOverride))
|
||||
}
|
||||
|
||||
// BodyOverrideNotNil applies the NotNil predicate on the "body_override" field.
|
||||
func BodyOverrideNotNil() predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.FieldNotNull(FieldBodyOverride))
|
||||
}
|
||||
|
||||
// HasMonitors applies the HasEdge predicate on the "monitors" edge.
|
||||
func HasMonitors() predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, true, MonitorsTable, MonitorsColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasMonitorsWith applies the HasEdge predicate on the "monitors" edge with a given conditions (other predicates).
|
||||
func HasMonitorsWith(preds ...predicate.ChannelMonitor) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(func(s *sql.Selector) {
|
||||
step := newMonitorsStep()
|
||||
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.ChannelMonitorRequestTemplate) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.AndPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Or groups predicates with the OR operator between them.
|
||||
func Or(predicates ...predicate.ChannelMonitorRequestTemplate) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.OrPredicates(predicates...))
|
||||
}
|
||||
|
||||
// Not applies the not operator on the given predicate.
|
||||
func Not(p predicate.ChannelMonitorRequestTemplate) predicate.ChannelMonitorRequestTemplate {
|
||||
return predicate.ChannelMonitorRequestTemplate(sql.NotPredicates(p))
|
||||
}
|
||||
Reference in New Issue
Block a user