Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
ac114738
Unverified
Commit
ac114738
authored
Apr 24, 2026
by
Wesley Liddick
Committed by
GitHub
Apr 24, 2026
Browse files
Merge pull request #1850 from touwaeriol/feat/channel-insights
feat(monitor): channel monitor with available channels & feature flags
parents
0a80ec80
09fd83ab
Changes
151
Hide whitespace changes
Inline
Side-by-side
backend/cmd/server/wire.go
View file @
ac114738
...
...
@@ -97,6 +97,7 @@ func provideCleanup(
scheduledTestRunner
*
service
.
ScheduledTestRunnerService
,
backupSvc
*
service
.
BackupService
,
paymentOrderExpiry
*
service
.
PaymentOrderExpiryService
,
channelMonitorRunner
*
service
.
ChannelMonitorRunner
,
)
func
()
{
return
func
()
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
...
...
@@ -239,6 +240,12 @@ func provideCleanup(
}
return
nil
}},
{
"ChannelMonitorRunner"
,
func
()
error
{
if
channelMonitorRunner
!=
nil
{
channelMonitorRunner
.
Stop
()
}
return
nil
}},
}
infraSteps
:=
[]
cleanupStep
{
...
...
backend/cmd/server/wire_gen.go
View file @
ac114738
...
...
@@ -176,7 +176,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
claudeTokenProvider
:=
service
.
ProvideClaudeTokenProvider
(
accountRepository
,
geminiTokenCache
,
oAuthService
,
oAuthRefreshAPI
)
digestSessionStore
:=
service
.
NewDigestSessionStore
()
channelRepository
:=
repository
.
NewChannelRepository
(
db
)
channelService
:=
service
.
NewChannelService
(
channelRepository
,
apiKeyAuthCacheInvalidator
)
channelService
:=
service
.
NewChannelService
(
channelRepository
,
groupRepository
,
apiKeyAuthCacheInvalidator
,
pricingService
)
modelPricingResolver
:=
service
.
NewModelPricingResolver
(
channelService
,
billingService
)
balanceNotifyService
:=
service
.
ProvideBalanceNotifyService
(
emailService
,
settingRepository
,
accountRepository
)
gatewayService
:=
service
.
NewGatewayService
(
accountRepository
,
groupRepository
,
usageLogRepository
,
usageBillingRepository
,
userRepository
,
userSubscriptionRepository
,
userGroupRateRepository
,
gatewayCache
,
configConfig
,
schedulerSnapshotService
,
concurrencyService
,
billingService
,
rateLimitService
,
billingCacheService
,
identityService
,
httpUpstream
,
deferredService
,
claudeTokenProvider
,
sessionLimitCache
,
rpmCache
,
digestSessionStore
,
settingService
,
tlsFingerprintProfileService
,
channelService
,
modelPricingResolver
,
balanceNotifyService
)
...
...
@@ -221,8 +221,21 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
scheduledTestService
:=
service
.
ProvideScheduledTestService
(
scheduledTestPlanRepository
,
scheduledTestResultRepository
)
scheduledTestHandler
:=
admin
.
NewScheduledTestHandler
(
scheduledTestService
)
channelHandler
:=
admin
.
NewChannelHandler
(
channelService
,
billingService
)
sqlDB
,
err
:=
repository
.
ProvideSQLDB
(
client
)
if
err
!=
nil
{
return
nil
,
err
}
channelMonitorRepository
:=
repository
.
NewChannelMonitorRepository
(
client
,
sqlDB
)
channelMonitorRequestTemplateRepository
:=
repository
.
NewChannelMonitorRequestTemplateRepository
(
client
,
sqlDB
)
channelMonitorRequestTemplateService
:=
service
.
NewChannelMonitorRequestTemplateService
(
channelMonitorRequestTemplateRepository
)
channelMonitorRequestTemplateHandler
:=
admin
.
NewChannelMonitorRequestTemplateHandler
(
channelMonitorRequestTemplateService
)
channelMonitorService
:=
service
.
ProvideChannelMonitorService
(
channelMonitorRepository
,
secretEncryptor
)
channelMonitorHandler
:=
admin
.
NewChannelMonitorHandler
(
channelMonitorService
)
channelMonitorUserHandler
:=
handler
.
NewChannelMonitorUserHandler
(
channelMonitorService
,
settingService
)
channelMonitorRunner
:=
service
.
ProvideChannelMonitorRunner
(
channelMonitorService
,
settingService
)
paymentHandler
:=
admin
.
NewPaymentHandler
(
paymentService
,
paymentConfigService
)
adminHandlers
:=
handler
.
ProvideAdminHandlers
(
dashboardHandler
,
adminUserHandler
,
groupHandler
,
accountHandler
,
adminAnnouncementHandler
,
dataManagementHandler
,
backupHandler
,
oAuthHandler
,
openAIOAuthHandler
,
geminiOAuthHandler
,
antigravityOAuthHandler
,
proxyHandler
,
adminRedeemHandler
,
promoHandler
,
settingHandler
,
opsHandler
,
systemHandler
,
adminSubscriptionHandler
,
adminUsageHandler
,
userAttributeHandler
,
errorPassthroughHandler
,
tlsFingerprintProfileHandler
,
adminAPIKeyHandler
,
scheduledTestHandler
,
channelHandler
,
paymentHandler
)
availableChannelUserHandler
:=
handler
.
NewAvailableChannelHandler
(
channelService
,
apiKeyService
,
settingService
)
adminHandlers
:=
handler
.
ProvideAdminHandlers
(
dashboardHandler
,
adminUserHandler
,
groupHandler
,
accountHandler
,
adminAnnouncementHandler
,
dataManagementHandler
,
backupHandler
,
oAuthHandler
,
openAIOAuthHandler
,
geminiOAuthHandler
,
antigravityOAuthHandler
,
proxyHandler
,
adminRedeemHandler
,
promoHandler
,
settingHandler
,
opsHandler
,
systemHandler
,
adminSubscriptionHandler
,
adminUsageHandler
,
userAttributeHandler
,
errorPassthroughHandler
,
tlsFingerprintProfileHandler
,
adminAPIKeyHandler
,
scheduledTestHandler
,
channelHandler
,
channelMonitorHandler
,
channelMonitorRequestTemplateHandler
,
paymentHandler
)
usageRecordWorkerPool
:=
service
.
NewUsageRecordWorkerPool
(
configConfig
)
userMsgQueueCache
:=
repository
.
NewUserMsgQueueCache
(
redisClient
)
userMessageQueueService
:=
service
.
ProvideUserMessageQueueService
(
userMsgQueueCache
,
rpmCache
,
configConfig
)
...
...
@@ -234,7 +247,7 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
paymentWebhookHandler
:=
handler
.
NewPaymentWebhookHandler
(
paymentService
,
registry
)
idempotencyCoordinator
:=
service
.
ProvideIdempotencyCoordinator
(
idempotencyRepository
,
configConfig
)
idempotencyCleanupService
:=
service
.
ProvideIdempotencyCleanupService
(
idempotencyRepository
,
configConfig
)
handlers
:=
handler
.
ProvideHandlers
(
authHandler
,
userHandler
,
apiKeyHandler
,
usageHandler
,
redeemHandler
,
subscriptionHandler
,
announcementHandler
,
adminHandlers
,
gatewayHandler
,
openAIGatewayHandler
,
handlerSettingHandler
,
totpHandler
,
handlerPaymentHandler
,
paymentWebhookHandler
,
idempotencyCoordinator
,
idempotencyCleanupService
)
handlers
:=
handler
.
ProvideHandlers
(
authHandler
,
userHandler
,
apiKeyHandler
,
usageHandler
,
redeemHandler
,
subscriptionHandler
,
announcementHandler
,
channelMonitorUserHandler
,
adminHandlers
,
gatewayHandler
,
openAIGatewayHandler
,
handlerSettingHandler
,
totpHandler
,
handlerPaymentHandler
,
paymentWebhookHandler
,
availableChannelUserHandler
,
idempotencyCoordinator
,
idempotencyCleanupService
)
jwtAuthMiddleware
:=
middleware
.
NewJWTAuthMiddleware
(
authService
,
userService
)
adminAuthMiddleware
:=
middleware
.
NewAdminAuthMiddleware
(
authService
,
userService
,
settingService
)
apiKeyAuthMiddleware
:=
middleware
.
NewAPIKeyAuthMiddleware
(
apiKeyService
,
subscriptionService
,
configConfig
)
...
...
@@ -243,14 +256,14 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
opsMetricsCollector
:=
service
.
ProvideOpsMetricsCollector
(
opsRepository
,
settingRepository
,
accountRepository
,
concurrencyService
,
db
,
redisClient
,
configConfig
)
opsAggregationService
:=
service
.
ProvideOpsAggregationService
(
opsRepository
,
settingRepository
,
db
,
redisClient
,
configConfig
)
opsAlertEvaluatorService
:=
service
.
ProvideOpsAlertEvaluatorService
(
opsService
,
opsRepository
,
emailService
,
redisClient
,
configConfig
)
opsCleanupService
:=
service
.
ProvideOpsCleanupService
(
opsRepository
,
db
,
redisClient
,
configConfig
)
opsCleanupService
:=
service
.
ProvideOpsCleanupService
(
opsRepository
,
db
,
redisClient
,
configConfig
,
channelMonitorService
)
opsScheduledReportService
:=
service
.
ProvideOpsScheduledReportService
(
opsService
,
userService
,
emailService
,
redisClient
,
configConfig
)
tokenRefreshService
:=
service
.
ProvideTokenRefreshService
(
accountRepository
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
antigravityOAuthService
,
compositeTokenCacheInvalidator
,
schedulerCache
,
configConfig
,
tempUnschedCache
,
privacyClientFactory
,
proxyRepository
,
oAuthRefreshAPI
)
accountExpiryService
:=
service
.
ProvideAccountExpiryService
(
accountRepository
)
subscriptionExpiryService
:=
service
.
ProvideSubscriptionExpiryService
(
userSubscriptionRepository
)
scheduledTestRunnerService
:=
service
.
ProvideScheduledTestRunnerService
(
scheduledTestPlanRepository
,
scheduledTestService
,
accountTestService
,
rateLimitService
,
configConfig
)
paymentOrderExpiryService
:=
service
.
ProvidePaymentOrderExpiryService
(
paymentService
)
v
:=
provideCleanup
(
client
,
redisClient
,
opsMetricsCollector
,
opsAggregationService
,
opsAlertEvaluatorService
,
opsCleanupService
,
opsScheduledReportService
,
opsSystemLogSink
,
schedulerSnapshotService
,
tokenRefreshService
,
accountExpiryService
,
subscriptionExpiryService
,
usageCleanupService
,
idempotencyCleanupService
,
pricingService
,
emailQueueService
,
billingCacheService
,
usageRecordWorkerPool
,
subscriptionService
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
antigravityOAuthService
,
openAIGatewayService
,
scheduledTestRunnerService
,
backupService
,
paymentOrderExpiryService
)
v
:=
provideCleanup
(
client
,
redisClient
,
opsMetricsCollector
,
opsAggregationService
,
opsAlertEvaluatorService
,
opsCleanupService
,
opsScheduledReportService
,
opsSystemLogSink
,
schedulerSnapshotService
,
tokenRefreshService
,
accountExpiryService
,
subscriptionExpiryService
,
usageCleanupService
,
idempotencyCleanupService
,
pricingService
,
emailQueueService
,
billingCacheService
,
usageRecordWorkerPool
,
subscriptionService
,
oAuthService
,
openAIOAuthService
,
geminiOAuthService
,
antigravityOAuthService
,
openAIGatewayService
,
scheduledTestRunnerService
,
backupService
,
paymentOrderExpiryService
,
channelMonitorRunner
)
application
:=
&
Application
{
Server
:
httpServer
,
Cleanup
:
v
,
...
...
@@ -304,6 +317,7 @@ func provideCleanup(
scheduledTestRunner
*
service
.
ScheduledTestRunnerService
,
backupSvc
*
service
.
BackupService
,
paymentOrderExpiry
*
service
.
PaymentOrderExpiryService
,
channelMonitorRunner
*
service
.
ChannelMonitorRunner
,
)
func
()
{
return
func
()
{
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
...
...
@@ -445,6 +459,12 @@ func provideCleanup(
}
return
nil
}},
{
"ChannelMonitorRunner"
,
func
()
error
{
if
channelMonitorRunner
!=
nil
{
channelMonitorRunner
.
Stop
()
}
return
nil
}},
}
infraSteps
:=
[]
cleanupStep
{
...
...
backend/cmd/server/wire_gen_test.go
View file @
ac114738
...
...
@@ -76,6 +76,7 @@ func TestProvideCleanup_WithMinimalDependencies_NoPanic(t *testing.T) {
nil
,
// scheduledTestRunner
nil
,
// backupSvc
nil
,
// paymentOrderExpiry
nil
,
// channelMonitorRunner
)
require
.
NotPanics
(
t
,
func
()
{
...
...
backend/ent/channelmonitor.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"encoding/json"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorrequesttemplate"
)
// ChannelMonitor is the model entity for the ChannelMonitor schema.
type
ChannelMonitor
struct
{
config
`json:"-"`
// ID of the ent.
ID
int64
`json:"id,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt
time
.
Time
`json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt
time
.
Time
`json:"updated_at,omitempty"`
// Name holds the value of the "name" field.
Name
string
`json:"name,omitempty"`
// Provider holds the value of the "provider" field.
Provider
channelmonitor
.
Provider
`json:"provider,omitempty"`
// Provider base origin, e.g. https://api.openai.com
Endpoint
string
`json:"endpoint,omitempty"`
// AES-256-GCM encrypted API key
APIKeyEncrypted
string
`json:"-"`
// PrimaryModel holds the value of the "primary_model" field.
PrimaryModel
string
`json:"primary_model,omitempty"`
// Additional model names to test alongside primary_model
ExtraModels
[]
string
`json:"extra_models,omitempty"`
// GroupName holds the value of the "group_name" field.
GroupName
string
`json:"group_name,omitempty"`
// Enabled holds the value of the "enabled" field.
Enabled
bool
`json:"enabled,omitempty"`
// IntervalSeconds holds the value of the "interval_seconds" field.
IntervalSeconds
int
`json:"interval_seconds,omitempty"`
// LastCheckedAt holds the value of the "last_checked_at" field.
LastCheckedAt
*
time
.
Time
`json:"last_checked_at,omitempty"`
// CreatedBy holds the value of the "created_by" field.
CreatedBy
int64
`json:"created_by,omitempty"`
// TemplateID holds the value of the "template_id" field.
TemplateID
*
int64
`json:"template_id,omitempty"`
// ExtraHeaders holds the value of the "extra_headers" field.
ExtraHeaders
map
[
string
]
string
`json:"extra_headers,omitempty"`
// BodyOverrideMode holds the value of the "body_override_mode" field.
BodyOverrideMode
string
`json:"body_override_mode,omitempty"`
// BodyOverride holds the value of the "body_override" field.
BodyOverride
map
[
string
]
interface
{}
`json:"body_override,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the ChannelMonitorQuery when eager-loading is set.
Edges
ChannelMonitorEdges
`json:"edges"`
selectValues
sql
.
SelectValues
}
// ChannelMonitorEdges holds the relations/edges for other nodes in the graph.
type
ChannelMonitorEdges
struct
{
// History holds the value of the history edge.
History
[]
*
ChannelMonitorHistory
`json:"history,omitempty"`
// DailyRollups holds the value of the daily_rollups edge.
DailyRollups
[]
*
ChannelMonitorDailyRollup
`json:"daily_rollups,omitempty"`
// RequestTemplate holds the value of the request_template edge.
RequestTemplate
*
ChannelMonitorRequestTemplate
`json:"request_template,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes
[
3
]
bool
}
// HistoryOrErr returns the History value or an error if the edge
// was not loaded in eager-loading.
func
(
e
ChannelMonitorEdges
)
HistoryOrErr
()
([]
*
ChannelMonitorHistory
,
error
)
{
if
e
.
loadedTypes
[
0
]
{
return
e
.
History
,
nil
}
return
nil
,
&
NotLoadedError
{
edge
:
"history"
}
}
// DailyRollupsOrErr returns the DailyRollups value or an error if the edge
// was not loaded in eager-loading.
func
(
e
ChannelMonitorEdges
)
DailyRollupsOrErr
()
([]
*
ChannelMonitorDailyRollup
,
error
)
{
if
e
.
loadedTypes
[
1
]
{
return
e
.
DailyRollups
,
nil
}
return
nil
,
&
NotLoadedError
{
edge
:
"daily_rollups"
}
}
// RequestTemplateOrErr returns the RequestTemplate value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func
(
e
ChannelMonitorEdges
)
RequestTemplateOrErr
()
(
*
ChannelMonitorRequestTemplate
,
error
)
{
if
e
.
RequestTemplate
!=
nil
{
return
e
.
RequestTemplate
,
nil
}
else
if
e
.
loadedTypes
[
2
]
{
return
nil
,
&
NotFoundError
{
label
:
channelmonitorrequesttemplate
.
Label
}
}
return
nil
,
&
NotLoadedError
{
edge
:
"request_template"
}
}
// scanValues returns the types for scanning values from sql.Rows.
func
(
*
ChannelMonitor
)
scanValues
(
columns
[]
string
)
([]
any
,
error
)
{
values
:=
make
([]
any
,
len
(
columns
))
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
channelmonitor
.
FieldExtraModels
,
channelmonitor
.
FieldExtraHeaders
,
channelmonitor
.
FieldBodyOverride
:
values
[
i
]
=
new
([]
byte
)
case
channelmonitor
.
FieldEnabled
:
values
[
i
]
=
new
(
sql
.
NullBool
)
case
channelmonitor
.
FieldID
,
channelmonitor
.
FieldIntervalSeconds
,
channelmonitor
.
FieldCreatedBy
,
channelmonitor
.
FieldTemplateID
:
values
[
i
]
=
new
(
sql
.
NullInt64
)
case
channelmonitor
.
FieldName
,
channelmonitor
.
FieldProvider
,
channelmonitor
.
FieldEndpoint
,
channelmonitor
.
FieldAPIKeyEncrypted
,
channelmonitor
.
FieldPrimaryModel
,
channelmonitor
.
FieldGroupName
,
channelmonitor
.
FieldBodyOverrideMode
:
values
[
i
]
=
new
(
sql
.
NullString
)
case
channelmonitor
.
FieldCreatedAt
,
channelmonitor
.
FieldUpdatedAt
,
channelmonitor
.
FieldLastCheckedAt
:
values
[
i
]
=
new
(
sql
.
NullTime
)
default
:
values
[
i
]
=
new
(
sql
.
UnknownType
)
}
}
return
values
,
nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the ChannelMonitor fields.
func
(
_m
*
ChannelMonitor
)
assignValues
(
columns
[]
string
,
values
[]
any
)
error
{
if
m
,
n
:=
len
(
values
),
len
(
columns
);
m
<
n
{
return
fmt
.
Errorf
(
"mismatch number of scan values: %d != %d"
,
m
,
n
)
}
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
channelmonitor
.
FieldID
:
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
)
if
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field id"
,
value
)
}
_m
.
ID
=
int64
(
value
.
Int64
)
case
channelmonitor
.
FieldCreatedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field created_at"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
CreatedAt
=
value
.
Time
}
case
channelmonitor
.
FieldUpdatedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field updated_at"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
UpdatedAt
=
value
.
Time
}
case
channelmonitor
.
FieldName
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field name"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Name
=
value
.
String
}
case
channelmonitor
.
FieldProvider
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field provider"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Provider
=
channelmonitor
.
Provider
(
value
.
String
)
}
case
channelmonitor
.
FieldEndpoint
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field endpoint"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Endpoint
=
value
.
String
}
case
channelmonitor
.
FieldAPIKeyEncrypted
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field api_key_encrypted"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
APIKeyEncrypted
=
value
.
String
}
case
channelmonitor
.
FieldPrimaryModel
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field primary_model"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
PrimaryModel
=
value
.
String
}
case
channelmonitor
.
FieldExtraModels
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field extra_models"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
ExtraModels
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field extra_models: %w"
,
err
)
}
}
case
channelmonitor
.
FieldGroupName
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field group_name"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
GroupName
=
value
.
String
}
case
channelmonitor
.
FieldEnabled
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullBool
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field enabled"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Enabled
=
value
.
Bool
}
case
channelmonitor
.
FieldIntervalSeconds
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field interval_seconds"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
IntervalSeconds
=
int
(
value
.
Int64
)
}
case
channelmonitor
.
FieldLastCheckedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field last_checked_at"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
LastCheckedAt
=
new
(
time
.
Time
)
*
_m
.
LastCheckedAt
=
value
.
Time
}
case
channelmonitor
.
FieldCreatedBy
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field created_by"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
CreatedBy
=
value
.
Int64
}
case
channelmonitor
.
FieldTemplateID
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field template_id"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
TemplateID
=
new
(
int64
)
*
_m
.
TemplateID
=
value
.
Int64
}
case
channelmonitor
.
FieldExtraHeaders
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field extra_headers"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
ExtraHeaders
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field extra_headers: %w"
,
err
)
}
}
case
channelmonitor
.
FieldBodyOverrideMode
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field body_override_mode"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
BodyOverrideMode
=
value
.
String
}
case
channelmonitor
.
FieldBodyOverride
:
if
value
,
ok
:=
values
[
i
]
.
(
*
[]
byte
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field body_override"
,
values
[
i
])
}
else
if
value
!=
nil
&&
len
(
*
value
)
>
0
{
if
err
:=
json
.
Unmarshal
(
*
value
,
&
_m
.
BodyOverride
);
err
!=
nil
{
return
fmt
.
Errorf
(
"unmarshal field body_override: %w"
,
err
)
}
}
default
:
_m
.
selectValues
.
Set
(
columns
[
i
],
values
[
i
])
}
}
return
nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the ChannelMonitor.
// This includes values selected through modifiers, order, etc.
func
(
_m
*
ChannelMonitor
)
Value
(
name
string
)
(
ent
.
Value
,
error
)
{
return
_m
.
selectValues
.
Get
(
name
)
}
// QueryHistory queries the "history" edge of the ChannelMonitor entity.
func
(
_m
*
ChannelMonitor
)
QueryHistory
()
*
ChannelMonitorHistoryQuery
{
return
NewChannelMonitorClient
(
_m
.
config
)
.
QueryHistory
(
_m
)
}
// QueryDailyRollups queries the "daily_rollups" edge of the ChannelMonitor entity.
func
(
_m
*
ChannelMonitor
)
QueryDailyRollups
()
*
ChannelMonitorDailyRollupQuery
{
return
NewChannelMonitorClient
(
_m
.
config
)
.
QueryDailyRollups
(
_m
)
}
// QueryRequestTemplate queries the "request_template" edge of the ChannelMonitor entity.
func
(
_m
*
ChannelMonitor
)
QueryRequestTemplate
()
*
ChannelMonitorRequestTemplateQuery
{
return
NewChannelMonitorClient
(
_m
.
config
)
.
QueryRequestTemplate
(
_m
)
}
// Update returns a builder for updating this ChannelMonitor.
// Note that you need to call ChannelMonitor.Unwrap() before calling this method if this ChannelMonitor
// was returned from a transaction, and the transaction was committed or rolled back.
func
(
_m
*
ChannelMonitor
)
Update
()
*
ChannelMonitorUpdateOne
{
return
NewChannelMonitorClient
(
_m
.
config
)
.
UpdateOne
(
_m
)
}
// Unwrap unwraps the ChannelMonitor entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func
(
_m
*
ChannelMonitor
)
Unwrap
()
*
ChannelMonitor
{
_tx
,
ok
:=
_m
.
config
.
driver
.
(
*
txDriver
)
if
!
ok
{
panic
(
"ent: ChannelMonitor is not a transactional entity"
)
}
_m
.
config
.
driver
=
_tx
.
drv
return
_m
}
// String implements the fmt.Stringer.
func
(
_m
*
ChannelMonitor
)
String
()
string
{
var
builder
strings
.
Builder
builder
.
WriteString
(
"ChannelMonitor("
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"id=%v, "
,
_m
.
ID
))
builder
.
WriteString
(
"created_at="
)
builder
.
WriteString
(
_m
.
CreatedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"updated_at="
)
builder
.
WriteString
(
_m
.
UpdatedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"name="
)
builder
.
WriteString
(
_m
.
Name
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"provider="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
Provider
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"endpoint="
)
builder
.
WriteString
(
_m
.
Endpoint
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"api_key_encrypted=<sensitive>"
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"primary_model="
)
builder
.
WriteString
(
_m
.
PrimaryModel
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"extra_models="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
ExtraModels
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"group_name="
)
builder
.
WriteString
(
_m
.
GroupName
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"enabled="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
Enabled
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"interval_seconds="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
IntervalSeconds
))
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
LastCheckedAt
;
v
!=
nil
{
builder
.
WriteString
(
"last_checked_at="
)
builder
.
WriteString
(
v
.
Format
(
time
.
ANSIC
))
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"created_by="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
CreatedBy
))
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
TemplateID
;
v
!=
nil
{
builder
.
WriteString
(
"template_id="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
*
v
))
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"extra_headers="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
ExtraHeaders
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"body_override_mode="
)
builder
.
WriteString
(
_m
.
BodyOverrideMode
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"body_override="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
BodyOverride
))
builder
.
WriteByte
(
')'
)
return
builder
.
String
()
}
// ChannelMonitors is a parsable slice of ChannelMonitor.
type
ChannelMonitors
[]
*
ChannelMonitor
backend/ent/channelmonitor/channelmonitor.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
channelmonitor
import
(
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const
(
// Label holds the string label denoting the channelmonitor type in the database.
Label
=
"channel_monitor"
// 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"
// FieldEndpoint holds the string denoting the endpoint field in the database.
FieldEndpoint
=
"endpoint"
// FieldAPIKeyEncrypted holds the string denoting the api_key_encrypted field in the database.
FieldAPIKeyEncrypted
=
"api_key_encrypted"
// FieldPrimaryModel holds the string denoting the primary_model field in the database.
FieldPrimaryModel
=
"primary_model"
// FieldExtraModels holds the string denoting the extra_models field in the database.
FieldExtraModels
=
"extra_models"
// FieldGroupName holds the string denoting the group_name field in the database.
FieldGroupName
=
"group_name"
// FieldEnabled holds the string denoting the enabled field in the database.
FieldEnabled
=
"enabled"
// FieldIntervalSeconds holds the string denoting the interval_seconds field in the database.
FieldIntervalSeconds
=
"interval_seconds"
// FieldLastCheckedAt holds the string denoting the last_checked_at field in the database.
FieldLastCheckedAt
=
"last_checked_at"
// FieldCreatedBy holds the string denoting the created_by field in the database.
FieldCreatedBy
=
"created_by"
// FieldTemplateID holds the string denoting the template_id field in the database.
FieldTemplateID
=
"template_id"
// 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"
// EdgeHistory holds the string denoting the history edge name in mutations.
EdgeHistory
=
"history"
// EdgeDailyRollups holds the string denoting the daily_rollups edge name in mutations.
EdgeDailyRollups
=
"daily_rollups"
// EdgeRequestTemplate holds the string denoting the request_template edge name in mutations.
EdgeRequestTemplate
=
"request_template"
// Table holds the table name of the channelmonitor in the database.
Table
=
"channel_monitors"
// HistoryTable is the table that holds the history relation/edge.
HistoryTable
=
"channel_monitor_histories"
// HistoryInverseTable is the table name for the ChannelMonitorHistory entity.
// It exists in this package in order to avoid circular dependency with the "channelmonitorhistory" package.
HistoryInverseTable
=
"channel_monitor_histories"
// HistoryColumn is the table column denoting the history relation/edge.
HistoryColumn
=
"monitor_id"
// DailyRollupsTable is the table that holds the daily_rollups relation/edge.
DailyRollupsTable
=
"channel_monitor_daily_rollups"
// DailyRollupsInverseTable is the table name for the ChannelMonitorDailyRollup entity.
// It exists in this package in order to avoid circular dependency with the "channelmonitordailyrollup" package.
DailyRollupsInverseTable
=
"channel_monitor_daily_rollups"
// DailyRollupsColumn is the table column denoting the daily_rollups relation/edge.
DailyRollupsColumn
=
"monitor_id"
// RequestTemplateTable is the table that holds the request_template relation/edge.
RequestTemplateTable
=
"channel_monitors"
// RequestTemplateInverseTable is the table name for the ChannelMonitorRequestTemplate entity.
// It exists in this package in order to avoid circular dependency with the "channelmonitorrequesttemplate" package.
RequestTemplateInverseTable
=
"channel_monitor_request_templates"
// RequestTemplateColumn is the table column denoting the request_template relation/edge.
RequestTemplateColumn
=
"template_id"
)
// Columns holds all SQL columns for channelmonitor fields.
var
Columns
=
[]
string
{
FieldID
,
FieldCreatedAt
,
FieldUpdatedAt
,
FieldName
,
FieldProvider
,
FieldEndpoint
,
FieldAPIKeyEncrypted
,
FieldPrimaryModel
,
FieldExtraModels
,
FieldGroupName
,
FieldEnabled
,
FieldIntervalSeconds
,
FieldLastCheckedAt
,
FieldCreatedBy
,
FieldTemplateID
,
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
// EndpointValidator is a validator for the "endpoint" field. It is called by the builders before save.
EndpointValidator
func
(
string
)
error
// APIKeyEncryptedValidator is a validator for the "api_key_encrypted" field. It is called by the builders before save.
APIKeyEncryptedValidator
func
(
string
)
error
// PrimaryModelValidator is a validator for the "primary_model" field. It is called by the builders before save.
PrimaryModelValidator
func
(
string
)
error
// DefaultExtraModels holds the default value on creation for the "extra_models" field.
DefaultExtraModels
[]
string
// DefaultGroupName holds the default value on creation for the "group_name" field.
DefaultGroupName
string
// GroupNameValidator is a validator for the "group_name" field. It is called by the builders before save.
GroupNameValidator
func
(
string
)
error
// DefaultEnabled holds the default value on creation for the "enabled" field.
DefaultEnabled
bool
// IntervalSecondsValidator is a validator for the "interval_seconds" field. It is called by the builders before save.
IntervalSecondsValidator
func
(
int
)
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
(
"channelmonitor: invalid enum value for provider field: %q"
,
pr
)
}
}
// OrderOption defines the ordering options for the ChannelMonitor 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
()
}
// ByEndpoint orders the results by the endpoint field.
func
ByEndpoint
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldEndpoint
,
opts
...
)
.
ToFunc
()
}
// ByAPIKeyEncrypted orders the results by the api_key_encrypted field.
func
ByAPIKeyEncrypted
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldAPIKeyEncrypted
,
opts
...
)
.
ToFunc
()
}
// ByPrimaryModel orders the results by the primary_model field.
func
ByPrimaryModel
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldPrimaryModel
,
opts
...
)
.
ToFunc
()
}
// ByGroupName orders the results by the group_name field.
func
ByGroupName
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldGroupName
,
opts
...
)
.
ToFunc
()
}
// ByEnabled orders the results by the enabled field.
func
ByEnabled
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldEnabled
,
opts
...
)
.
ToFunc
()
}
// ByIntervalSeconds orders the results by the interval_seconds field.
func
ByIntervalSeconds
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldIntervalSeconds
,
opts
...
)
.
ToFunc
()
}
// ByLastCheckedAt orders the results by the last_checked_at field.
func
ByLastCheckedAt
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldLastCheckedAt
,
opts
...
)
.
ToFunc
()
}
// ByCreatedBy orders the results by the created_by field.
func
ByCreatedBy
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldCreatedBy
,
opts
...
)
.
ToFunc
()
}
// ByTemplateID orders the results by the template_id field.
func
ByTemplateID
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldTemplateID
,
opts
...
)
.
ToFunc
()
}
// ByBodyOverrideMode orders the results by the body_override_mode field.
func
ByBodyOverrideMode
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldBodyOverrideMode
,
opts
...
)
.
ToFunc
()
}
// ByHistoryCount orders the results by history count.
func
ByHistoryCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
func
(
s
*
sql
.
Selector
)
{
sqlgraph
.
OrderByNeighborsCount
(
s
,
newHistoryStep
(),
opts
...
)
}
}
// ByHistory orders the results by history terms.
func
ByHistory
(
term
sql
.
OrderTerm
,
terms
...
sql
.
OrderTerm
)
OrderOption
{
return
func
(
s
*
sql
.
Selector
)
{
sqlgraph
.
OrderByNeighborTerms
(
s
,
newHistoryStep
(),
append
([]
sql
.
OrderTerm
{
term
},
terms
...
)
...
)
}
}
// ByDailyRollupsCount orders the results by daily_rollups count.
func
ByDailyRollupsCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
func
(
s
*
sql
.
Selector
)
{
sqlgraph
.
OrderByNeighborsCount
(
s
,
newDailyRollupsStep
(),
opts
...
)
}
}
// ByDailyRollups orders the results by daily_rollups terms.
func
ByDailyRollups
(
term
sql
.
OrderTerm
,
terms
...
sql
.
OrderTerm
)
OrderOption
{
return
func
(
s
*
sql
.
Selector
)
{
sqlgraph
.
OrderByNeighborTerms
(
s
,
newDailyRollupsStep
(),
append
([]
sql
.
OrderTerm
{
term
},
terms
...
)
...
)
}
}
// ByRequestTemplateField orders the results by request_template field.
func
ByRequestTemplateField
(
field
string
,
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
func
(
s
*
sql
.
Selector
)
{
sqlgraph
.
OrderByNeighborTerms
(
s
,
newRequestTemplateStep
(),
sql
.
OrderByField
(
field
,
opts
...
))
}
}
func
newHistoryStep
()
*
sqlgraph
.
Step
{
return
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
Table
,
FieldID
),
sqlgraph
.
To
(
HistoryInverseTable
,
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
O2M
,
false
,
HistoryTable
,
HistoryColumn
),
)
}
func
newDailyRollupsStep
()
*
sqlgraph
.
Step
{
return
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
Table
,
FieldID
),
sqlgraph
.
To
(
DailyRollupsInverseTable
,
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
O2M
,
false
,
DailyRollupsTable
,
DailyRollupsColumn
),
)
}
func
newRequestTemplateStep
()
*
sqlgraph
.
Step
{
return
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
Table
,
FieldID
),
sqlgraph
.
To
(
RequestTemplateInverseTable
,
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
M2O
,
false
,
RequestTemplateTable
,
RequestTemplateColumn
),
)
}
backend/ent/channelmonitor/where.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
channelmonitor
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
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDEQ applies the EQ predicate on the ID field.
func
IDEQ
(
id
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDNEQ applies the NEQ predicate on the ID field.
func
IDNEQ
(
id
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldID
,
id
))
}
// IDIn applies the In predicate on the ID field.
func
IDIn
(
ids
...
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldID
,
ids
...
))
}
// IDNotIn applies the NotIn predicate on the ID field.
func
IDNotIn
(
ids
...
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldID
,
ids
...
))
}
// IDGT applies the GT predicate on the ID field.
func
IDGT
(
id
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldID
,
id
))
}
// IDGTE applies the GTE predicate on the ID field.
func
IDGTE
(
id
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldID
,
id
))
}
// IDLT applies the LT predicate on the ID field.
func
IDLT
(
id
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldID
,
id
))
}
// IDLTE applies the LTE predicate on the ID field.
func
IDLTE
(
id
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
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
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
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
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldUpdatedAt
,
v
))
}
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
func
Name
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldName
,
v
))
}
// Endpoint applies equality check predicate on the "endpoint" field. It's identical to EndpointEQ.
func
Endpoint
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldEndpoint
,
v
))
}
// APIKeyEncrypted applies equality check predicate on the "api_key_encrypted" field. It's identical to APIKeyEncryptedEQ.
func
APIKeyEncrypted
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldAPIKeyEncrypted
,
v
))
}
// PrimaryModel applies equality check predicate on the "primary_model" field. It's identical to PrimaryModelEQ.
func
PrimaryModel
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldPrimaryModel
,
v
))
}
// GroupName applies equality check predicate on the "group_name" field. It's identical to GroupNameEQ.
func
GroupName
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldGroupName
,
v
))
}
// Enabled applies equality check predicate on the "enabled" field. It's identical to EnabledEQ.
func
Enabled
(
v
bool
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldEnabled
,
v
))
}
// IntervalSeconds applies equality check predicate on the "interval_seconds" field. It's identical to IntervalSecondsEQ.
func
IntervalSeconds
(
v
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldIntervalSeconds
,
v
))
}
// LastCheckedAt applies equality check predicate on the "last_checked_at" field. It's identical to LastCheckedAtEQ.
func
LastCheckedAt
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldLastCheckedAt
,
v
))
}
// CreatedBy applies equality check predicate on the "created_by" field. It's identical to CreatedByEQ.
func
CreatedBy
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldCreatedBy
,
v
))
}
// TemplateID applies equality check predicate on the "template_id" field. It's identical to TemplateIDEQ.
func
TemplateID
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldTemplateID
,
v
))
}
// BodyOverrideMode applies equality check predicate on the "body_override_mode" field. It's identical to BodyOverrideModeEQ.
func
BodyOverrideMode
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldBodyOverrideMode
,
v
))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func
CreatedAtEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func
CreatedAtNEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldCreatedAt
,
v
))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func
CreatedAtIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldCreatedAt
,
vs
...
))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func
CreatedAtNotIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldCreatedAt
,
vs
...
))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func
CreatedAtGT
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldCreatedAt
,
v
))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func
CreatedAtGTE
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldCreatedAt
,
v
))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func
CreatedAtLT
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldCreatedAt
,
v
))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func
CreatedAtLTE
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldCreatedAt
,
v
))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func
UpdatedAtEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func
UpdatedAtNEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func
UpdatedAtIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldUpdatedAt
,
vs
...
))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func
UpdatedAtNotIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldUpdatedAt
,
vs
...
))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func
UpdatedAtGT
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func
UpdatedAtGTE
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func
UpdatedAtLT
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldUpdatedAt
,
v
))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func
UpdatedAtLTE
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldUpdatedAt
,
v
))
}
// NameEQ applies the EQ predicate on the "name" field.
func
NameEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldName
,
v
))
}
// NameNEQ applies the NEQ predicate on the "name" field.
func
NameNEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldName
,
v
))
}
// NameIn applies the In predicate on the "name" field.
func
NameIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldName
,
vs
...
))
}
// NameNotIn applies the NotIn predicate on the "name" field.
func
NameNotIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldName
,
vs
...
))
}
// NameGT applies the GT predicate on the "name" field.
func
NameGT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldName
,
v
))
}
// NameGTE applies the GTE predicate on the "name" field.
func
NameGTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldName
,
v
))
}
// NameLT applies the LT predicate on the "name" field.
func
NameLT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldName
,
v
))
}
// NameLTE applies the LTE predicate on the "name" field.
func
NameLTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldName
,
v
))
}
// NameContains applies the Contains predicate on the "name" field.
func
NameContains
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContains
(
FieldName
,
v
))
}
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
func
NameHasPrefix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasPrefix
(
FieldName
,
v
))
}
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
func
NameHasSuffix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasSuffix
(
FieldName
,
v
))
}
// NameEqualFold applies the EqualFold predicate on the "name" field.
func
NameEqualFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEqualFold
(
FieldName
,
v
))
}
// NameContainsFold applies the ContainsFold predicate on the "name" field.
func
NameContainsFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContainsFold
(
FieldName
,
v
))
}
// ProviderEQ applies the EQ predicate on the "provider" field.
func
ProviderEQ
(
v
Provider
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldProvider
,
v
))
}
// ProviderNEQ applies the NEQ predicate on the "provider" field.
func
ProviderNEQ
(
v
Provider
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldProvider
,
v
))
}
// ProviderIn applies the In predicate on the "provider" field.
func
ProviderIn
(
vs
...
Provider
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldProvider
,
vs
...
))
}
// ProviderNotIn applies the NotIn predicate on the "provider" field.
func
ProviderNotIn
(
vs
...
Provider
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldProvider
,
vs
...
))
}
// EndpointEQ applies the EQ predicate on the "endpoint" field.
func
EndpointEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldEndpoint
,
v
))
}
// EndpointNEQ applies the NEQ predicate on the "endpoint" field.
func
EndpointNEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldEndpoint
,
v
))
}
// EndpointIn applies the In predicate on the "endpoint" field.
func
EndpointIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldEndpoint
,
vs
...
))
}
// EndpointNotIn applies the NotIn predicate on the "endpoint" field.
func
EndpointNotIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldEndpoint
,
vs
...
))
}
// EndpointGT applies the GT predicate on the "endpoint" field.
func
EndpointGT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldEndpoint
,
v
))
}
// EndpointGTE applies the GTE predicate on the "endpoint" field.
func
EndpointGTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldEndpoint
,
v
))
}
// EndpointLT applies the LT predicate on the "endpoint" field.
func
EndpointLT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldEndpoint
,
v
))
}
// EndpointLTE applies the LTE predicate on the "endpoint" field.
func
EndpointLTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldEndpoint
,
v
))
}
// EndpointContains applies the Contains predicate on the "endpoint" field.
func
EndpointContains
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContains
(
FieldEndpoint
,
v
))
}
// EndpointHasPrefix applies the HasPrefix predicate on the "endpoint" field.
func
EndpointHasPrefix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasPrefix
(
FieldEndpoint
,
v
))
}
// EndpointHasSuffix applies the HasSuffix predicate on the "endpoint" field.
func
EndpointHasSuffix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasSuffix
(
FieldEndpoint
,
v
))
}
// EndpointEqualFold applies the EqualFold predicate on the "endpoint" field.
func
EndpointEqualFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEqualFold
(
FieldEndpoint
,
v
))
}
// EndpointContainsFold applies the ContainsFold predicate on the "endpoint" field.
func
EndpointContainsFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContainsFold
(
FieldEndpoint
,
v
))
}
// APIKeyEncryptedEQ applies the EQ predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedNEQ applies the NEQ predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedNEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedIn applies the In predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldAPIKeyEncrypted
,
vs
...
))
}
// APIKeyEncryptedNotIn applies the NotIn predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedNotIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldAPIKeyEncrypted
,
vs
...
))
}
// APIKeyEncryptedGT applies the GT predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedGT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedGTE applies the GTE predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedGTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedLT applies the LT predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedLT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedLTE applies the LTE predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedLTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedContains applies the Contains predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedContains
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContains
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedHasPrefix applies the HasPrefix predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedHasPrefix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasPrefix
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedHasSuffix applies the HasSuffix predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedHasSuffix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasSuffix
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedEqualFold applies the EqualFold predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedEqualFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEqualFold
(
FieldAPIKeyEncrypted
,
v
))
}
// APIKeyEncryptedContainsFold applies the ContainsFold predicate on the "api_key_encrypted" field.
func
APIKeyEncryptedContainsFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContainsFold
(
FieldAPIKeyEncrypted
,
v
))
}
// PrimaryModelEQ applies the EQ predicate on the "primary_model" field.
func
PrimaryModelEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelNEQ applies the NEQ predicate on the "primary_model" field.
func
PrimaryModelNEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelIn applies the In predicate on the "primary_model" field.
func
PrimaryModelIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldPrimaryModel
,
vs
...
))
}
// PrimaryModelNotIn applies the NotIn predicate on the "primary_model" field.
func
PrimaryModelNotIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldPrimaryModel
,
vs
...
))
}
// PrimaryModelGT applies the GT predicate on the "primary_model" field.
func
PrimaryModelGT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelGTE applies the GTE predicate on the "primary_model" field.
func
PrimaryModelGTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelLT applies the LT predicate on the "primary_model" field.
func
PrimaryModelLT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelLTE applies the LTE predicate on the "primary_model" field.
func
PrimaryModelLTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelContains applies the Contains predicate on the "primary_model" field.
func
PrimaryModelContains
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContains
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelHasPrefix applies the HasPrefix predicate on the "primary_model" field.
func
PrimaryModelHasPrefix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasPrefix
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelHasSuffix applies the HasSuffix predicate on the "primary_model" field.
func
PrimaryModelHasSuffix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasSuffix
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelEqualFold applies the EqualFold predicate on the "primary_model" field.
func
PrimaryModelEqualFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEqualFold
(
FieldPrimaryModel
,
v
))
}
// PrimaryModelContainsFold applies the ContainsFold predicate on the "primary_model" field.
func
PrimaryModelContainsFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContainsFold
(
FieldPrimaryModel
,
v
))
}
// GroupNameEQ applies the EQ predicate on the "group_name" field.
func
GroupNameEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldGroupName
,
v
))
}
// GroupNameNEQ applies the NEQ predicate on the "group_name" field.
func
GroupNameNEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldGroupName
,
v
))
}
// GroupNameIn applies the In predicate on the "group_name" field.
func
GroupNameIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldGroupName
,
vs
...
))
}
// GroupNameNotIn applies the NotIn predicate on the "group_name" field.
func
GroupNameNotIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldGroupName
,
vs
...
))
}
// GroupNameGT applies the GT predicate on the "group_name" field.
func
GroupNameGT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldGroupName
,
v
))
}
// GroupNameGTE applies the GTE predicate on the "group_name" field.
func
GroupNameGTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldGroupName
,
v
))
}
// GroupNameLT applies the LT predicate on the "group_name" field.
func
GroupNameLT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldGroupName
,
v
))
}
// GroupNameLTE applies the LTE predicate on the "group_name" field.
func
GroupNameLTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldGroupName
,
v
))
}
// GroupNameContains applies the Contains predicate on the "group_name" field.
func
GroupNameContains
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContains
(
FieldGroupName
,
v
))
}
// GroupNameHasPrefix applies the HasPrefix predicate on the "group_name" field.
func
GroupNameHasPrefix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasPrefix
(
FieldGroupName
,
v
))
}
// GroupNameHasSuffix applies the HasSuffix predicate on the "group_name" field.
func
GroupNameHasSuffix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasSuffix
(
FieldGroupName
,
v
))
}
// GroupNameIsNil applies the IsNil predicate on the "group_name" field.
func
GroupNameIsNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIsNull
(
FieldGroupName
))
}
// GroupNameNotNil applies the NotNil predicate on the "group_name" field.
func
GroupNameNotNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotNull
(
FieldGroupName
))
}
// GroupNameEqualFold applies the EqualFold predicate on the "group_name" field.
func
GroupNameEqualFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEqualFold
(
FieldGroupName
,
v
))
}
// GroupNameContainsFold applies the ContainsFold predicate on the "group_name" field.
func
GroupNameContainsFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContainsFold
(
FieldGroupName
,
v
))
}
// EnabledEQ applies the EQ predicate on the "enabled" field.
func
EnabledEQ
(
v
bool
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldEnabled
,
v
))
}
// EnabledNEQ applies the NEQ predicate on the "enabled" field.
func
EnabledNEQ
(
v
bool
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldEnabled
,
v
))
}
// IntervalSecondsEQ applies the EQ predicate on the "interval_seconds" field.
func
IntervalSecondsEQ
(
v
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldIntervalSeconds
,
v
))
}
// IntervalSecondsNEQ applies the NEQ predicate on the "interval_seconds" field.
func
IntervalSecondsNEQ
(
v
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldIntervalSeconds
,
v
))
}
// IntervalSecondsIn applies the In predicate on the "interval_seconds" field.
func
IntervalSecondsIn
(
vs
...
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldIntervalSeconds
,
vs
...
))
}
// IntervalSecondsNotIn applies the NotIn predicate on the "interval_seconds" field.
func
IntervalSecondsNotIn
(
vs
...
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldIntervalSeconds
,
vs
...
))
}
// IntervalSecondsGT applies the GT predicate on the "interval_seconds" field.
func
IntervalSecondsGT
(
v
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldIntervalSeconds
,
v
))
}
// IntervalSecondsGTE applies the GTE predicate on the "interval_seconds" field.
func
IntervalSecondsGTE
(
v
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldIntervalSeconds
,
v
))
}
// IntervalSecondsLT applies the LT predicate on the "interval_seconds" field.
func
IntervalSecondsLT
(
v
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldIntervalSeconds
,
v
))
}
// IntervalSecondsLTE applies the LTE predicate on the "interval_seconds" field.
func
IntervalSecondsLTE
(
v
int
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldIntervalSeconds
,
v
))
}
// LastCheckedAtEQ applies the EQ predicate on the "last_checked_at" field.
func
LastCheckedAtEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldLastCheckedAt
,
v
))
}
// LastCheckedAtNEQ applies the NEQ predicate on the "last_checked_at" field.
func
LastCheckedAtNEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldLastCheckedAt
,
v
))
}
// LastCheckedAtIn applies the In predicate on the "last_checked_at" field.
func
LastCheckedAtIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldLastCheckedAt
,
vs
...
))
}
// LastCheckedAtNotIn applies the NotIn predicate on the "last_checked_at" field.
func
LastCheckedAtNotIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldLastCheckedAt
,
vs
...
))
}
// LastCheckedAtGT applies the GT predicate on the "last_checked_at" field.
func
LastCheckedAtGT
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldLastCheckedAt
,
v
))
}
// LastCheckedAtGTE applies the GTE predicate on the "last_checked_at" field.
func
LastCheckedAtGTE
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldLastCheckedAt
,
v
))
}
// LastCheckedAtLT applies the LT predicate on the "last_checked_at" field.
func
LastCheckedAtLT
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldLastCheckedAt
,
v
))
}
// LastCheckedAtLTE applies the LTE predicate on the "last_checked_at" field.
func
LastCheckedAtLTE
(
v
time
.
Time
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldLastCheckedAt
,
v
))
}
// LastCheckedAtIsNil applies the IsNil predicate on the "last_checked_at" field.
func
LastCheckedAtIsNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIsNull
(
FieldLastCheckedAt
))
}
// LastCheckedAtNotNil applies the NotNil predicate on the "last_checked_at" field.
func
LastCheckedAtNotNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotNull
(
FieldLastCheckedAt
))
}
// CreatedByEQ applies the EQ predicate on the "created_by" field.
func
CreatedByEQ
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldCreatedBy
,
v
))
}
// CreatedByNEQ applies the NEQ predicate on the "created_by" field.
func
CreatedByNEQ
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldCreatedBy
,
v
))
}
// CreatedByIn applies the In predicate on the "created_by" field.
func
CreatedByIn
(
vs
...
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldCreatedBy
,
vs
...
))
}
// CreatedByNotIn applies the NotIn predicate on the "created_by" field.
func
CreatedByNotIn
(
vs
...
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldCreatedBy
,
vs
...
))
}
// CreatedByGT applies the GT predicate on the "created_by" field.
func
CreatedByGT
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldCreatedBy
,
v
))
}
// CreatedByGTE applies the GTE predicate on the "created_by" field.
func
CreatedByGTE
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldCreatedBy
,
v
))
}
// CreatedByLT applies the LT predicate on the "created_by" field.
func
CreatedByLT
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldCreatedBy
,
v
))
}
// CreatedByLTE applies the LTE predicate on the "created_by" field.
func
CreatedByLTE
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldCreatedBy
,
v
))
}
// TemplateIDEQ applies the EQ predicate on the "template_id" field.
func
TemplateIDEQ
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldTemplateID
,
v
))
}
// TemplateIDNEQ applies the NEQ predicate on the "template_id" field.
func
TemplateIDNEQ
(
v
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldTemplateID
,
v
))
}
// TemplateIDIn applies the In predicate on the "template_id" field.
func
TemplateIDIn
(
vs
...
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldTemplateID
,
vs
...
))
}
// TemplateIDNotIn applies the NotIn predicate on the "template_id" field.
func
TemplateIDNotIn
(
vs
...
int64
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldTemplateID
,
vs
...
))
}
// TemplateIDIsNil applies the IsNil predicate on the "template_id" field.
func
TemplateIDIsNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIsNull
(
FieldTemplateID
))
}
// TemplateIDNotNil applies the NotNil predicate on the "template_id" field.
func
TemplateIDNotNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotNull
(
FieldTemplateID
))
}
// BodyOverrideModeEQ applies the EQ predicate on the "body_override_mode" field.
func
BodyOverrideModeEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEQ
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeNEQ applies the NEQ predicate on the "body_override_mode" field.
func
BodyOverrideModeNEQ
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNEQ
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeIn applies the In predicate on the "body_override_mode" field.
func
BodyOverrideModeIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIn
(
FieldBodyOverrideMode
,
vs
...
))
}
// BodyOverrideModeNotIn applies the NotIn predicate on the "body_override_mode" field.
func
BodyOverrideModeNotIn
(
vs
...
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotIn
(
FieldBodyOverrideMode
,
vs
...
))
}
// BodyOverrideModeGT applies the GT predicate on the "body_override_mode" field.
func
BodyOverrideModeGT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGT
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeGTE applies the GTE predicate on the "body_override_mode" field.
func
BodyOverrideModeGTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldGTE
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeLT applies the LT predicate on the "body_override_mode" field.
func
BodyOverrideModeLT
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLT
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeLTE applies the LTE predicate on the "body_override_mode" field.
func
BodyOverrideModeLTE
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldLTE
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeContains applies the Contains predicate on the "body_override_mode" field.
func
BodyOverrideModeContains
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContains
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeHasPrefix applies the HasPrefix predicate on the "body_override_mode" field.
func
BodyOverrideModeHasPrefix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasPrefix
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeHasSuffix applies the HasSuffix predicate on the "body_override_mode" field.
func
BodyOverrideModeHasSuffix
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldHasSuffix
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeEqualFold applies the EqualFold predicate on the "body_override_mode" field.
func
BodyOverrideModeEqualFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldEqualFold
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideModeContainsFold applies the ContainsFold predicate on the "body_override_mode" field.
func
BodyOverrideModeContainsFold
(
v
string
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldContainsFold
(
FieldBodyOverrideMode
,
v
))
}
// BodyOverrideIsNil applies the IsNil predicate on the "body_override" field.
func
BodyOverrideIsNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldIsNull
(
FieldBodyOverride
))
}
// BodyOverrideNotNil applies the NotNil predicate on the "body_override" field.
func
BodyOverrideNotNil
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
FieldNotNull
(
FieldBodyOverride
))
}
// HasHistory applies the HasEdge predicate on the "history" edge.
func
HasHistory
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
func
(
s
*
sql
.
Selector
)
{
step
:=
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
Table
,
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
O2M
,
false
,
HistoryTable
,
HistoryColumn
),
)
sqlgraph
.
HasNeighbors
(
s
,
step
)
})
}
// HasHistoryWith applies the HasEdge predicate on the "history" edge with a given conditions (other predicates).
func
HasHistoryWith
(
preds
...
predicate
.
ChannelMonitorHistory
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
func
(
s
*
sql
.
Selector
)
{
step
:=
newHistoryStep
()
sqlgraph
.
HasNeighborsWith
(
s
,
step
,
func
(
s
*
sql
.
Selector
)
{
for
_
,
p
:=
range
preds
{
p
(
s
)
}
})
})
}
// HasDailyRollups applies the HasEdge predicate on the "daily_rollups" edge.
func
HasDailyRollups
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
func
(
s
*
sql
.
Selector
)
{
step
:=
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
Table
,
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
O2M
,
false
,
DailyRollupsTable
,
DailyRollupsColumn
),
)
sqlgraph
.
HasNeighbors
(
s
,
step
)
})
}
// HasDailyRollupsWith applies the HasEdge predicate on the "daily_rollups" edge with a given conditions (other predicates).
func
HasDailyRollupsWith
(
preds
...
predicate
.
ChannelMonitorDailyRollup
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
func
(
s
*
sql
.
Selector
)
{
step
:=
newDailyRollupsStep
()
sqlgraph
.
HasNeighborsWith
(
s
,
step
,
func
(
s
*
sql
.
Selector
)
{
for
_
,
p
:=
range
preds
{
p
(
s
)
}
})
})
}
// HasRequestTemplate applies the HasEdge predicate on the "request_template" edge.
func
HasRequestTemplate
()
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
func
(
s
*
sql
.
Selector
)
{
step
:=
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
Table
,
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
M2O
,
false
,
RequestTemplateTable
,
RequestTemplateColumn
),
)
sqlgraph
.
HasNeighbors
(
s
,
step
)
})
}
// HasRequestTemplateWith applies the HasEdge predicate on the "request_template" edge with a given conditions (other predicates).
func
HasRequestTemplateWith
(
preds
...
predicate
.
ChannelMonitorRequestTemplate
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
func
(
s
*
sql
.
Selector
)
{
step
:=
newRequestTemplateStep
()
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
.
ChannelMonitor
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
AndPredicates
(
predicates
...
))
}
// Or groups predicates with the OR operator between them.
func
Or
(
predicates
...
predicate
.
ChannelMonitor
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
OrPredicates
(
predicates
...
))
}
// Not applies the not operator on the given predicate.
func
Not
(
p
predicate
.
ChannelMonitor
)
predicate
.
ChannelMonitor
{
return
predicate
.
ChannelMonitor
(
sql
.
NotPredicates
(
p
))
}
backend/ent/channelmonitor_create.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorrequesttemplate"
)
// ChannelMonitorCreate is the builder for creating a ChannelMonitor entity.
type
ChannelMonitorCreate
struct
{
config
mutation
*
ChannelMonitorMutation
hooks
[]
Hook
conflict
[]
sql
.
ConflictOption
}
// SetCreatedAt sets the "created_at" field.
func
(
_c
*
ChannelMonitorCreate
)
SetCreatedAt
(
v
time
.
Time
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetCreatedAt
(
v
)
return
_c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableCreatedAt
(
v
*
time
.
Time
)
*
ChannelMonitorCreate
{
if
v
!=
nil
{
_c
.
SetCreatedAt
(
*
v
)
}
return
_c
}
// SetUpdatedAt sets the "updated_at" field.
func
(
_c
*
ChannelMonitorCreate
)
SetUpdatedAt
(
v
time
.
Time
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetUpdatedAt
(
v
)
return
_c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableUpdatedAt
(
v
*
time
.
Time
)
*
ChannelMonitorCreate
{
if
v
!=
nil
{
_c
.
SetUpdatedAt
(
*
v
)
}
return
_c
}
// SetName sets the "name" field.
func
(
_c
*
ChannelMonitorCreate
)
SetName
(
v
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetName
(
v
)
return
_c
}
// SetProvider sets the "provider" field.
func
(
_c
*
ChannelMonitorCreate
)
SetProvider
(
v
channelmonitor
.
Provider
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetProvider
(
v
)
return
_c
}
// SetEndpoint sets the "endpoint" field.
func
(
_c
*
ChannelMonitorCreate
)
SetEndpoint
(
v
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetEndpoint
(
v
)
return
_c
}
// SetAPIKeyEncrypted sets the "api_key_encrypted" field.
func
(
_c
*
ChannelMonitorCreate
)
SetAPIKeyEncrypted
(
v
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetAPIKeyEncrypted
(
v
)
return
_c
}
// SetPrimaryModel sets the "primary_model" field.
func
(
_c
*
ChannelMonitorCreate
)
SetPrimaryModel
(
v
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetPrimaryModel
(
v
)
return
_c
}
// SetExtraModels sets the "extra_models" field.
func
(
_c
*
ChannelMonitorCreate
)
SetExtraModels
(
v
[]
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetExtraModels
(
v
)
return
_c
}
// SetGroupName sets the "group_name" field.
func
(
_c
*
ChannelMonitorCreate
)
SetGroupName
(
v
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetGroupName
(
v
)
return
_c
}
// SetNillableGroupName sets the "group_name" field if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableGroupName
(
v
*
string
)
*
ChannelMonitorCreate
{
if
v
!=
nil
{
_c
.
SetGroupName
(
*
v
)
}
return
_c
}
// SetEnabled sets the "enabled" field.
func
(
_c
*
ChannelMonitorCreate
)
SetEnabled
(
v
bool
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetEnabled
(
v
)
return
_c
}
// SetNillableEnabled sets the "enabled" field if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableEnabled
(
v
*
bool
)
*
ChannelMonitorCreate
{
if
v
!=
nil
{
_c
.
SetEnabled
(
*
v
)
}
return
_c
}
// SetIntervalSeconds sets the "interval_seconds" field.
func
(
_c
*
ChannelMonitorCreate
)
SetIntervalSeconds
(
v
int
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetIntervalSeconds
(
v
)
return
_c
}
// SetLastCheckedAt sets the "last_checked_at" field.
func
(
_c
*
ChannelMonitorCreate
)
SetLastCheckedAt
(
v
time
.
Time
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetLastCheckedAt
(
v
)
return
_c
}
// SetNillableLastCheckedAt sets the "last_checked_at" field if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableLastCheckedAt
(
v
*
time
.
Time
)
*
ChannelMonitorCreate
{
if
v
!=
nil
{
_c
.
SetLastCheckedAt
(
*
v
)
}
return
_c
}
// SetCreatedBy sets the "created_by" field.
func
(
_c
*
ChannelMonitorCreate
)
SetCreatedBy
(
v
int64
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetCreatedBy
(
v
)
return
_c
}
// SetTemplateID sets the "template_id" field.
func
(
_c
*
ChannelMonitorCreate
)
SetTemplateID
(
v
int64
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetTemplateID
(
v
)
return
_c
}
// SetNillableTemplateID sets the "template_id" field if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableTemplateID
(
v
*
int64
)
*
ChannelMonitorCreate
{
if
v
!=
nil
{
_c
.
SetTemplateID
(
*
v
)
}
return
_c
}
// SetExtraHeaders sets the "extra_headers" field.
func
(
_c
*
ChannelMonitorCreate
)
SetExtraHeaders
(
v
map
[
string
]
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetExtraHeaders
(
v
)
return
_c
}
// SetBodyOverrideMode sets the "body_override_mode" field.
func
(
_c
*
ChannelMonitorCreate
)
SetBodyOverrideMode
(
v
string
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetBodyOverrideMode
(
v
)
return
_c
}
// SetNillableBodyOverrideMode sets the "body_override_mode" field if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableBodyOverrideMode
(
v
*
string
)
*
ChannelMonitorCreate
{
if
v
!=
nil
{
_c
.
SetBodyOverrideMode
(
*
v
)
}
return
_c
}
// SetBodyOverride sets the "body_override" field.
func
(
_c
*
ChannelMonitorCreate
)
SetBodyOverride
(
v
map
[
string
]
interface
{})
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetBodyOverride
(
v
)
return
_c
}
// AddHistoryIDs adds the "history" edge to the ChannelMonitorHistory entity by IDs.
func
(
_c
*
ChannelMonitorCreate
)
AddHistoryIDs
(
ids
...
int64
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
AddHistoryIDs
(
ids
...
)
return
_c
}
// AddHistory adds the "history" edges to the ChannelMonitorHistory entity.
func
(
_c
*
ChannelMonitorCreate
)
AddHistory
(
v
...*
ChannelMonitorHistory
)
*
ChannelMonitorCreate
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_c
.
AddHistoryIDs
(
ids
...
)
}
// AddDailyRollupIDs adds the "daily_rollups" edge to the ChannelMonitorDailyRollup entity by IDs.
func
(
_c
*
ChannelMonitorCreate
)
AddDailyRollupIDs
(
ids
...
int64
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
AddDailyRollupIDs
(
ids
...
)
return
_c
}
// AddDailyRollups adds the "daily_rollups" edges to the ChannelMonitorDailyRollup entity.
func
(
_c
*
ChannelMonitorCreate
)
AddDailyRollups
(
v
...*
ChannelMonitorDailyRollup
)
*
ChannelMonitorCreate
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_c
.
AddDailyRollupIDs
(
ids
...
)
}
// SetRequestTemplateID sets the "request_template" edge to the ChannelMonitorRequestTemplate entity by ID.
func
(
_c
*
ChannelMonitorCreate
)
SetRequestTemplateID
(
id
int64
)
*
ChannelMonitorCreate
{
_c
.
mutation
.
SetRequestTemplateID
(
id
)
return
_c
}
// SetNillableRequestTemplateID sets the "request_template" edge to the ChannelMonitorRequestTemplate entity by ID if the given value is not nil.
func
(
_c
*
ChannelMonitorCreate
)
SetNillableRequestTemplateID
(
id
*
int64
)
*
ChannelMonitorCreate
{
if
id
!=
nil
{
_c
=
_c
.
SetRequestTemplateID
(
*
id
)
}
return
_c
}
// SetRequestTemplate sets the "request_template" edge to the ChannelMonitorRequestTemplate entity.
func
(
_c
*
ChannelMonitorCreate
)
SetRequestTemplate
(
v
*
ChannelMonitorRequestTemplate
)
*
ChannelMonitorCreate
{
return
_c
.
SetRequestTemplateID
(
v
.
ID
)
}
// Mutation returns the ChannelMonitorMutation object of the builder.
func
(
_c
*
ChannelMonitorCreate
)
Mutation
()
*
ChannelMonitorMutation
{
return
_c
.
mutation
}
// Save creates the ChannelMonitor in the database.
func
(
_c
*
ChannelMonitorCreate
)
Save
(
ctx
context
.
Context
)
(
*
ChannelMonitor
,
error
)
{
_c
.
defaults
()
return
withHooks
(
ctx
,
_c
.
sqlSave
,
_c
.
mutation
,
_c
.
hooks
)
}
// SaveX calls Save and panics if Save returns an error.
func
(
_c
*
ChannelMonitorCreate
)
SaveX
(
ctx
context
.
Context
)
*
ChannelMonitor
{
v
,
err
:=
_c
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
v
}
// Exec executes the query.
func
(
_c
*
ChannelMonitorCreate
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_c
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_c
*
ChannelMonitorCreate
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_c
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// defaults sets the default values of the builder before save.
func
(
_c
*
ChannelMonitorCreate
)
defaults
()
{
if
_
,
ok
:=
_c
.
mutation
.
CreatedAt
();
!
ok
{
v
:=
channelmonitor
.
DefaultCreatedAt
()
_c
.
mutation
.
SetCreatedAt
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
UpdatedAt
();
!
ok
{
v
:=
channelmonitor
.
DefaultUpdatedAt
()
_c
.
mutation
.
SetUpdatedAt
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
ExtraModels
();
!
ok
{
v
:=
channelmonitor
.
DefaultExtraModels
_c
.
mutation
.
SetExtraModels
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
GroupName
();
!
ok
{
v
:=
channelmonitor
.
DefaultGroupName
_c
.
mutation
.
SetGroupName
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
Enabled
();
!
ok
{
v
:=
channelmonitor
.
DefaultEnabled
_c
.
mutation
.
SetEnabled
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
ExtraHeaders
();
!
ok
{
v
:=
channelmonitor
.
DefaultExtraHeaders
_c
.
mutation
.
SetExtraHeaders
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
BodyOverrideMode
();
!
ok
{
v
:=
channelmonitor
.
DefaultBodyOverrideMode
_c
.
mutation
.
SetBodyOverrideMode
(
v
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_c
*
ChannelMonitorCreate
)
check
()
error
{
if
_
,
ok
:=
_c
.
mutation
.
CreatedAt
();
!
ok
{
return
&
ValidationError
{
Name
:
"created_at"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.created_at"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
UpdatedAt
();
!
ok
{
return
&
ValidationError
{
Name
:
"updated_at"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.updated_at"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
Name
();
!
ok
{
return
&
ValidationError
{
Name
:
"name"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.name"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
Name
();
ok
{
if
err
:=
channelmonitor
.
NameValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"name"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.name": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
Provider
();
!
ok
{
return
&
ValidationError
{
Name
:
"provider"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.provider"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
Provider
();
ok
{
if
err
:=
channelmonitor
.
ProviderValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"provider"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.provider": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
Endpoint
();
!
ok
{
return
&
ValidationError
{
Name
:
"endpoint"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.endpoint"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
Endpoint
();
ok
{
if
err
:=
channelmonitor
.
EndpointValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"endpoint"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.endpoint": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
APIKeyEncrypted
();
!
ok
{
return
&
ValidationError
{
Name
:
"api_key_encrypted"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.api_key_encrypted"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
APIKeyEncrypted
();
ok
{
if
err
:=
channelmonitor
.
APIKeyEncryptedValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"api_key_encrypted"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.api_key_encrypted": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
PrimaryModel
();
!
ok
{
return
&
ValidationError
{
Name
:
"primary_model"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.primary_model"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
PrimaryModel
();
ok
{
if
err
:=
channelmonitor
.
PrimaryModelValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"primary_model"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.primary_model": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
ExtraModels
();
!
ok
{
return
&
ValidationError
{
Name
:
"extra_models"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.extra_models"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
GroupName
();
ok
{
if
err
:=
channelmonitor
.
GroupNameValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"group_name"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.group_name": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
Enabled
();
!
ok
{
return
&
ValidationError
{
Name
:
"enabled"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.enabled"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
IntervalSeconds
();
!
ok
{
return
&
ValidationError
{
Name
:
"interval_seconds"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.interval_seconds"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
IntervalSeconds
();
ok
{
if
err
:=
channelmonitor
.
IntervalSecondsValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"interval_seconds"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.interval_seconds": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
CreatedBy
();
!
ok
{
return
&
ValidationError
{
Name
:
"created_by"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.created_by"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
ExtraHeaders
();
!
ok
{
return
&
ValidationError
{
Name
:
"extra_headers"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.extra_headers"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
BodyOverrideMode
();
!
ok
{
return
&
ValidationError
{
Name
:
"body_override_mode"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitor.body_override_mode"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
BodyOverrideMode
();
ok
{
if
err
:=
channelmonitor
.
BodyOverrideModeValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"body_override_mode"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.body_override_mode": %w`
,
err
)}
}
}
return
nil
}
func
(
_c
*
ChannelMonitorCreate
)
sqlSave
(
ctx
context
.
Context
)
(
*
ChannelMonitor
,
error
)
{
if
err
:=
_c
.
check
();
err
!=
nil
{
return
nil
,
err
}
_node
,
_spec
:=
_c
.
createSpec
()
if
err
:=
sqlgraph
.
CreateNode
(
ctx
,
_c
.
driver
,
_spec
);
err
!=
nil
{
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
nil
,
err
}
id
:=
_spec
.
ID
.
Value
.
(
int64
)
_node
.
ID
=
int64
(
id
)
_c
.
mutation
.
id
=
&
_node
.
ID
_c
.
mutation
.
done
=
true
return
_node
,
nil
}
func
(
_c
*
ChannelMonitorCreate
)
createSpec
()
(
*
ChannelMonitor
,
*
sqlgraph
.
CreateSpec
)
{
var
(
_node
=
&
ChannelMonitor
{
config
:
_c
.
config
}
_spec
=
sqlgraph
.
NewCreateSpec
(
channelmonitor
.
Table
,
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
))
)
_spec
.
OnConflict
=
_c
.
conflict
if
value
,
ok
:=
_c
.
mutation
.
CreatedAt
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldCreatedAt
,
field
.
TypeTime
,
value
)
_node
.
CreatedAt
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
UpdatedAt
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldUpdatedAt
,
field
.
TypeTime
,
value
)
_node
.
UpdatedAt
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
Name
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldName
,
field
.
TypeString
,
value
)
_node
.
Name
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
Provider
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldProvider
,
field
.
TypeEnum
,
value
)
_node
.
Provider
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
Endpoint
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldEndpoint
,
field
.
TypeString
,
value
)
_node
.
Endpoint
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
APIKeyEncrypted
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldAPIKeyEncrypted
,
field
.
TypeString
,
value
)
_node
.
APIKeyEncrypted
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
PrimaryModel
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldPrimaryModel
,
field
.
TypeString
,
value
)
_node
.
PrimaryModel
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
ExtraModels
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldExtraModels
,
field
.
TypeJSON
,
value
)
_node
.
ExtraModels
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
GroupName
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldGroupName
,
field
.
TypeString
,
value
)
_node
.
GroupName
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
Enabled
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldEnabled
,
field
.
TypeBool
,
value
)
_node
.
Enabled
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
IntervalSeconds
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldIntervalSeconds
,
field
.
TypeInt
,
value
)
_node
.
IntervalSeconds
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
LastCheckedAt
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldLastCheckedAt
,
field
.
TypeTime
,
value
)
_node
.
LastCheckedAt
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
CreatedBy
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldCreatedBy
,
field
.
TypeInt64
,
value
)
_node
.
CreatedBy
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
ExtraHeaders
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldExtraHeaders
,
field
.
TypeJSON
,
value
)
_node
.
ExtraHeaders
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
BodyOverrideMode
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldBodyOverrideMode
,
field
.
TypeString
,
value
)
_node
.
BodyOverrideMode
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
BodyOverride
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldBodyOverride
,
field
.
TypeJSON
,
value
)
_node
.
BodyOverride
=
value
}
if
nodes
:=
_c
.
mutation
.
HistoryIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
HistoryTable
,
Columns
:
[]
string
{
channelmonitor
.
HistoryColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorhistory
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
=
append
(
_spec
.
Edges
,
edge
)
}
if
nodes
:=
_c
.
mutation
.
DailyRollupsIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
DailyRollupsTable
,
Columns
:
[]
string
{
channelmonitor
.
DailyRollupsColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
=
append
(
_spec
.
Edges
,
edge
)
}
if
nodes
:=
_c
.
mutation
.
RequestTemplateIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
false
,
Table
:
channelmonitor
.
RequestTemplateTable
,
Columns
:
[]
string
{
channelmonitor
.
RequestTemplateColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorrequesttemplate
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_node
.
TemplateID
=
&
nodes
[
0
]
_spec
.
Edges
=
append
(
_spec
.
Edges
,
edge
)
}
return
_node
,
_spec
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.ChannelMonitor.Create().
// SetCreatedAt(v).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
// sql.ResolveWithNewValues(),
// ).
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.ChannelMonitorUpsert) {
// SetCreatedAt(v+v).
// }).
// Exec(ctx)
func
(
_c
*
ChannelMonitorCreate
)
OnConflict
(
opts
...
sql
.
ConflictOption
)
*
ChannelMonitorUpsertOne
{
_c
.
conflict
=
opts
return
&
ChannelMonitorUpsertOne
{
create
:
_c
,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.ChannelMonitor.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func
(
_c
*
ChannelMonitorCreate
)
OnConflictColumns
(
columns
...
string
)
*
ChannelMonitorUpsertOne
{
_c
.
conflict
=
append
(
_c
.
conflict
,
sql
.
ConflictColumns
(
columns
...
))
return
&
ChannelMonitorUpsertOne
{
create
:
_c
,
}
}
type
(
// ChannelMonitorUpsertOne is the builder for "upsert"-ing
// one ChannelMonitor node.
ChannelMonitorUpsertOne
struct
{
create
*
ChannelMonitorCreate
}
// ChannelMonitorUpsert is the "OnConflict" setter.
ChannelMonitorUpsert
struct
{
*
sql
.
UpdateSet
}
)
// SetUpdatedAt sets the "updated_at" field.
func
(
u
*
ChannelMonitorUpsert
)
SetUpdatedAt
(
v
time
.
Time
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldUpdatedAt
,
v
)
return
u
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateUpdatedAt
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldUpdatedAt
)
return
u
}
// SetName sets the "name" field.
func
(
u
*
ChannelMonitorUpsert
)
SetName
(
v
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldName
,
v
)
return
u
}
// UpdateName sets the "name" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateName
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldName
)
return
u
}
// SetProvider sets the "provider" field.
func
(
u
*
ChannelMonitorUpsert
)
SetProvider
(
v
channelmonitor
.
Provider
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldProvider
,
v
)
return
u
}
// UpdateProvider sets the "provider" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateProvider
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldProvider
)
return
u
}
// SetEndpoint sets the "endpoint" field.
func
(
u
*
ChannelMonitorUpsert
)
SetEndpoint
(
v
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldEndpoint
,
v
)
return
u
}
// UpdateEndpoint sets the "endpoint" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateEndpoint
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldEndpoint
)
return
u
}
// SetAPIKeyEncrypted sets the "api_key_encrypted" field.
func
(
u
*
ChannelMonitorUpsert
)
SetAPIKeyEncrypted
(
v
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldAPIKeyEncrypted
,
v
)
return
u
}
// UpdateAPIKeyEncrypted sets the "api_key_encrypted" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateAPIKeyEncrypted
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldAPIKeyEncrypted
)
return
u
}
// SetPrimaryModel sets the "primary_model" field.
func
(
u
*
ChannelMonitorUpsert
)
SetPrimaryModel
(
v
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldPrimaryModel
,
v
)
return
u
}
// UpdatePrimaryModel sets the "primary_model" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdatePrimaryModel
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldPrimaryModel
)
return
u
}
// SetExtraModels sets the "extra_models" field.
func
(
u
*
ChannelMonitorUpsert
)
SetExtraModels
(
v
[]
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldExtraModels
,
v
)
return
u
}
// UpdateExtraModels sets the "extra_models" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateExtraModels
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldExtraModels
)
return
u
}
// SetGroupName sets the "group_name" field.
func
(
u
*
ChannelMonitorUpsert
)
SetGroupName
(
v
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldGroupName
,
v
)
return
u
}
// UpdateGroupName sets the "group_name" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateGroupName
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldGroupName
)
return
u
}
// ClearGroupName clears the value of the "group_name" field.
func
(
u
*
ChannelMonitorUpsert
)
ClearGroupName
()
*
ChannelMonitorUpsert
{
u
.
SetNull
(
channelmonitor
.
FieldGroupName
)
return
u
}
// SetEnabled sets the "enabled" field.
func
(
u
*
ChannelMonitorUpsert
)
SetEnabled
(
v
bool
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldEnabled
,
v
)
return
u
}
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateEnabled
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldEnabled
)
return
u
}
// SetIntervalSeconds sets the "interval_seconds" field.
func
(
u
*
ChannelMonitorUpsert
)
SetIntervalSeconds
(
v
int
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldIntervalSeconds
,
v
)
return
u
}
// UpdateIntervalSeconds sets the "interval_seconds" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateIntervalSeconds
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldIntervalSeconds
)
return
u
}
// AddIntervalSeconds adds v to the "interval_seconds" field.
func
(
u
*
ChannelMonitorUpsert
)
AddIntervalSeconds
(
v
int
)
*
ChannelMonitorUpsert
{
u
.
Add
(
channelmonitor
.
FieldIntervalSeconds
,
v
)
return
u
}
// SetLastCheckedAt sets the "last_checked_at" field.
func
(
u
*
ChannelMonitorUpsert
)
SetLastCheckedAt
(
v
time
.
Time
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldLastCheckedAt
,
v
)
return
u
}
// UpdateLastCheckedAt sets the "last_checked_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateLastCheckedAt
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldLastCheckedAt
)
return
u
}
// ClearLastCheckedAt clears the value of the "last_checked_at" field.
func
(
u
*
ChannelMonitorUpsert
)
ClearLastCheckedAt
()
*
ChannelMonitorUpsert
{
u
.
SetNull
(
channelmonitor
.
FieldLastCheckedAt
)
return
u
}
// SetCreatedBy sets the "created_by" field.
func
(
u
*
ChannelMonitorUpsert
)
SetCreatedBy
(
v
int64
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldCreatedBy
,
v
)
return
u
}
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateCreatedBy
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldCreatedBy
)
return
u
}
// AddCreatedBy adds v to the "created_by" field.
func
(
u
*
ChannelMonitorUpsert
)
AddCreatedBy
(
v
int64
)
*
ChannelMonitorUpsert
{
u
.
Add
(
channelmonitor
.
FieldCreatedBy
,
v
)
return
u
}
// SetTemplateID sets the "template_id" field.
func
(
u
*
ChannelMonitorUpsert
)
SetTemplateID
(
v
int64
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldTemplateID
,
v
)
return
u
}
// UpdateTemplateID sets the "template_id" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateTemplateID
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldTemplateID
)
return
u
}
// ClearTemplateID clears the value of the "template_id" field.
func
(
u
*
ChannelMonitorUpsert
)
ClearTemplateID
()
*
ChannelMonitorUpsert
{
u
.
SetNull
(
channelmonitor
.
FieldTemplateID
)
return
u
}
// SetExtraHeaders sets the "extra_headers" field.
func
(
u
*
ChannelMonitorUpsert
)
SetExtraHeaders
(
v
map
[
string
]
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldExtraHeaders
,
v
)
return
u
}
// UpdateExtraHeaders sets the "extra_headers" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateExtraHeaders
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldExtraHeaders
)
return
u
}
// SetBodyOverrideMode sets the "body_override_mode" field.
func
(
u
*
ChannelMonitorUpsert
)
SetBodyOverrideMode
(
v
string
)
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldBodyOverrideMode
,
v
)
return
u
}
// UpdateBodyOverrideMode sets the "body_override_mode" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateBodyOverrideMode
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldBodyOverrideMode
)
return
u
}
// SetBodyOverride sets the "body_override" field.
func
(
u
*
ChannelMonitorUpsert
)
SetBodyOverride
(
v
map
[
string
]
interface
{})
*
ChannelMonitorUpsert
{
u
.
Set
(
channelmonitor
.
FieldBodyOverride
,
v
)
return
u
}
// UpdateBodyOverride sets the "body_override" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsert
)
UpdateBodyOverride
()
*
ChannelMonitorUpsert
{
u
.
SetExcluded
(
channelmonitor
.
FieldBodyOverride
)
return
u
}
// ClearBodyOverride clears the value of the "body_override" field.
func
(
u
*
ChannelMonitorUpsert
)
ClearBodyOverride
()
*
ChannelMonitorUpsert
{
u
.
SetNull
(
channelmonitor
.
FieldBodyOverride
)
return
u
}
// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
// client.ChannelMonitor.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateNewValues
()
*
ChannelMonitorUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithNewValues
())
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
s
*
sql
.
UpdateSet
)
{
if
_
,
exists
:=
u
.
create
.
mutation
.
CreatedAt
();
exists
{
s
.
SetIgnore
(
channelmonitor
.
FieldCreatedAt
)
}
}))
return
u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.ChannelMonitor.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func
(
u
*
ChannelMonitorUpsertOne
)
Ignore
()
*
ChannelMonitorUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithIgnore
())
return
u
}
// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func
(
u
*
ChannelMonitorUpsertOne
)
DoNothing
()
*
ChannelMonitorUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
DoNothing
())
return
u
}
// Update allows overriding fields `UPDATE` values. See the ChannelMonitorCreate.OnConflict
// documentation for more info.
func
(
u
*
ChannelMonitorUpsertOne
)
Update
(
set
func
(
*
ChannelMonitorUpsert
))
*
ChannelMonitorUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
update
*
sql
.
UpdateSet
)
{
set
(
&
ChannelMonitorUpsert
{
UpdateSet
:
update
})
}))
return
u
}
// SetUpdatedAt sets the "updated_at" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetUpdatedAt
(
v
time
.
Time
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetUpdatedAt
(
v
)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateUpdatedAt
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateUpdatedAt
()
})
}
// SetName sets the "name" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetName
(
v
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetName
(
v
)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateName
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateName
()
})
}
// SetProvider sets the "provider" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetProvider
(
v
channelmonitor
.
Provider
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetProvider
(
v
)
})
}
// UpdateProvider sets the "provider" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateProvider
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateProvider
()
})
}
// SetEndpoint sets the "endpoint" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetEndpoint
(
v
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetEndpoint
(
v
)
})
}
// UpdateEndpoint sets the "endpoint" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateEndpoint
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateEndpoint
()
})
}
// SetAPIKeyEncrypted sets the "api_key_encrypted" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetAPIKeyEncrypted
(
v
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetAPIKeyEncrypted
(
v
)
})
}
// UpdateAPIKeyEncrypted sets the "api_key_encrypted" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateAPIKeyEncrypted
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateAPIKeyEncrypted
()
})
}
// SetPrimaryModel sets the "primary_model" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetPrimaryModel
(
v
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetPrimaryModel
(
v
)
})
}
// UpdatePrimaryModel sets the "primary_model" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdatePrimaryModel
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdatePrimaryModel
()
})
}
// SetExtraModels sets the "extra_models" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetExtraModels
(
v
[]
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetExtraModels
(
v
)
})
}
// UpdateExtraModels sets the "extra_models" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateExtraModels
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateExtraModels
()
})
}
// SetGroupName sets the "group_name" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetGroupName
(
v
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetGroupName
(
v
)
})
}
// UpdateGroupName sets the "group_name" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateGroupName
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateGroupName
()
})
}
// ClearGroupName clears the value of the "group_name" field.
func
(
u
*
ChannelMonitorUpsertOne
)
ClearGroupName
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearGroupName
()
})
}
// SetEnabled sets the "enabled" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetEnabled
(
v
bool
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetEnabled
(
v
)
})
}
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateEnabled
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateEnabled
()
})
}
// SetIntervalSeconds sets the "interval_seconds" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetIntervalSeconds
(
v
int
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetIntervalSeconds
(
v
)
})
}
// AddIntervalSeconds adds v to the "interval_seconds" field.
func
(
u
*
ChannelMonitorUpsertOne
)
AddIntervalSeconds
(
v
int
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
AddIntervalSeconds
(
v
)
})
}
// UpdateIntervalSeconds sets the "interval_seconds" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateIntervalSeconds
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateIntervalSeconds
()
})
}
// SetLastCheckedAt sets the "last_checked_at" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetLastCheckedAt
(
v
time
.
Time
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetLastCheckedAt
(
v
)
})
}
// UpdateLastCheckedAt sets the "last_checked_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateLastCheckedAt
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateLastCheckedAt
()
})
}
// ClearLastCheckedAt clears the value of the "last_checked_at" field.
func
(
u
*
ChannelMonitorUpsertOne
)
ClearLastCheckedAt
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearLastCheckedAt
()
})
}
// SetCreatedBy sets the "created_by" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetCreatedBy
(
v
int64
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetCreatedBy
(
v
)
})
}
// AddCreatedBy adds v to the "created_by" field.
func
(
u
*
ChannelMonitorUpsertOne
)
AddCreatedBy
(
v
int64
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
AddCreatedBy
(
v
)
})
}
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateCreatedBy
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateCreatedBy
()
})
}
// SetTemplateID sets the "template_id" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetTemplateID
(
v
int64
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetTemplateID
(
v
)
})
}
// UpdateTemplateID sets the "template_id" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateTemplateID
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateTemplateID
()
})
}
// ClearTemplateID clears the value of the "template_id" field.
func
(
u
*
ChannelMonitorUpsertOne
)
ClearTemplateID
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearTemplateID
()
})
}
// SetExtraHeaders sets the "extra_headers" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetExtraHeaders
(
v
map
[
string
]
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetExtraHeaders
(
v
)
})
}
// UpdateExtraHeaders sets the "extra_headers" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateExtraHeaders
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateExtraHeaders
()
})
}
// SetBodyOverrideMode sets the "body_override_mode" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetBodyOverrideMode
(
v
string
)
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetBodyOverrideMode
(
v
)
})
}
// UpdateBodyOverrideMode sets the "body_override_mode" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateBodyOverrideMode
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateBodyOverrideMode
()
})
}
// SetBodyOverride sets the "body_override" field.
func
(
u
*
ChannelMonitorUpsertOne
)
SetBodyOverride
(
v
map
[
string
]
interface
{})
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetBodyOverride
(
v
)
})
}
// UpdateBodyOverride sets the "body_override" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertOne
)
UpdateBodyOverride
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateBodyOverride
()
})
}
// ClearBodyOverride clears the value of the "body_override" field.
func
(
u
*
ChannelMonitorUpsertOne
)
ClearBodyOverride
()
*
ChannelMonitorUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearBodyOverride
()
})
}
// Exec executes the query.
func
(
u
*
ChannelMonitorUpsertOne
)
Exec
(
ctx
context
.
Context
)
error
{
if
len
(
u
.
create
.
conflict
)
==
0
{
return
errors
.
New
(
"ent: missing options for ChannelMonitorCreate.OnConflict"
)
}
return
u
.
create
.
Exec
(
ctx
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
u
*
ChannelMonitorUpsertOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
u
.
create
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// Exec executes the UPSERT query and returns the inserted/updated ID.
func
(
u
*
ChannelMonitorUpsertOne
)
ID
(
ctx
context
.
Context
)
(
id
int64
,
err
error
)
{
node
,
err
:=
u
.
create
.
Save
(
ctx
)
if
err
!=
nil
{
return
id
,
err
}
return
node
.
ID
,
nil
}
// IDX is like ID, but panics if an error occurs.
func
(
u
*
ChannelMonitorUpsertOne
)
IDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
u
.
ID
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
id
}
// ChannelMonitorCreateBulk is the builder for creating many ChannelMonitor entities in bulk.
type
ChannelMonitorCreateBulk
struct
{
config
err
error
builders
[]
*
ChannelMonitorCreate
conflict
[]
sql
.
ConflictOption
}
// Save creates the ChannelMonitor entities in the database.
func
(
_c
*
ChannelMonitorCreateBulk
)
Save
(
ctx
context
.
Context
)
([]
*
ChannelMonitor
,
error
)
{
if
_c
.
err
!=
nil
{
return
nil
,
_c
.
err
}
specs
:=
make
([]
*
sqlgraph
.
CreateSpec
,
len
(
_c
.
builders
))
nodes
:=
make
([]
*
ChannelMonitor
,
len
(
_c
.
builders
))
mutators
:=
make
([]
Mutator
,
len
(
_c
.
builders
))
for
i
:=
range
_c
.
builders
{
func
(
i
int
,
root
context
.
Context
)
{
builder
:=
_c
.
builders
[
i
]
builder
.
defaults
()
var
mut
Mutator
=
MutateFunc
(
func
(
ctx
context
.
Context
,
m
Mutation
)
(
Value
,
error
)
{
mutation
,
ok
:=
m
.
(
*
ChannelMonitorMutation
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"unexpected mutation type %T"
,
m
)
}
if
err
:=
builder
.
check
();
err
!=
nil
{
return
nil
,
err
}
builder
.
mutation
=
mutation
var
err
error
nodes
[
i
],
specs
[
i
]
=
builder
.
createSpec
()
if
i
<
len
(
mutators
)
-
1
{
_
,
err
=
mutators
[
i
+
1
]
.
Mutate
(
root
,
_c
.
builders
[
i
+
1
]
.
mutation
)
}
else
{
spec
:=
&
sqlgraph
.
BatchCreateSpec
{
Nodes
:
specs
}
spec
.
OnConflict
=
_c
.
conflict
// Invoke the actual operation on the latest mutation in the chain.
if
err
=
sqlgraph
.
BatchCreate
(
ctx
,
_c
.
driver
,
spec
);
err
!=
nil
{
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
}
}
if
err
!=
nil
{
return
nil
,
err
}
mutation
.
id
=
&
nodes
[
i
]
.
ID
if
specs
[
i
]
.
ID
.
Value
!=
nil
{
id
:=
specs
[
i
]
.
ID
.
Value
.
(
int64
)
nodes
[
i
]
.
ID
=
int64
(
id
)
}
mutation
.
done
=
true
return
nodes
[
i
],
nil
})
for
i
:=
len
(
builder
.
hooks
)
-
1
;
i
>=
0
;
i
--
{
mut
=
builder
.
hooks
[
i
](
mut
)
}
mutators
[
i
]
=
mut
}(
i
,
ctx
)
}
if
len
(
mutators
)
>
0
{
if
_
,
err
:=
mutators
[
0
]
.
Mutate
(
ctx
,
_c
.
builders
[
0
]
.
mutation
);
err
!=
nil
{
return
nil
,
err
}
}
return
nodes
,
nil
}
// SaveX is like Save, but panics if an error occurs.
func
(
_c
*
ChannelMonitorCreateBulk
)
SaveX
(
ctx
context
.
Context
)
[]
*
ChannelMonitor
{
v
,
err
:=
_c
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
v
}
// Exec executes the query.
func
(
_c
*
ChannelMonitorCreateBulk
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_c
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_c
*
ChannelMonitorCreateBulk
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_c
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.ChannelMonitor.CreateBulk(builders...).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
// sql.ResolveWithNewValues(),
// ).
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.ChannelMonitorUpsert) {
// SetCreatedAt(v+v).
// }).
// Exec(ctx)
func
(
_c
*
ChannelMonitorCreateBulk
)
OnConflict
(
opts
...
sql
.
ConflictOption
)
*
ChannelMonitorUpsertBulk
{
_c
.
conflict
=
opts
return
&
ChannelMonitorUpsertBulk
{
create
:
_c
,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.ChannelMonitor.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func
(
_c
*
ChannelMonitorCreateBulk
)
OnConflictColumns
(
columns
...
string
)
*
ChannelMonitorUpsertBulk
{
_c
.
conflict
=
append
(
_c
.
conflict
,
sql
.
ConflictColumns
(
columns
...
))
return
&
ChannelMonitorUpsertBulk
{
create
:
_c
,
}
}
// ChannelMonitorUpsertBulk is the builder for "upsert"-ing
// a bulk of ChannelMonitor nodes.
type
ChannelMonitorUpsertBulk
struct
{
create
*
ChannelMonitorCreateBulk
}
// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
// client.ChannelMonitor.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateNewValues
()
*
ChannelMonitorUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithNewValues
())
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
s
*
sql
.
UpdateSet
)
{
for
_
,
b
:=
range
u
.
create
.
builders
{
if
_
,
exists
:=
b
.
mutation
.
CreatedAt
();
exists
{
s
.
SetIgnore
(
channelmonitor
.
FieldCreatedAt
)
}
}
}))
return
u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.ChannelMonitor.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func
(
u
*
ChannelMonitorUpsertBulk
)
Ignore
()
*
ChannelMonitorUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithIgnore
())
return
u
}
// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func
(
u
*
ChannelMonitorUpsertBulk
)
DoNothing
()
*
ChannelMonitorUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
DoNothing
())
return
u
}
// Update allows overriding fields `UPDATE` values. See the ChannelMonitorCreateBulk.OnConflict
// documentation for more info.
func
(
u
*
ChannelMonitorUpsertBulk
)
Update
(
set
func
(
*
ChannelMonitorUpsert
))
*
ChannelMonitorUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
update
*
sql
.
UpdateSet
)
{
set
(
&
ChannelMonitorUpsert
{
UpdateSet
:
update
})
}))
return
u
}
// SetUpdatedAt sets the "updated_at" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetUpdatedAt
(
v
time
.
Time
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetUpdatedAt
(
v
)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateUpdatedAt
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateUpdatedAt
()
})
}
// SetName sets the "name" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetName
(
v
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetName
(
v
)
})
}
// UpdateName sets the "name" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateName
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateName
()
})
}
// SetProvider sets the "provider" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetProvider
(
v
channelmonitor
.
Provider
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetProvider
(
v
)
})
}
// UpdateProvider sets the "provider" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateProvider
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateProvider
()
})
}
// SetEndpoint sets the "endpoint" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetEndpoint
(
v
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetEndpoint
(
v
)
})
}
// UpdateEndpoint sets the "endpoint" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateEndpoint
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateEndpoint
()
})
}
// SetAPIKeyEncrypted sets the "api_key_encrypted" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetAPIKeyEncrypted
(
v
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetAPIKeyEncrypted
(
v
)
})
}
// UpdateAPIKeyEncrypted sets the "api_key_encrypted" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateAPIKeyEncrypted
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateAPIKeyEncrypted
()
})
}
// SetPrimaryModel sets the "primary_model" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetPrimaryModel
(
v
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetPrimaryModel
(
v
)
})
}
// UpdatePrimaryModel sets the "primary_model" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdatePrimaryModel
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdatePrimaryModel
()
})
}
// SetExtraModels sets the "extra_models" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetExtraModels
(
v
[]
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetExtraModels
(
v
)
})
}
// UpdateExtraModels sets the "extra_models" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateExtraModels
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateExtraModels
()
})
}
// SetGroupName sets the "group_name" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetGroupName
(
v
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetGroupName
(
v
)
})
}
// UpdateGroupName sets the "group_name" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateGroupName
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateGroupName
()
})
}
// ClearGroupName clears the value of the "group_name" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
ClearGroupName
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearGroupName
()
})
}
// SetEnabled sets the "enabled" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetEnabled
(
v
bool
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetEnabled
(
v
)
})
}
// UpdateEnabled sets the "enabled" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateEnabled
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateEnabled
()
})
}
// SetIntervalSeconds sets the "interval_seconds" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetIntervalSeconds
(
v
int
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetIntervalSeconds
(
v
)
})
}
// AddIntervalSeconds adds v to the "interval_seconds" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
AddIntervalSeconds
(
v
int
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
AddIntervalSeconds
(
v
)
})
}
// UpdateIntervalSeconds sets the "interval_seconds" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateIntervalSeconds
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateIntervalSeconds
()
})
}
// SetLastCheckedAt sets the "last_checked_at" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetLastCheckedAt
(
v
time
.
Time
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetLastCheckedAt
(
v
)
})
}
// UpdateLastCheckedAt sets the "last_checked_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateLastCheckedAt
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateLastCheckedAt
()
})
}
// ClearLastCheckedAt clears the value of the "last_checked_at" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
ClearLastCheckedAt
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearLastCheckedAt
()
})
}
// SetCreatedBy sets the "created_by" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetCreatedBy
(
v
int64
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetCreatedBy
(
v
)
})
}
// AddCreatedBy adds v to the "created_by" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
AddCreatedBy
(
v
int64
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
AddCreatedBy
(
v
)
})
}
// UpdateCreatedBy sets the "created_by" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateCreatedBy
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateCreatedBy
()
})
}
// SetTemplateID sets the "template_id" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetTemplateID
(
v
int64
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetTemplateID
(
v
)
})
}
// UpdateTemplateID sets the "template_id" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateTemplateID
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateTemplateID
()
})
}
// ClearTemplateID clears the value of the "template_id" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
ClearTemplateID
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearTemplateID
()
})
}
// SetExtraHeaders sets the "extra_headers" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetExtraHeaders
(
v
map
[
string
]
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetExtraHeaders
(
v
)
})
}
// UpdateExtraHeaders sets the "extra_headers" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateExtraHeaders
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateExtraHeaders
()
})
}
// SetBodyOverrideMode sets the "body_override_mode" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetBodyOverrideMode
(
v
string
)
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetBodyOverrideMode
(
v
)
})
}
// UpdateBodyOverrideMode sets the "body_override_mode" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateBodyOverrideMode
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateBodyOverrideMode
()
})
}
// SetBodyOverride sets the "body_override" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
SetBodyOverride
(
v
map
[
string
]
interface
{})
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
SetBodyOverride
(
v
)
})
}
// UpdateBodyOverride sets the "body_override" field to the value that was provided on create.
func
(
u
*
ChannelMonitorUpsertBulk
)
UpdateBodyOverride
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
UpdateBodyOverride
()
})
}
// ClearBodyOverride clears the value of the "body_override" field.
func
(
u
*
ChannelMonitorUpsertBulk
)
ClearBodyOverride
()
*
ChannelMonitorUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorUpsert
)
{
s
.
ClearBodyOverride
()
})
}
// Exec executes the query.
func
(
u
*
ChannelMonitorUpsertBulk
)
Exec
(
ctx
context
.
Context
)
error
{
if
u
.
create
.
err
!=
nil
{
return
u
.
create
.
err
}
for
i
,
b
:=
range
u
.
create
.
builders
{
if
len
(
b
.
conflict
)
!=
0
{
return
fmt
.
Errorf
(
"ent: OnConflict was set for builder %d. Set it on the ChannelMonitorCreateBulk instead"
,
i
)
}
}
if
len
(
u
.
create
.
conflict
)
==
0
{
return
errors
.
New
(
"ent: missing options for ChannelMonitorCreateBulk.OnConflict"
)
}
return
u
.
create
.
Exec
(
ctx
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
u
*
ChannelMonitorUpsertBulk
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
u
.
create
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
backend/ent/channelmonitor_delete.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ChannelMonitorDelete is the builder for deleting a ChannelMonitor entity.
type
ChannelMonitorDelete
struct
{
config
hooks
[]
Hook
mutation
*
ChannelMonitorMutation
}
// Where appends a list predicates to the ChannelMonitorDelete builder.
func
(
_d
*
ChannelMonitorDelete
)
Where
(
ps
...
predicate
.
ChannelMonitor
)
*
ChannelMonitorDelete
{
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func
(
_d
*
ChannelMonitorDelete
)
Exec
(
ctx
context
.
Context
)
(
int
,
error
)
{
return
withHooks
(
ctx
,
_d
.
sqlExec
,
_d
.
mutation
,
_d
.
hooks
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_d
*
ChannelMonitorDelete
)
ExecX
(
ctx
context
.
Context
)
int
{
n
,
err
:=
_d
.
Exec
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
n
}
func
(
_d
*
ChannelMonitorDelete
)
sqlExec
(
ctx
context
.
Context
)
(
int
,
error
)
{
_spec
:=
sqlgraph
.
NewDeleteSpec
(
channelmonitor
.
Table
,
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
))
if
ps
:=
_d
.
mutation
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
affected
,
err
:=
sqlgraph
.
DeleteNodes
(
ctx
,
_d
.
driver
,
_spec
)
if
err
!=
nil
&&
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
_d
.
mutation
.
done
=
true
return
affected
,
err
}
// ChannelMonitorDeleteOne is the builder for deleting a single ChannelMonitor entity.
type
ChannelMonitorDeleteOne
struct
{
_d
*
ChannelMonitorDelete
}
// Where appends a list predicates to the ChannelMonitorDelete builder.
func
(
_d
*
ChannelMonitorDeleteOne
)
Where
(
ps
...
predicate
.
ChannelMonitor
)
*
ChannelMonitorDeleteOne
{
_d
.
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query.
func
(
_d
*
ChannelMonitorDeleteOne
)
Exec
(
ctx
context
.
Context
)
error
{
n
,
err
:=
_d
.
_d
.
Exec
(
ctx
)
switch
{
case
err
!=
nil
:
return
err
case
n
==
0
:
return
&
NotFoundError
{
channelmonitor
.
Label
}
default
:
return
nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_d
*
ChannelMonitorDeleteOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_d
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
backend/ent/channelmonitor_query.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"database/sql/driver"
"fmt"
"math"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorrequesttemplate"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ChannelMonitorQuery is the builder for querying ChannelMonitor entities.
type
ChannelMonitorQuery
struct
{
config
ctx
*
QueryContext
order
[]
channelmonitor
.
OrderOption
inters
[]
Interceptor
predicates
[]
predicate
.
ChannelMonitor
withHistory
*
ChannelMonitorHistoryQuery
withDailyRollups
*
ChannelMonitorDailyRollupQuery
withRequestTemplate
*
ChannelMonitorRequestTemplateQuery
modifiers
[]
func
(
*
sql
.
Selector
)
// intermediate query (i.e. traversal path).
sql
*
sql
.
Selector
path
func
(
context
.
Context
)
(
*
sql
.
Selector
,
error
)
}
// Where adds a new predicate for the ChannelMonitorQuery builder.
func
(
_q
*
ChannelMonitorQuery
)
Where
(
ps
...
predicate
.
ChannelMonitor
)
*
ChannelMonitorQuery
{
_q
.
predicates
=
append
(
_q
.
predicates
,
ps
...
)
return
_q
}
// Limit the number of records to be returned by this query.
func
(
_q
*
ChannelMonitorQuery
)
Limit
(
limit
int
)
*
ChannelMonitorQuery
{
_q
.
ctx
.
Limit
=
&
limit
return
_q
}
// Offset to start from.
func
(
_q
*
ChannelMonitorQuery
)
Offset
(
offset
int
)
*
ChannelMonitorQuery
{
_q
.
ctx
.
Offset
=
&
offset
return
_q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
func
(
_q
*
ChannelMonitorQuery
)
Unique
(
unique
bool
)
*
ChannelMonitorQuery
{
_q
.
ctx
.
Unique
=
&
unique
return
_q
}
// Order specifies how the records should be ordered.
func
(
_q
*
ChannelMonitorQuery
)
Order
(
o
...
channelmonitor
.
OrderOption
)
*
ChannelMonitorQuery
{
_q
.
order
=
append
(
_q
.
order
,
o
...
)
return
_q
}
// QueryHistory chains the current query on the "history" edge.
func
(
_q
*
ChannelMonitorQuery
)
QueryHistory
()
*
ChannelMonitorHistoryQuery
{
query
:=
(
&
ChannelMonitorHistoryClient
{
config
:
_q
.
config
})
.
Query
()
query
.
path
=
func
(
ctx
context
.
Context
)
(
fromU
*
sql
.
Selector
,
err
error
)
{
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
selector
:=
_q
.
sqlQuery
(
ctx
)
if
err
:=
selector
.
Err
();
err
!=
nil
{
return
nil
,
err
}
step
:=
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
channelmonitor
.
Table
,
channelmonitor
.
FieldID
,
selector
),
sqlgraph
.
To
(
channelmonitorhistory
.
Table
,
channelmonitorhistory
.
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
O2M
,
false
,
channelmonitor
.
HistoryTable
,
channelmonitor
.
HistoryColumn
),
)
fromU
=
sqlgraph
.
SetNeighbors
(
_q
.
driver
.
Dialect
(),
step
)
return
fromU
,
nil
}
return
query
}
// QueryDailyRollups chains the current query on the "daily_rollups" edge.
func
(
_q
*
ChannelMonitorQuery
)
QueryDailyRollups
()
*
ChannelMonitorDailyRollupQuery
{
query
:=
(
&
ChannelMonitorDailyRollupClient
{
config
:
_q
.
config
})
.
Query
()
query
.
path
=
func
(
ctx
context
.
Context
)
(
fromU
*
sql
.
Selector
,
err
error
)
{
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
selector
:=
_q
.
sqlQuery
(
ctx
)
if
err
:=
selector
.
Err
();
err
!=
nil
{
return
nil
,
err
}
step
:=
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
channelmonitor
.
Table
,
channelmonitor
.
FieldID
,
selector
),
sqlgraph
.
To
(
channelmonitordailyrollup
.
Table
,
channelmonitordailyrollup
.
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
O2M
,
false
,
channelmonitor
.
DailyRollupsTable
,
channelmonitor
.
DailyRollupsColumn
),
)
fromU
=
sqlgraph
.
SetNeighbors
(
_q
.
driver
.
Dialect
(),
step
)
return
fromU
,
nil
}
return
query
}
// QueryRequestTemplate chains the current query on the "request_template" edge.
func
(
_q
*
ChannelMonitorQuery
)
QueryRequestTemplate
()
*
ChannelMonitorRequestTemplateQuery
{
query
:=
(
&
ChannelMonitorRequestTemplateClient
{
config
:
_q
.
config
})
.
Query
()
query
.
path
=
func
(
ctx
context
.
Context
)
(
fromU
*
sql
.
Selector
,
err
error
)
{
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
selector
:=
_q
.
sqlQuery
(
ctx
)
if
err
:=
selector
.
Err
();
err
!=
nil
{
return
nil
,
err
}
step
:=
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
channelmonitor
.
Table
,
channelmonitor
.
FieldID
,
selector
),
sqlgraph
.
To
(
channelmonitorrequesttemplate
.
Table
,
channelmonitorrequesttemplate
.
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
M2O
,
false
,
channelmonitor
.
RequestTemplateTable
,
channelmonitor
.
RequestTemplateColumn
),
)
fromU
=
sqlgraph
.
SetNeighbors
(
_q
.
driver
.
Dialect
(),
step
)
return
fromU
,
nil
}
return
query
}
// First returns the first ChannelMonitor entity from the query.
// Returns a *NotFoundError when no ChannelMonitor was found.
func
(
_q
*
ChannelMonitorQuery
)
First
(
ctx
context
.
Context
)
(
*
ChannelMonitor
,
error
)
{
nodes
,
err
:=
_q
.
Limit
(
1
)
.
All
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryFirst
))
if
err
!=
nil
{
return
nil
,
err
}
if
len
(
nodes
)
==
0
{
return
nil
,
&
NotFoundError
{
channelmonitor
.
Label
}
}
return
nodes
[
0
],
nil
}
// FirstX is like First, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
FirstX
(
ctx
context
.
Context
)
*
ChannelMonitor
{
node
,
err
:=
_q
.
First
(
ctx
)
if
err
!=
nil
&&
!
IsNotFound
(
err
)
{
panic
(
err
)
}
return
node
}
// FirstID returns the first ChannelMonitor ID from the query.
// Returns a *NotFoundError when no ChannelMonitor ID was found.
func
(
_q
*
ChannelMonitorQuery
)
FirstID
(
ctx
context
.
Context
)
(
id
int64
,
err
error
)
{
var
ids
[]
int64
if
ids
,
err
=
_q
.
Limit
(
1
)
.
IDs
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryFirstID
));
err
!=
nil
{
return
}
if
len
(
ids
)
==
0
{
err
=
&
NotFoundError
{
channelmonitor
.
Label
}
return
}
return
ids
[
0
],
nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
FirstIDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
_q
.
FirstID
(
ctx
)
if
err
!=
nil
&&
!
IsNotFound
(
err
)
{
panic
(
err
)
}
return
id
}
// Only returns a single ChannelMonitor entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one ChannelMonitor entity is found.
// Returns a *NotFoundError when no ChannelMonitor entities are found.
func
(
_q
*
ChannelMonitorQuery
)
Only
(
ctx
context
.
Context
)
(
*
ChannelMonitor
,
error
)
{
nodes
,
err
:=
_q
.
Limit
(
2
)
.
All
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryOnly
))
if
err
!=
nil
{
return
nil
,
err
}
switch
len
(
nodes
)
{
case
1
:
return
nodes
[
0
],
nil
case
0
:
return
nil
,
&
NotFoundError
{
channelmonitor
.
Label
}
default
:
return
nil
,
&
NotSingularError
{
channelmonitor
.
Label
}
}
}
// OnlyX is like Only, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
OnlyX
(
ctx
context
.
Context
)
*
ChannelMonitor
{
node
,
err
:=
_q
.
Only
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
node
}
// OnlyID is like Only, but returns the only ChannelMonitor ID in the query.
// Returns a *NotSingularError when more than one ChannelMonitor ID is found.
// Returns a *NotFoundError when no entities are found.
func
(
_q
*
ChannelMonitorQuery
)
OnlyID
(
ctx
context
.
Context
)
(
id
int64
,
err
error
)
{
var
ids
[]
int64
if
ids
,
err
=
_q
.
Limit
(
2
)
.
IDs
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryOnlyID
));
err
!=
nil
{
return
}
switch
len
(
ids
)
{
case
1
:
id
=
ids
[
0
]
case
0
:
err
=
&
NotFoundError
{
channelmonitor
.
Label
}
default
:
err
=
&
NotSingularError
{
channelmonitor
.
Label
}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
OnlyIDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
_q
.
OnlyID
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
id
}
// All executes the query and returns a list of ChannelMonitors.
func
(
_q
*
ChannelMonitorQuery
)
All
(
ctx
context
.
Context
)
([]
*
ChannelMonitor
,
error
)
{
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryAll
)
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
qr
:=
querierAll
[[]
*
ChannelMonitor
,
*
ChannelMonitorQuery
]()
return
withInterceptors
[[]
*
ChannelMonitor
](
ctx
,
_q
,
qr
,
_q
.
inters
)
}
// AllX is like All, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
AllX
(
ctx
context
.
Context
)
[]
*
ChannelMonitor
{
nodes
,
err
:=
_q
.
All
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
nodes
}
// IDs executes the query and returns a list of ChannelMonitor IDs.
func
(
_q
*
ChannelMonitorQuery
)
IDs
(
ctx
context
.
Context
)
(
ids
[]
int64
,
err
error
)
{
if
_q
.
ctx
.
Unique
==
nil
&&
_q
.
path
!=
nil
{
_q
.
Unique
(
true
)
}
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryIDs
)
if
err
=
_q
.
Select
(
channelmonitor
.
FieldID
)
.
Scan
(
ctx
,
&
ids
);
err
!=
nil
{
return
nil
,
err
}
return
ids
,
nil
}
// IDsX is like IDs, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
IDsX
(
ctx
context
.
Context
)
[]
int64
{
ids
,
err
:=
_q
.
IDs
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
ids
}
// Count returns the count of the given query.
func
(
_q
*
ChannelMonitorQuery
)
Count
(
ctx
context
.
Context
)
(
int
,
error
)
{
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryCount
)
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
0
,
err
}
return
withInterceptors
[
int
](
ctx
,
_q
,
querierCount
[
*
ChannelMonitorQuery
](),
_q
.
inters
)
}
// CountX is like Count, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
CountX
(
ctx
context
.
Context
)
int
{
count
,
err
:=
_q
.
Count
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
count
}
// Exist returns true if the query has elements in the graph.
func
(
_q
*
ChannelMonitorQuery
)
Exist
(
ctx
context
.
Context
)
(
bool
,
error
)
{
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryExist
)
switch
_
,
err
:=
_q
.
FirstID
(
ctx
);
{
case
IsNotFound
(
err
)
:
return
false
,
nil
case
err
!=
nil
:
return
false
,
fmt
.
Errorf
(
"ent: check existence: %w"
,
err
)
default
:
return
true
,
nil
}
}
// ExistX is like Exist, but panics if an error occurs.
func
(
_q
*
ChannelMonitorQuery
)
ExistX
(
ctx
context
.
Context
)
bool
{
exist
,
err
:=
_q
.
Exist
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
exist
}
// Clone returns a duplicate of the ChannelMonitorQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func
(
_q
*
ChannelMonitorQuery
)
Clone
()
*
ChannelMonitorQuery
{
if
_q
==
nil
{
return
nil
}
return
&
ChannelMonitorQuery
{
config
:
_q
.
config
,
ctx
:
_q
.
ctx
.
Clone
(),
order
:
append
([]
channelmonitor
.
OrderOption
{},
_q
.
order
...
),
inters
:
append
([]
Interceptor
{},
_q
.
inters
...
),
predicates
:
append
([]
predicate
.
ChannelMonitor
{},
_q
.
predicates
...
),
withHistory
:
_q
.
withHistory
.
Clone
(),
withDailyRollups
:
_q
.
withDailyRollups
.
Clone
(),
withRequestTemplate
:
_q
.
withRequestTemplate
.
Clone
(),
// clone intermediate query.
sql
:
_q
.
sql
.
Clone
(),
path
:
_q
.
path
,
}
}
// WithHistory tells the query-builder to eager-load the nodes that are connected to
// the "history" edge. The optional arguments are used to configure the query builder of the edge.
func
(
_q
*
ChannelMonitorQuery
)
WithHistory
(
opts
...
func
(
*
ChannelMonitorHistoryQuery
))
*
ChannelMonitorQuery
{
query
:=
(
&
ChannelMonitorHistoryClient
{
config
:
_q
.
config
})
.
Query
()
for
_
,
opt
:=
range
opts
{
opt
(
query
)
}
_q
.
withHistory
=
query
return
_q
}
// WithDailyRollups tells the query-builder to eager-load the nodes that are connected to
// the "daily_rollups" edge. The optional arguments are used to configure the query builder of the edge.
func
(
_q
*
ChannelMonitorQuery
)
WithDailyRollups
(
opts
...
func
(
*
ChannelMonitorDailyRollupQuery
))
*
ChannelMonitorQuery
{
query
:=
(
&
ChannelMonitorDailyRollupClient
{
config
:
_q
.
config
})
.
Query
()
for
_
,
opt
:=
range
opts
{
opt
(
query
)
}
_q
.
withDailyRollups
=
query
return
_q
}
// WithRequestTemplate tells the query-builder to eager-load the nodes that are connected to
// the "request_template" edge. The optional arguments are used to configure the query builder of the edge.
func
(
_q
*
ChannelMonitorQuery
)
WithRequestTemplate
(
opts
...
func
(
*
ChannelMonitorRequestTemplateQuery
))
*
ChannelMonitorQuery
{
query
:=
(
&
ChannelMonitorRequestTemplateClient
{
config
:
_q
.
config
})
.
Query
()
for
_
,
opt
:=
range
opts
{
opt
(
query
)
}
_q
.
withRequestTemplate
=
query
return
_q
}
// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.ChannelMonitor.Query().
// GroupBy(channelmonitor.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func
(
_q
*
ChannelMonitorQuery
)
GroupBy
(
field
string
,
fields
...
string
)
*
ChannelMonitorGroupBy
{
_q
.
ctx
.
Fields
=
append
([]
string
{
field
},
fields
...
)
grbuild
:=
&
ChannelMonitorGroupBy
{
build
:
_q
}
grbuild
.
flds
=
&
_q
.
ctx
.
Fields
grbuild
.
label
=
channelmonitor
.
Label
grbuild
.
scan
=
grbuild
.
Scan
return
grbuild
}
// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// }
//
// client.ChannelMonitor.Query().
// Select(channelmonitor.FieldCreatedAt).
// Scan(ctx, &v)
func
(
_q
*
ChannelMonitorQuery
)
Select
(
fields
...
string
)
*
ChannelMonitorSelect
{
_q
.
ctx
.
Fields
=
append
(
_q
.
ctx
.
Fields
,
fields
...
)
sbuild
:=
&
ChannelMonitorSelect
{
ChannelMonitorQuery
:
_q
}
sbuild
.
label
=
channelmonitor
.
Label
sbuild
.
flds
,
sbuild
.
scan
=
&
_q
.
ctx
.
Fields
,
sbuild
.
Scan
return
sbuild
}
// Aggregate returns a ChannelMonitorSelect configured with the given aggregations.
func
(
_q
*
ChannelMonitorQuery
)
Aggregate
(
fns
...
AggregateFunc
)
*
ChannelMonitorSelect
{
return
_q
.
Select
()
.
Aggregate
(
fns
...
)
}
func
(
_q
*
ChannelMonitorQuery
)
prepareQuery
(
ctx
context
.
Context
)
error
{
for
_
,
inter
:=
range
_q
.
inters
{
if
inter
==
nil
{
return
fmt
.
Errorf
(
"ent: uninitialized interceptor (forgotten import ent/runtime?)"
)
}
if
trv
,
ok
:=
inter
.
(
Traverser
);
ok
{
if
err
:=
trv
.
Traverse
(
ctx
,
_q
);
err
!=
nil
{
return
err
}
}
}
for
_
,
f
:=
range
_q
.
ctx
.
Fields
{
if
!
channelmonitor
.
ValidColumn
(
f
)
{
return
&
ValidationError
{
Name
:
f
,
err
:
fmt
.
Errorf
(
"ent: invalid field %q for query"
,
f
)}
}
}
if
_q
.
path
!=
nil
{
prev
,
err
:=
_q
.
path
(
ctx
)
if
err
!=
nil
{
return
err
}
_q
.
sql
=
prev
}
return
nil
}
func
(
_q
*
ChannelMonitorQuery
)
sqlAll
(
ctx
context
.
Context
,
hooks
...
queryHook
)
([]
*
ChannelMonitor
,
error
)
{
var
(
nodes
=
[]
*
ChannelMonitor
{}
_spec
=
_q
.
querySpec
()
loadedTypes
=
[
3
]
bool
{
_q
.
withHistory
!=
nil
,
_q
.
withDailyRollups
!=
nil
,
_q
.
withRequestTemplate
!=
nil
,
}
)
_spec
.
ScanValues
=
func
(
columns
[]
string
)
([]
any
,
error
)
{
return
(
*
ChannelMonitor
)
.
scanValues
(
nil
,
columns
)
}
_spec
.
Assign
=
func
(
columns
[]
string
,
values
[]
any
)
error
{
node
:=
&
ChannelMonitor
{
config
:
_q
.
config
}
nodes
=
append
(
nodes
,
node
)
node
.
Edges
.
loadedTypes
=
loadedTypes
return
node
.
assignValues
(
columns
,
values
)
}
if
len
(
_q
.
modifiers
)
>
0
{
_spec
.
Modifiers
=
_q
.
modifiers
}
for
i
:=
range
hooks
{
hooks
[
i
](
ctx
,
_spec
)
}
if
err
:=
sqlgraph
.
QueryNodes
(
ctx
,
_q
.
driver
,
_spec
);
err
!=
nil
{
return
nil
,
err
}
if
len
(
nodes
)
==
0
{
return
nodes
,
nil
}
if
query
:=
_q
.
withHistory
;
query
!=
nil
{
if
err
:=
_q
.
loadHistory
(
ctx
,
query
,
nodes
,
func
(
n
*
ChannelMonitor
)
{
n
.
Edges
.
History
=
[]
*
ChannelMonitorHistory
{}
},
func
(
n
*
ChannelMonitor
,
e
*
ChannelMonitorHistory
)
{
n
.
Edges
.
History
=
append
(
n
.
Edges
.
History
,
e
)
});
err
!=
nil
{
return
nil
,
err
}
}
if
query
:=
_q
.
withDailyRollups
;
query
!=
nil
{
if
err
:=
_q
.
loadDailyRollups
(
ctx
,
query
,
nodes
,
func
(
n
*
ChannelMonitor
)
{
n
.
Edges
.
DailyRollups
=
[]
*
ChannelMonitorDailyRollup
{}
},
func
(
n
*
ChannelMonitor
,
e
*
ChannelMonitorDailyRollup
)
{
n
.
Edges
.
DailyRollups
=
append
(
n
.
Edges
.
DailyRollups
,
e
)
});
err
!=
nil
{
return
nil
,
err
}
}
if
query
:=
_q
.
withRequestTemplate
;
query
!=
nil
{
if
err
:=
_q
.
loadRequestTemplate
(
ctx
,
query
,
nodes
,
nil
,
func
(
n
*
ChannelMonitor
,
e
*
ChannelMonitorRequestTemplate
)
{
n
.
Edges
.
RequestTemplate
=
e
});
err
!=
nil
{
return
nil
,
err
}
}
return
nodes
,
nil
}
func
(
_q
*
ChannelMonitorQuery
)
loadHistory
(
ctx
context
.
Context
,
query
*
ChannelMonitorHistoryQuery
,
nodes
[]
*
ChannelMonitor
,
init
func
(
*
ChannelMonitor
),
assign
func
(
*
ChannelMonitor
,
*
ChannelMonitorHistory
))
error
{
fks
:=
make
([]
driver
.
Value
,
0
,
len
(
nodes
))
nodeids
:=
make
(
map
[
int64
]
*
ChannelMonitor
)
for
i
:=
range
nodes
{
fks
=
append
(
fks
,
nodes
[
i
]
.
ID
)
nodeids
[
nodes
[
i
]
.
ID
]
=
nodes
[
i
]
if
init
!=
nil
{
init
(
nodes
[
i
])
}
}
if
len
(
query
.
ctx
.
Fields
)
>
0
{
query
.
ctx
.
AppendFieldOnce
(
channelmonitorhistory
.
FieldMonitorID
)
}
query
.
Where
(
predicate
.
ChannelMonitorHistory
(
func
(
s
*
sql
.
Selector
)
{
s
.
Where
(
sql
.
InValues
(
s
.
C
(
channelmonitor
.
HistoryColumn
),
fks
...
))
}))
neighbors
,
err
:=
query
.
All
(
ctx
)
if
err
!=
nil
{
return
err
}
for
_
,
n
:=
range
neighbors
{
fk
:=
n
.
MonitorID
node
,
ok
:=
nodeids
[
fk
]
if
!
ok
{
return
fmt
.
Errorf
(
`unexpected referenced foreign-key "monitor_id" returned %v for node %v`
,
fk
,
n
.
ID
)
}
assign
(
node
,
n
)
}
return
nil
}
func
(
_q
*
ChannelMonitorQuery
)
loadDailyRollups
(
ctx
context
.
Context
,
query
*
ChannelMonitorDailyRollupQuery
,
nodes
[]
*
ChannelMonitor
,
init
func
(
*
ChannelMonitor
),
assign
func
(
*
ChannelMonitor
,
*
ChannelMonitorDailyRollup
))
error
{
fks
:=
make
([]
driver
.
Value
,
0
,
len
(
nodes
))
nodeids
:=
make
(
map
[
int64
]
*
ChannelMonitor
)
for
i
:=
range
nodes
{
fks
=
append
(
fks
,
nodes
[
i
]
.
ID
)
nodeids
[
nodes
[
i
]
.
ID
]
=
nodes
[
i
]
if
init
!=
nil
{
init
(
nodes
[
i
])
}
}
if
len
(
query
.
ctx
.
Fields
)
>
0
{
query
.
ctx
.
AppendFieldOnce
(
channelmonitordailyrollup
.
FieldMonitorID
)
}
query
.
Where
(
predicate
.
ChannelMonitorDailyRollup
(
func
(
s
*
sql
.
Selector
)
{
s
.
Where
(
sql
.
InValues
(
s
.
C
(
channelmonitor
.
DailyRollupsColumn
),
fks
...
))
}))
neighbors
,
err
:=
query
.
All
(
ctx
)
if
err
!=
nil
{
return
err
}
for
_
,
n
:=
range
neighbors
{
fk
:=
n
.
MonitorID
node
,
ok
:=
nodeids
[
fk
]
if
!
ok
{
return
fmt
.
Errorf
(
`unexpected referenced foreign-key "monitor_id" returned %v for node %v`
,
fk
,
n
.
ID
)
}
assign
(
node
,
n
)
}
return
nil
}
func
(
_q
*
ChannelMonitorQuery
)
loadRequestTemplate
(
ctx
context
.
Context
,
query
*
ChannelMonitorRequestTemplateQuery
,
nodes
[]
*
ChannelMonitor
,
init
func
(
*
ChannelMonitor
),
assign
func
(
*
ChannelMonitor
,
*
ChannelMonitorRequestTemplate
))
error
{
ids
:=
make
([]
int64
,
0
,
len
(
nodes
))
nodeids
:=
make
(
map
[
int64
][]
*
ChannelMonitor
)
for
i
:=
range
nodes
{
if
nodes
[
i
]
.
TemplateID
==
nil
{
continue
}
fk
:=
*
nodes
[
i
]
.
TemplateID
if
_
,
ok
:=
nodeids
[
fk
];
!
ok
{
ids
=
append
(
ids
,
fk
)
}
nodeids
[
fk
]
=
append
(
nodeids
[
fk
],
nodes
[
i
])
}
if
len
(
ids
)
==
0
{
return
nil
}
query
.
Where
(
channelmonitorrequesttemplate
.
IDIn
(
ids
...
))
neighbors
,
err
:=
query
.
All
(
ctx
)
if
err
!=
nil
{
return
err
}
for
_
,
n
:=
range
neighbors
{
nodes
,
ok
:=
nodeids
[
n
.
ID
]
if
!
ok
{
return
fmt
.
Errorf
(
`unexpected foreign-key "template_id" returned %v`
,
n
.
ID
)
}
for
i
:=
range
nodes
{
assign
(
nodes
[
i
],
n
)
}
}
return
nil
}
func
(
_q
*
ChannelMonitorQuery
)
sqlCount
(
ctx
context
.
Context
)
(
int
,
error
)
{
_spec
:=
_q
.
querySpec
()
if
len
(
_q
.
modifiers
)
>
0
{
_spec
.
Modifiers
=
_q
.
modifiers
}
_spec
.
Node
.
Columns
=
_q
.
ctx
.
Fields
if
len
(
_q
.
ctx
.
Fields
)
>
0
{
_spec
.
Unique
=
_q
.
ctx
.
Unique
!=
nil
&&
*
_q
.
ctx
.
Unique
}
return
sqlgraph
.
CountNodes
(
ctx
,
_q
.
driver
,
_spec
)
}
func
(
_q
*
ChannelMonitorQuery
)
querySpec
()
*
sqlgraph
.
QuerySpec
{
_spec
:=
sqlgraph
.
NewQuerySpec
(
channelmonitor
.
Table
,
channelmonitor
.
Columns
,
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
))
_spec
.
From
=
_q
.
sql
if
unique
:=
_q
.
ctx
.
Unique
;
unique
!=
nil
{
_spec
.
Unique
=
*
unique
}
else
if
_q
.
path
!=
nil
{
_spec
.
Unique
=
true
}
if
fields
:=
_q
.
ctx
.
Fields
;
len
(
fields
)
>
0
{
_spec
.
Node
.
Columns
=
make
([]
string
,
0
,
len
(
fields
))
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
channelmonitor
.
FieldID
)
for
i
:=
range
fields
{
if
fields
[
i
]
!=
channelmonitor
.
FieldID
{
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
fields
[
i
])
}
}
if
_q
.
withRequestTemplate
!=
nil
{
_spec
.
Node
.
AddColumnOnce
(
channelmonitor
.
FieldTemplateID
)
}
}
if
ps
:=
_q
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
if
limit
:=
_q
.
ctx
.
Limit
;
limit
!=
nil
{
_spec
.
Limit
=
*
limit
}
if
offset
:=
_q
.
ctx
.
Offset
;
offset
!=
nil
{
_spec
.
Offset
=
*
offset
}
if
ps
:=
_q
.
order
;
len
(
ps
)
>
0
{
_spec
.
Order
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
return
_spec
}
func
(
_q
*
ChannelMonitorQuery
)
sqlQuery
(
ctx
context
.
Context
)
*
sql
.
Selector
{
builder
:=
sql
.
Dialect
(
_q
.
driver
.
Dialect
())
t1
:=
builder
.
Table
(
channelmonitor
.
Table
)
columns
:=
_q
.
ctx
.
Fields
if
len
(
columns
)
==
0
{
columns
=
channelmonitor
.
Columns
}
selector
:=
builder
.
Select
(
t1
.
Columns
(
columns
...
)
...
)
.
From
(
t1
)
if
_q
.
sql
!=
nil
{
selector
=
_q
.
sql
selector
.
Select
(
selector
.
Columns
(
columns
...
)
...
)
}
if
_q
.
ctx
.
Unique
!=
nil
&&
*
_q
.
ctx
.
Unique
{
selector
.
Distinct
()
}
for
_
,
m
:=
range
_q
.
modifiers
{
m
(
selector
)
}
for
_
,
p
:=
range
_q
.
predicates
{
p
(
selector
)
}
for
_
,
p
:=
range
_q
.
order
{
p
(
selector
)
}
if
offset
:=
_q
.
ctx
.
Offset
;
offset
!=
nil
{
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector
.
Offset
(
*
offset
)
.
Limit
(
math
.
MaxInt32
)
}
if
limit
:=
_q
.
ctx
.
Limit
;
limit
!=
nil
{
selector
.
Limit
(
*
limit
)
}
return
selector
}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being
// updated, deleted or "selected ... for update" by other sessions, until the transaction is
// either committed or rolled-back.
func
(
_q
*
ChannelMonitorQuery
)
ForUpdate
(
opts
...
sql
.
LockOption
)
*
ChannelMonitorQuery
{
if
_q
.
driver
.
Dialect
()
==
dialect
.
Postgres
{
_q
.
Unique
(
false
)
}
_q
.
modifiers
=
append
(
_q
.
modifiers
,
func
(
s
*
sql
.
Selector
)
{
s
.
ForUpdate
(
opts
...
)
})
return
_q
}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock
// on any rows that are read. Other sessions can read the rows, but cannot modify them
// until your transaction commits.
func
(
_q
*
ChannelMonitorQuery
)
ForShare
(
opts
...
sql
.
LockOption
)
*
ChannelMonitorQuery
{
if
_q
.
driver
.
Dialect
()
==
dialect
.
Postgres
{
_q
.
Unique
(
false
)
}
_q
.
modifiers
=
append
(
_q
.
modifiers
,
func
(
s
*
sql
.
Selector
)
{
s
.
ForShare
(
opts
...
)
})
return
_q
}
// ChannelMonitorGroupBy is the group-by builder for ChannelMonitor entities.
type
ChannelMonitorGroupBy
struct
{
selector
build
*
ChannelMonitorQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func
(
_g
*
ChannelMonitorGroupBy
)
Aggregate
(
fns
...
AggregateFunc
)
*
ChannelMonitorGroupBy
{
_g
.
fns
=
append
(
_g
.
fns
,
fns
...
)
return
_g
}
// Scan applies the selector query and scans the result into the given value.
func
(
_g
*
ChannelMonitorGroupBy
)
Scan
(
ctx
context
.
Context
,
v
any
)
error
{
ctx
=
setContextOp
(
ctx
,
_g
.
build
.
ctx
,
ent
.
OpQueryGroupBy
)
if
err
:=
_g
.
build
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
err
}
return
scanWithInterceptors
[
*
ChannelMonitorQuery
,
*
ChannelMonitorGroupBy
](
ctx
,
_g
.
build
,
_g
,
_g
.
build
.
inters
,
v
)
}
func
(
_g
*
ChannelMonitorGroupBy
)
sqlScan
(
ctx
context
.
Context
,
root
*
ChannelMonitorQuery
,
v
any
)
error
{
selector
:=
root
.
sqlQuery
(
ctx
)
.
Select
()
aggregation
:=
make
([]
string
,
0
,
len
(
_g
.
fns
))
for
_
,
fn
:=
range
_g
.
fns
{
aggregation
=
append
(
aggregation
,
fn
(
selector
))
}
if
len
(
selector
.
SelectedColumns
())
==
0
{
columns
:=
make
([]
string
,
0
,
len
(
*
_g
.
flds
)
+
len
(
_g
.
fns
))
for
_
,
f
:=
range
*
_g
.
flds
{
columns
=
append
(
columns
,
selector
.
C
(
f
))
}
columns
=
append
(
columns
,
aggregation
...
)
selector
.
Select
(
columns
...
)
}
selector
.
GroupBy
(
selector
.
Columns
(
*
_g
.
flds
...
)
...
)
if
err
:=
selector
.
Err
();
err
!=
nil
{
return
err
}
rows
:=
&
sql
.
Rows
{}
query
,
args
:=
selector
.
Query
()
if
err
:=
_g
.
build
.
driver
.
Query
(
ctx
,
query
,
args
,
rows
);
err
!=
nil
{
return
err
}
defer
rows
.
Close
()
return
sql
.
ScanSlice
(
rows
,
v
)
}
// ChannelMonitorSelect is the builder for selecting fields of ChannelMonitor entities.
type
ChannelMonitorSelect
struct
{
*
ChannelMonitorQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func
(
_s
*
ChannelMonitorSelect
)
Aggregate
(
fns
...
AggregateFunc
)
*
ChannelMonitorSelect
{
_s
.
fns
=
append
(
_s
.
fns
,
fns
...
)
return
_s
}
// Scan applies the selector query and scans the result into the given value.
func
(
_s
*
ChannelMonitorSelect
)
Scan
(
ctx
context
.
Context
,
v
any
)
error
{
ctx
=
setContextOp
(
ctx
,
_s
.
ctx
,
ent
.
OpQuerySelect
)
if
err
:=
_s
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
err
}
return
scanWithInterceptors
[
*
ChannelMonitorQuery
,
*
ChannelMonitorSelect
](
ctx
,
_s
.
ChannelMonitorQuery
,
_s
,
_s
.
inters
,
v
)
}
func
(
_s
*
ChannelMonitorSelect
)
sqlScan
(
ctx
context
.
Context
,
root
*
ChannelMonitorQuery
,
v
any
)
error
{
selector
:=
root
.
sqlQuery
(
ctx
)
aggregation
:=
make
([]
string
,
0
,
len
(
_s
.
fns
))
for
_
,
fn
:=
range
_s
.
fns
{
aggregation
=
append
(
aggregation
,
fn
(
selector
))
}
switch
n
:=
len
(
*
_s
.
selector
.
flds
);
{
case
n
==
0
&&
len
(
aggregation
)
>
0
:
selector
.
Select
(
aggregation
...
)
case
n
!=
0
&&
len
(
aggregation
)
>
0
:
selector
.
AppendSelect
(
aggregation
...
)
}
rows
:=
&
sql
.
Rows
{}
query
,
args
:=
selector
.
Query
()
if
err
:=
_s
.
driver
.
Query
(
ctx
,
query
,
args
,
rows
);
err
!=
nil
{
return
err
}
defer
rows
.
Close
()
return
sql
.
ScanSlice
(
rows
,
v
)
}
backend/ent/channelmonitor_update.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/dialect/sql/sqljson"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorrequesttemplate"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ChannelMonitorUpdate is the builder for updating ChannelMonitor entities.
type
ChannelMonitorUpdate
struct
{
config
hooks
[]
Hook
mutation
*
ChannelMonitorMutation
}
// Where appends a list predicates to the ChannelMonitorUpdate builder.
func
(
_u
*
ChannelMonitorUpdate
)
Where
(
ps
...
predicate
.
ChannelMonitor
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
Where
(
ps
...
)
return
_u
}
// SetUpdatedAt sets the "updated_at" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetUpdatedAt
(
v
time
.
Time
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetUpdatedAt
(
v
)
return
_u
}
// SetName sets the "name" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetName
(
v
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetName
(
v
)
return
_u
}
// SetNillableName sets the "name" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableName
(
v
*
string
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetName
(
*
v
)
}
return
_u
}
// SetProvider sets the "provider" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetProvider
(
v
channelmonitor
.
Provider
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetProvider
(
v
)
return
_u
}
// SetNillableProvider sets the "provider" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableProvider
(
v
*
channelmonitor
.
Provider
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetProvider
(
*
v
)
}
return
_u
}
// SetEndpoint sets the "endpoint" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetEndpoint
(
v
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetEndpoint
(
v
)
return
_u
}
// SetNillableEndpoint sets the "endpoint" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableEndpoint
(
v
*
string
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetEndpoint
(
*
v
)
}
return
_u
}
// SetAPIKeyEncrypted sets the "api_key_encrypted" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetAPIKeyEncrypted
(
v
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetAPIKeyEncrypted
(
v
)
return
_u
}
// SetNillableAPIKeyEncrypted sets the "api_key_encrypted" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableAPIKeyEncrypted
(
v
*
string
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetAPIKeyEncrypted
(
*
v
)
}
return
_u
}
// SetPrimaryModel sets the "primary_model" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetPrimaryModel
(
v
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetPrimaryModel
(
v
)
return
_u
}
// SetNillablePrimaryModel sets the "primary_model" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillablePrimaryModel
(
v
*
string
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetPrimaryModel
(
*
v
)
}
return
_u
}
// SetExtraModels sets the "extra_models" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetExtraModels
(
v
[]
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetExtraModels
(
v
)
return
_u
}
// AppendExtraModels appends value to the "extra_models" field.
func
(
_u
*
ChannelMonitorUpdate
)
AppendExtraModels
(
v
[]
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
AppendExtraModels
(
v
)
return
_u
}
// SetGroupName sets the "group_name" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetGroupName
(
v
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetGroupName
(
v
)
return
_u
}
// SetNillableGroupName sets the "group_name" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableGroupName
(
v
*
string
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetGroupName
(
*
v
)
}
return
_u
}
// ClearGroupName clears the value of the "group_name" field.
func
(
_u
*
ChannelMonitorUpdate
)
ClearGroupName
()
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ClearGroupName
()
return
_u
}
// SetEnabled sets the "enabled" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetEnabled
(
v
bool
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetEnabled
(
v
)
return
_u
}
// SetNillableEnabled sets the "enabled" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableEnabled
(
v
*
bool
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetEnabled
(
*
v
)
}
return
_u
}
// SetIntervalSeconds sets the "interval_seconds" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetIntervalSeconds
(
v
int
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ResetIntervalSeconds
()
_u
.
mutation
.
SetIntervalSeconds
(
v
)
return
_u
}
// SetNillableIntervalSeconds sets the "interval_seconds" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableIntervalSeconds
(
v
*
int
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetIntervalSeconds
(
*
v
)
}
return
_u
}
// AddIntervalSeconds adds value to the "interval_seconds" field.
func
(
_u
*
ChannelMonitorUpdate
)
AddIntervalSeconds
(
v
int
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
AddIntervalSeconds
(
v
)
return
_u
}
// SetLastCheckedAt sets the "last_checked_at" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetLastCheckedAt
(
v
time
.
Time
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetLastCheckedAt
(
v
)
return
_u
}
// SetNillableLastCheckedAt sets the "last_checked_at" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableLastCheckedAt
(
v
*
time
.
Time
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetLastCheckedAt
(
*
v
)
}
return
_u
}
// ClearLastCheckedAt clears the value of the "last_checked_at" field.
func
(
_u
*
ChannelMonitorUpdate
)
ClearLastCheckedAt
()
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ClearLastCheckedAt
()
return
_u
}
// SetCreatedBy sets the "created_by" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetCreatedBy
(
v
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ResetCreatedBy
()
_u
.
mutation
.
SetCreatedBy
(
v
)
return
_u
}
// SetNillableCreatedBy sets the "created_by" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableCreatedBy
(
v
*
int64
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetCreatedBy
(
*
v
)
}
return
_u
}
// AddCreatedBy adds value to the "created_by" field.
func
(
_u
*
ChannelMonitorUpdate
)
AddCreatedBy
(
v
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
AddCreatedBy
(
v
)
return
_u
}
// SetTemplateID sets the "template_id" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetTemplateID
(
v
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetTemplateID
(
v
)
return
_u
}
// SetNillableTemplateID sets the "template_id" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableTemplateID
(
v
*
int64
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetTemplateID
(
*
v
)
}
return
_u
}
// ClearTemplateID clears the value of the "template_id" field.
func
(
_u
*
ChannelMonitorUpdate
)
ClearTemplateID
()
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ClearTemplateID
()
return
_u
}
// SetExtraHeaders sets the "extra_headers" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetExtraHeaders
(
v
map
[
string
]
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetExtraHeaders
(
v
)
return
_u
}
// SetBodyOverrideMode sets the "body_override_mode" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetBodyOverrideMode
(
v
string
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetBodyOverrideMode
(
v
)
return
_u
}
// SetNillableBodyOverrideMode sets the "body_override_mode" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableBodyOverrideMode
(
v
*
string
)
*
ChannelMonitorUpdate
{
if
v
!=
nil
{
_u
.
SetBodyOverrideMode
(
*
v
)
}
return
_u
}
// SetBodyOverride sets the "body_override" field.
func
(
_u
*
ChannelMonitorUpdate
)
SetBodyOverride
(
v
map
[
string
]
interface
{})
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetBodyOverride
(
v
)
return
_u
}
// ClearBodyOverride clears the value of the "body_override" field.
func
(
_u
*
ChannelMonitorUpdate
)
ClearBodyOverride
()
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ClearBodyOverride
()
return
_u
}
// AddHistoryIDs adds the "history" edge to the ChannelMonitorHistory entity by IDs.
func
(
_u
*
ChannelMonitorUpdate
)
AddHistoryIDs
(
ids
...
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
AddHistoryIDs
(
ids
...
)
return
_u
}
// AddHistory adds the "history" edges to the ChannelMonitorHistory entity.
func
(
_u
*
ChannelMonitorUpdate
)
AddHistory
(
v
...*
ChannelMonitorHistory
)
*
ChannelMonitorUpdate
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
AddHistoryIDs
(
ids
...
)
}
// AddDailyRollupIDs adds the "daily_rollups" edge to the ChannelMonitorDailyRollup entity by IDs.
func
(
_u
*
ChannelMonitorUpdate
)
AddDailyRollupIDs
(
ids
...
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
AddDailyRollupIDs
(
ids
...
)
return
_u
}
// AddDailyRollups adds the "daily_rollups" edges to the ChannelMonitorDailyRollup entity.
func
(
_u
*
ChannelMonitorUpdate
)
AddDailyRollups
(
v
...*
ChannelMonitorDailyRollup
)
*
ChannelMonitorUpdate
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
AddDailyRollupIDs
(
ids
...
)
}
// SetRequestTemplateID sets the "request_template" edge to the ChannelMonitorRequestTemplate entity by ID.
func
(
_u
*
ChannelMonitorUpdate
)
SetRequestTemplateID
(
id
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
SetRequestTemplateID
(
id
)
return
_u
}
// SetNillableRequestTemplateID sets the "request_template" edge to the ChannelMonitorRequestTemplate entity by ID if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdate
)
SetNillableRequestTemplateID
(
id
*
int64
)
*
ChannelMonitorUpdate
{
if
id
!=
nil
{
_u
=
_u
.
SetRequestTemplateID
(
*
id
)
}
return
_u
}
// SetRequestTemplate sets the "request_template" edge to the ChannelMonitorRequestTemplate entity.
func
(
_u
*
ChannelMonitorUpdate
)
SetRequestTemplate
(
v
*
ChannelMonitorRequestTemplate
)
*
ChannelMonitorUpdate
{
return
_u
.
SetRequestTemplateID
(
v
.
ID
)
}
// Mutation returns the ChannelMonitorMutation object of the builder.
func
(
_u
*
ChannelMonitorUpdate
)
Mutation
()
*
ChannelMonitorMutation
{
return
_u
.
mutation
}
// ClearHistory clears all "history" edges to the ChannelMonitorHistory entity.
func
(
_u
*
ChannelMonitorUpdate
)
ClearHistory
()
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ClearHistory
()
return
_u
}
// RemoveHistoryIDs removes the "history" edge to ChannelMonitorHistory entities by IDs.
func
(
_u
*
ChannelMonitorUpdate
)
RemoveHistoryIDs
(
ids
...
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
RemoveHistoryIDs
(
ids
...
)
return
_u
}
// RemoveHistory removes "history" edges to ChannelMonitorHistory entities.
func
(
_u
*
ChannelMonitorUpdate
)
RemoveHistory
(
v
...*
ChannelMonitorHistory
)
*
ChannelMonitorUpdate
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
RemoveHistoryIDs
(
ids
...
)
}
// ClearDailyRollups clears all "daily_rollups" edges to the ChannelMonitorDailyRollup entity.
func
(
_u
*
ChannelMonitorUpdate
)
ClearDailyRollups
()
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ClearDailyRollups
()
return
_u
}
// RemoveDailyRollupIDs removes the "daily_rollups" edge to ChannelMonitorDailyRollup entities by IDs.
func
(
_u
*
ChannelMonitorUpdate
)
RemoveDailyRollupIDs
(
ids
...
int64
)
*
ChannelMonitorUpdate
{
_u
.
mutation
.
RemoveDailyRollupIDs
(
ids
...
)
return
_u
}
// RemoveDailyRollups removes "daily_rollups" edges to ChannelMonitorDailyRollup entities.
func
(
_u
*
ChannelMonitorUpdate
)
RemoveDailyRollups
(
v
...*
ChannelMonitorDailyRollup
)
*
ChannelMonitorUpdate
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
RemoveDailyRollupIDs
(
ids
...
)
}
// ClearRequestTemplate clears the "request_template" edge to the ChannelMonitorRequestTemplate entity.
func
(
_u
*
ChannelMonitorUpdate
)
ClearRequestTemplate
()
*
ChannelMonitorUpdate
{
_u
.
mutation
.
ClearRequestTemplate
()
return
_u
}
// Save executes the query and returns the number of nodes affected by the update operation.
func
(
_u
*
ChannelMonitorUpdate
)
Save
(
ctx
context
.
Context
)
(
int
,
error
)
{
_u
.
defaults
()
return
withHooks
(
ctx
,
_u
.
sqlSave
,
_u
.
mutation
,
_u
.
hooks
)
}
// SaveX is like Save, but panics if an error occurs.
func
(
_u
*
ChannelMonitorUpdate
)
SaveX
(
ctx
context
.
Context
)
int
{
affected
,
err
:=
_u
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
affected
}
// Exec executes the query.
func
(
_u
*
ChannelMonitorUpdate
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_u
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_u
*
ChannelMonitorUpdate
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_u
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// defaults sets the default values of the builder before save.
func
(
_u
*
ChannelMonitorUpdate
)
defaults
()
{
if
_
,
ok
:=
_u
.
mutation
.
UpdatedAt
();
!
ok
{
v
:=
channelmonitor
.
UpdateDefaultUpdatedAt
()
_u
.
mutation
.
SetUpdatedAt
(
v
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_u
*
ChannelMonitorUpdate
)
check
()
error
{
if
v
,
ok
:=
_u
.
mutation
.
Name
();
ok
{
if
err
:=
channelmonitor
.
NameValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"name"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.name": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Provider
();
ok
{
if
err
:=
channelmonitor
.
ProviderValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"provider"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.provider": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Endpoint
();
ok
{
if
err
:=
channelmonitor
.
EndpointValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"endpoint"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.endpoint": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
APIKeyEncrypted
();
ok
{
if
err
:=
channelmonitor
.
APIKeyEncryptedValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"api_key_encrypted"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.api_key_encrypted": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
PrimaryModel
();
ok
{
if
err
:=
channelmonitor
.
PrimaryModelValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"primary_model"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.primary_model": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
GroupName
();
ok
{
if
err
:=
channelmonitor
.
GroupNameValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"group_name"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.group_name": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
IntervalSeconds
();
ok
{
if
err
:=
channelmonitor
.
IntervalSecondsValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"interval_seconds"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.interval_seconds": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
BodyOverrideMode
();
ok
{
if
err
:=
channelmonitor
.
BodyOverrideModeValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"body_override_mode"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.body_override_mode": %w`
,
err
)}
}
}
return
nil
}
func
(
_u
*
ChannelMonitorUpdate
)
sqlSave
(
ctx
context
.
Context
)
(
_node
int
,
err
error
)
{
if
err
:=
_u
.
check
();
err
!=
nil
{
return
_node
,
err
}
_spec
:=
sqlgraph
.
NewUpdateSpec
(
channelmonitor
.
Table
,
channelmonitor
.
Columns
,
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
))
if
ps
:=
_u
.
mutation
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
if
value
,
ok
:=
_u
.
mutation
.
UpdatedAt
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldUpdatedAt
,
field
.
TypeTime
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
Name
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldName
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
Provider
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldProvider
,
field
.
TypeEnum
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
Endpoint
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldEndpoint
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
APIKeyEncrypted
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldAPIKeyEncrypted
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
PrimaryModel
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldPrimaryModel
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ExtraModels
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldExtraModels
,
field
.
TypeJSON
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AppendedExtraModels
();
ok
{
_spec
.
AddModifier
(
func
(
u
*
sql
.
UpdateBuilder
)
{
sqljson
.
Append
(
u
,
channelmonitor
.
FieldExtraModels
,
value
)
})
}
if
value
,
ok
:=
_u
.
mutation
.
GroupName
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldGroupName
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
GroupNameCleared
()
{
_spec
.
ClearField
(
channelmonitor
.
FieldGroupName
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
Enabled
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldEnabled
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
IntervalSeconds
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldIntervalSeconds
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedIntervalSeconds
();
ok
{
_spec
.
AddField
(
channelmonitor
.
FieldIntervalSeconds
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
LastCheckedAt
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldLastCheckedAt
,
field
.
TypeTime
,
value
)
}
if
_u
.
mutation
.
LastCheckedAtCleared
()
{
_spec
.
ClearField
(
channelmonitor
.
FieldLastCheckedAt
,
field
.
TypeTime
)
}
if
value
,
ok
:=
_u
.
mutation
.
CreatedBy
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldCreatedBy
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedCreatedBy
();
ok
{
_spec
.
AddField
(
channelmonitor
.
FieldCreatedBy
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ExtraHeaders
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldExtraHeaders
,
field
.
TypeJSON
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BodyOverrideMode
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldBodyOverrideMode
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BodyOverride
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldBodyOverride
,
field
.
TypeJSON
,
value
)
}
if
_u
.
mutation
.
BodyOverrideCleared
()
{
_spec
.
ClearField
(
channelmonitor
.
FieldBodyOverride
,
field
.
TypeJSON
)
}
if
_u
.
mutation
.
HistoryCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
HistoryTable
,
Columns
:
[]
string
{
channelmonitor
.
HistoryColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorhistory
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
RemovedHistoryIDs
();
len
(
nodes
)
>
0
&&
!
_u
.
mutation
.
HistoryCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
HistoryTable
,
Columns
:
[]
string
{
channelmonitor
.
HistoryColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorhistory
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
HistoryIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
HistoryTable
,
Columns
:
[]
string
{
channelmonitor
.
HistoryColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorhistory
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
if
_u
.
mutation
.
DailyRollupsCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
DailyRollupsTable
,
Columns
:
[]
string
{
channelmonitor
.
DailyRollupsColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
RemovedDailyRollupsIDs
();
len
(
nodes
)
>
0
&&
!
_u
.
mutation
.
DailyRollupsCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
DailyRollupsTable
,
Columns
:
[]
string
{
channelmonitor
.
DailyRollupsColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
DailyRollupsIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
DailyRollupsTable
,
Columns
:
[]
string
{
channelmonitor
.
DailyRollupsColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
if
_u
.
mutation
.
RequestTemplateCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
false
,
Table
:
channelmonitor
.
RequestTemplateTable
,
Columns
:
[]
string
{
channelmonitor
.
RequestTemplateColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorrequesttemplate
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
RequestTemplateIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
false
,
Table
:
channelmonitor
.
RequestTemplateTable
,
Columns
:
[]
string
{
channelmonitor
.
RequestTemplateColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorrequesttemplate
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
if
_node
,
err
=
sqlgraph
.
UpdateNodes
(
ctx
,
_u
.
driver
,
_spec
);
err
!=
nil
{
if
_
,
ok
:=
err
.
(
*
sqlgraph
.
NotFoundError
);
ok
{
err
=
&
NotFoundError
{
channelmonitor
.
Label
}
}
else
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
0
,
err
}
_u
.
mutation
.
done
=
true
return
_node
,
nil
}
// ChannelMonitorUpdateOne is the builder for updating a single ChannelMonitor entity.
type
ChannelMonitorUpdateOne
struct
{
config
fields
[]
string
hooks
[]
Hook
mutation
*
ChannelMonitorMutation
}
// SetUpdatedAt sets the "updated_at" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetUpdatedAt
(
v
time
.
Time
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetUpdatedAt
(
v
)
return
_u
}
// SetName sets the "name" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetName
(
v
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetName
(
v
)
return
_u
}
// SetNillableName sets the "name" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableName
(
v
*
string
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetName
(
*
v
)
}
return
_u
}
// SetProvider sets the "provider" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetProvider
(
v
channelmonitor
.
Provider
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetProvider
(
v
)
return
_u
}
// SetNillableProvider sets the "provider" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableProvider
(
v
*
channelmonitor
.
Provider
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetProvider
(
*
v
)
}
return
_u
}
// SetEndpoint sets the "endpoint" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetEndpoint
(
v
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetEndpoint
(
v
)
return
_u
}
// SetNillableEndpoint sets the "endpoint" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableEndpoint
(
v
*
string
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetEndpoint
(
*
v
)
}
return
_u
}
// SetAPIKeyEncrypted sets the "api_key_encrypted" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetAPIKeyEncrypted
(
v
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetAPIKeyEncrypted
(
v
)
return
_u
}
// SetNillableAPIKeyEncrypted sets the "api_key_encrypted" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableAPIKeyEncrypted
(
v
*
string
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetAPIKeyEncrypted
(
*
v
)
}
return
_u
}
// SetPrimaryModel sets the "primary_model" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetPrimaryModel
(
v
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetPrimaryModel
(
v
)
return
_u
}
// SetNillablePrimaryModel sets the "primary_model" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillablePrimaryModel
(
v
*
string
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetPrimaryModel
(
*
v
)
}
return
_u
}
// SetExtraModels sets the "extra_models" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetExtraModels
(
v
[]
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetExtraModels
(
v
)
return
_u
}
// AppendExtraModels appends value to the "extra_models" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
AppendExtraModels
(
v
[]
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
AppendExtraModels
(
v
)
return
_u
}
// SetGroupName sets the "group_name" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetGroupName
(
v
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetGroupName
(
v
)
return
_u
}
// SetNillableGroupName sets the "group_name" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableGroupName
(
v
*
string
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetGroupName
(
*
v
)
}
return
_u
}
// ClearGroupName clears the value of the "group_name" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
ClearGroupName
()
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ClearGroupName
()
return
_u
}
// SetEnabled sets the "enabled" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetEnabled
(
v
bool
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetEnabled
(
v
)
return
_u
}
// SetNillableEnabled sets the "enabled" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableEnabled
(
v
*
bool
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetEnabled
(
*
v
)
}
return
_u
}
// SetIntervalSeconds sets the "interval_seconds" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetIntervalSeconds
(
v
int
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ResetIntervalSeconds
()
_u
.
mutation
.
SetIntervalSeconds
(
v
)
return
_u
}
// SetNillableIntervalSeconds sets the "interval_seconds" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableIntervalSeconds
(
v
*
int
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetIntervalSeconds
(
*
v
)
}
return
_u
}
// AddIntervalSeconds adds value to the "interval_seconds" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
AddIntervalSeconds
(
v
int
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
AddIntervalSeconds
(
v
)
return
_u
}
// SetLastCheckedAt sets the "last_checked_at" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetLastCheckedAt
(
v
time
.
Time
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetLastCheckedAt
(
v
)
return
_u
}
// SetNillableLastCheckedAt sets the "last_checked_at" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableLastCheckedAt
(
v
*
time
.
Time
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetLastCheckedAt
(
*
v
)
}
return
_u
}
// ClearLastCheckedAt clears the value of the "last_checked_at" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
ClearLastCheckedAt
()
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ClearLastCheckedAt
()
return
_u
}
// SetCreatedBy sets the "created_by" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetCreatedBy
(
v
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ResetCreatedBy
()
_u
.
mutation
.
SetCreatedBy
(
v
)
return
_u
}
// SetNillableCreatedBy sets the "created_by" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableCreatedBy
(
v
*
int64
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetCreatedBy
(
*
v
)
}
return
_u
}
// AddCreatedBy adds value to the "created_by" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
AddCreatedBy
(
v
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
AddCreatedBy
(
v
)
return
_u
}
// SetTemplateID sets the "template_id" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetTemplateID
(
v
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetTemplateID
(
v
)
return
_u
}
// SetNillableTemplateID sets the "template_id" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableTemplateID
(
v
*
int64
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetTemplateID
(
*
v
)
}
return
_u
}
// ClearTemplateID clears the value of the "template_id" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
ClearTemplateID
()
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ClearTemplateID
()
return
_u
}
// SetExtraHeaders sets the "extra_headers" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetExtraHeaders
(
v
map
[
string
]
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetExtraHeaders
(
v
)
return
_u
}
// SetBodyOverrideMode sets the "body_override_mode" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetBodyOverrideMode
(
v
string
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetBodyOverrideMode
(
v
)
return
_u
}
// SetNillableBodyOverrideMode sets the "body_override_mode" field if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableBodyOverrideMode
(
v
*
string
)
*
ChannelMonitorUpdateOne
{
if
v
!=
nil
{
_u
.
SetBodyOverrideMode
(
*
v
)
}
return
_u
}
// SetBodyOverride sets the "body_override" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetBodyOverride
(
v
map
[
string
]
interface
{})
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetBodyOverride
(
v
)
return
_u
}
// ClearBodyOverride clears the value of the "body_override" field.
func
(
_u
*
ChannelMonitorUpdateOne
)
ClearBodyOverride
()
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ClearBodyOverride
()
return
_u
}
// AddHistoryIDs adds the "history" edge to the ChannelMonitorHistory entity by IDs.
func
(
_u
*
ChannelMonitorUpdateOne
)
AddHistoryIDs
(
ids
...
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
AddHistoryIDs
(
ids
...
)
return
_u
}
// AddHistory adds the "history" edges to the ChannelMonitorHistory entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
AddHistory
(
v
...*
ChannelMonitorHistory
)
*
ChannelMonitorUpdateOne
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
AddHistoryIDs
(
ids
...
)
}
// AddDailyRollupIDs adds the "daily_rollups" edge to the ChannelMonitorDailyRollup entity by IDs.
func
(
_u
*
ChannelMonitorUpdateOne
)
AddDailyRollupIDs
(
ids
...
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
AddDailyRollupIDs
(
ids
...
)
return
_u
}
// AddDailyRollups adds the "daily_rollups" edges to the ChannelMonitorDailyRollup entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
AddDailyRollups
(
v
...*
ChannelMonitorDailyRollup
)
*
ChannelMonitorUpdateOne
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
AddDailyRollupIDs
(
ids
...
)
}
// SetRequestTemplateID sets the "request_template" edge to the ChannelMonitorRequestTemplate entity by ID.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetRequestTemplateID
(
id
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
SetRequestTemplateID
(
id
)
return
_u
}
// SetNillableRequestTemplateID sets the "request_template" edge to the ChannelMonitorRequestTemplate entity by ID if the given value is not nil.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetNillableRequestTemplateID
(
id
*
int64
)
*
ChannelMonitorUpdateOne
{
if
id
!=
nil
{
_u
=
_u
.
SetRequestTemplateID
(
*
id
)
}
return
_u
}
// SetRequestTemplate sets the "request_template" edge to the ChannelMonitorRequestTemplate entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
SetRequestTemplate
(
v
*
ChannelMonitorRequestTemplate
)
*
ChannelMonitorUpdateOne
{
return
_u
.
SetRequestTemplateID
(
v
.
ID
)
}
// Mutation returns the ChannelMonitorMutation object of the builder.
func
(
_u
*
ChannelMonitorUpdateOne
)
Mutation
()
*
ChannelMonitorMutation
{
return
_u
.
mutation
}
// ClearHistory clears all "history" edges to the ChannelMonitorHistory entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
ClearHistory
()
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ClearHistory
()
return
_u
}
// RemoveHistoryIDs removes the "history" edge to ChannelMonitorHistory entities by IDs.
func
(
_u
*
ChannelMonitorUpdateOne
)
RemoveHistoryIDs
(
ids
...
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
RemoveHistoryIDs
(
ids
...
)
return
_u
}
// RemoveHistory removes "history" edges to ChannelMonitorHistory entities.
func
(
_u
*
ChannelMonitorUpdateOne
)
RemoveHistory
(
v
...*
ChannelMonitorHistory
)
*
ChannelMonitorUpdateOne
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
RemoveHistoryIDs
(
ids
...
)
}
// ClearDailyRollups clears all "daily_rollups" edges to the ChannelMonitorDailyRollup entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
ClearDailyRollups
()
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ClearDailyRollups
()
return
_u
}
// RemoveDailyRollupIDs removes the "daily_rollups" edge to ChannelMonitorDailyRollup entities by IDs.
func
(
_u
*
ChannelMonitorUpdateOne
)
RemoveDailyRollupIDs
(
ids
...
int64
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
RemoveDailyRollupIDs
(
ids
...
)
return
_u
}
// RemoveDailyRollups removes "daily_rollups" edges to ChannelMonitorDailyRollup entities.
func
(
_u
*
ChannelMonitorUpdateOne
)
RemoveDailyRollups
(
v
...*
ChannelMonitorDailyRollup
)
*
ChannelMonitorUpdateOne
{
ids
:=
make
([]
int64
,
len
(
v
))
for
i
:=
range
v
{
ids
[
i
]
=
v
[
i
]
.
ID
}
return
_u
.
RemoveDailyRollupIDs
(
ids
...
)
}
// ClearRequestTemplate clears the "request_template" edge to the ChannelMonitorRequestTemplate entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
ClearRequestTemplate
()
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
ClearRequestTemplate
()
return
_u
}
// Where appends a list predicates to the ChannelMonitorUpdate builder.
func
(
_u
*
ChannelMonitorUpdateOne
)
Where
(
ps
...
predicate
.
ChannelMonitor
)
*
ChannelMonitorUpdateOne
{
_u
.
mutation
.
Where
(
ps
...
)
return
_u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func
(
_u
*
ChannelMonitorUpdateOne
)
Select
(
field
string
,
fields
...
string
)
*
ChannelMonitorUpdateOne
{
_u
.
fields
=
append
([]
string
{
field
},
fields
...
)
return
_u
}
// Save executes the query and returns the updated ChannelMonitor entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
Save
(
ctx
context
.
Context
)
(
*
ChannelMonitor
,
error
)
{
_u
.
defaults
()
return
withHooks
(
ctx
,
_u
.
sqlSave
,
_u
.
mutation
,
_u
.
hooks
)
}
// SaveX is like Save, but panics if an error occurs.
func
(
_u
*
ChannelMonitorUpdateOne
)
SaveX
(
ctx
context
.
Context
)
*
ChannelMonitor
{
node
,
err
:=
_u
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
node
}
// Exec executes the query on the entity.
func
(
_u
*
ChannelMonitorUpdateOne
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_u
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_u
*
ChannelMonitorUpdateOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_u
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// defaults sets the default values of the builder before save.
func
(
_u
*
ChannelMonitorUpdateOne
)
defaults
()
{
if
_
,
ok
:=
_u
.
mutation
.
UpdatedAt
();
!
ok
{
v
:=
channelmonitor
.
UpdateDefaultUpdatedAt
()
_u
.
mutation
.
SetUpdatedAt
(
v
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_u
*
ChannelMonitorUpdateOne
)
check
()
error
{
if
v
,
ok
:=
_u
.
mutation
.
Name
();
ok
{
if
err
:=
channelmonitor
.
NameValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"name"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.name": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Provider
();
ok
{
if
err
:=
channelmonitor
.
ProviderValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"provider"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.provider": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Endpoint
();
ok
{
if
err
:=
channelmonitor
.
EndpointValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"endpoint"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.endpoint": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
APIKeyEncrypted
();
ok
{
if
err
:=
channelmonitor
.
APIKeyEncryptedValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"api_key_encrypted"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.api_key_encrypted": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
PrimaryModel
();
ok
{
if
err
:=
channelmonitor
.
PrimaryModelValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"primary_model"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.primary_model": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
GroupName
();
ok
{
if
err
:=
channelmonitor
.
GroupNameValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"group_name"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.group_name": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
IntervalSeconds
();
ok
{
if
err
:=
channelmonitor
.
IntervalSecondsValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"interval_seconds"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.interval_seconds": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
BodyOverrideMode
();
ok
{
if
err
:=
channelmonitor
.
BodyOverrideModeValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"body_override_mode"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitor.body_override_mode": %w`
,
err
)}
}
}
return
nil
}
func
(
_u
*
ChannelMonitorUpdateOne
)
sqlSave
(
ctx
context
.
Context
)
(
_node
*
ChannelMonitor
,
err
error
)
{
if
err
:=
_u
.
check
();
err
!=
nil
{
return
_node
,
err
}
_spec
:=
sqlgraph
.
NewUpdateSpec
(
channelmonitor
.
Table
,
channelmonitor
.
Columns
,
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
))
id
,
ok
:=
_u
.
mutation
.
ID
()
if
!
ok
{
return
nil
,
&
ValidationError
{
Name
:
"id"
,
err
:
errors
.
New
(
`ent: missing "ChannelMonitor.id" for update`
)}
}
_spec
.
Node
.
ID
.
Value
=
id
if
fields
:=
_u
.
fields
;
len
(
fields
)
>
0
{
_spec
.
Node
.
Columns
=
make
([]
string
,
0
,
len
(
fields
))
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
channelmonitor
.
FieldID
)
for
_
,
f
:=
range
fields
{
if
!
channelmonitor
.
ValidColumn
(
f
)
{
return
nil
,
&
ValidationError
{
Name
:
f
,
err
:
fmt
.
Errorf
(
"ent: invalid field %q for query"
,
f
)}
}
if
f
!=
channelmonitor
.
FieldID
{
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
f
)
}
}
}
if
ps
:=
_u
.
mutation
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
if
value
,
ok
:=
_u
.
mutation
.
UpdatedAt
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldUpdatedAt
,
field
.
TypeTime
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
Name
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldName
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
Provider
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldProvider
,
field
.
TypeEnum
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
Endpoint
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldEndpoint
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
APIKeyEncrypted
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldAPIKeyEncrypted
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
PrimaryModel
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldPrimaryModel
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ExtraModels
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldExtraModels
,
field
.
TypeJSON
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AppendedExtraModels
();
ok
{
_spec
.
AddModifier
(
func
(
u
*
sql
.
UpdateBuilder
)
{
sqljson
.
Append
(
u
,
channelmonitor
.
FieldExtraModels
,
value
)
})
}
if
value
,
ok
:=
_u
.
mutation
.
GroupName
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldGroupName
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
GroupNameCleared
()
{
_spec
.
ClearField
(
channelmonitor
.
FieldGroupName
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
Enabled
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldEnabled
,
field
.
TypeBool
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
IntervalSeconds
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldIntervalSeconds
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedIntervalSeconds
();
ok
{
_spec
.
AddField
(
channelmonitor
.
FieldIntervalSeconds
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
LastCheckedAt
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldLastCheckedAt
,
field
.
TypeTime
,
value
)
}
if
_u
.
mutation
.
LastCheckedAtCleared
()
{
_spec
.
ClearField
(
channelmonitor
.
FieldLastCheckedAt
,
field
.
TypeTime
)
}
if
value
,
ok
:=
_u
.
mutation
.
CreatedBy
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldCreatedBy
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedCreatedBy
();
ok
{
_spec
.
AddField
(
channelmonitor
.
FieldCreatedBy
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ExtraHeaders
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldExtraHeaders
,
field
.
TypeJSON
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BodyOverrideMode
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldBodyOverrideMode
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BodyOverride
();
ok
{
_spec
.
SetField
(
channelmonitor
.
FieldBodyOverride
,
field
.
TypeJSON
,
value
)
}
if
_u
.
mutation
.
BodyOverrideCleared
()
{
_spec
.
ClearField
(
channelmonitor
.
FieldBodyOverride
,
field
.
TypeJSON
)
}
if
_u
.
mutation
.
HistoryCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
HistoryTable
,
Columns
:
[]
string
{
channelmonitor
.
HistoryColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorhistory
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
RemovedHistoryIDs
();
len
(
nodes
)
>
0
&&
!
_u
.
mutation
.
HistoryCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
HistoryTable
,
Columns
:
[]
string
{
channelmonitor
.
HistoryColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorhistory
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
HistoryIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
HistoryTable
,
Columns
:
[]
string
{
channelmonitor
.
HistoryColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorhistory
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
if
_u
.
mutation
.
DailyRollupsCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
DailyRollupsTable
,
Columns
:
[]
string
{
channelmonitor
.
DailyRollupsColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
RemovedDailyRollupsIDs
();
len
(
nodes
)
>
0
&&
!
_u
.
mutation
.
DailyRollupsCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
DailyRollupsTable
,
Columns
:
[]
string
{
channelmonitor
.
DailyRollupsColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
DailyRollupsIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
O2M
,
Inverse
:
false
,
Table
:
channelmonitor
.
DailyRollupsTable
,
Columns
:
[]
string
{
channelmonitor
.
DailyRollupsColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
if
_u
.
mutation
.
RequestTemplateCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
false
,
Table
:
channelmonitor
.
RequestTemplateTable
,
Columns
:
[]
string
{
channelmonitor
.
RequestTemplateColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorrequesttemplate
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
RequestTemplateIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
false
,
Table
:
channelmonitor
.
RequestTemplateTable
,
Columns
:
[]
string
{
channelmonitor
.
RequestTemplateColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitorrequesttemplate
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
_node
=
&
ChannelMonitor
{
config
:
_u
.
config
}
_spec
.
Assign
=
_node
.
assignValues
_spec
.
ScanValues
=
_node
.
scanValues
if
err
=
sqlgraph
.
UpdateNode
(
ctx
,
_u
.
driver
,
_spec
);
err
!=
nil
{
if
_
,
ok
:=
err
.
(
*
sqlgraph
.
NotFoundError
);
ok
{
err
=
&
NotFoundError
{
channelmonitor
.
Label
}
}
else
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
nil
,
err
}
_u
.
mutation
.
done
=
true
return
_node
,
nil
}
backend/ent/channelmonitordailyrollup.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
)
// ChannelMonitorDailyRollup is the model entity for the ChannelMonitorDailyRollup schema.
type
ChannelMonitorDailyRollup
struct
{
config
`json:"-"`
// ID of the ent.
ID
int64
`json:"id,omitempty"`
// MonitorID holds the value of the "monitor_id" field.
MonitorID
int64
`json:"monitor_id,omitempty"`
// Model holds the value of the "model" field.
Model
string
`json:"model,omitempty"`
// BucketDate holds the value of the "bucket_date" field.
BucketDate
time
.
Time
`json:"bucket_date,omitempty"`
// TotalChecks holds the value of the "total_checks" field.
TotalChecks
int
`json:"total_checks,omitempty"`
// OkCount holds the value of the "ok_count" field.
OkCount
int
`json:"ok_count,omitempty"`
// OperationalCount holds the value of the "operational_count" field.
OperationalCount
int
`json:"operational_count,omitempty"`
// DegradedCount holds the value of the "degraded_count" field.
DegradedCount
int
`json:"degraded_count,omitempty"`
// FailedCount holds the value of the "failed_count" field.
FailedCount
int
`json:"failed_count,omitempty"`
// ErrorCount holds the value of the "error_count" field.
ErrorCount
int
`json:"error_count,omitempty"`
// SumLatencyMs holds the value of the "sum_latency_ms" field.
SumLatencyMs
int64
`json:"sum_latency_ms,omitempty"`
// CountLatency holds the value of the "count_latency" field.
CountLatency
int
`json:"count_latency,omitempty"`
// SumPingLatencyMs holds the value of the "sum_ping_latency_ms" field.
SumPingLatencyMs
int64
`json:"sum_ping_latency_ms,omitempty"`
// CountPingLatency holds the value of the "count_ping_latency" field.
CountPingLatency
int
`json:"count_ping_latency,omitempty"`
// ComputedAt holds the value of the "computed_at" field.
ComputedAt
time
.
Time
`json:"computed_at,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the ChannelMonitorDailyRollupQuery when eager-loading is set.
Edges
ChannelMonitorDailyRollupEdges
`json:"edges"`
selectValues
sql
.
SelectValues
}
// ChannelMonitorDailyRollupEdges holds the relations/edges for other nodes in the graph.
type
ChannelMonitorDailyRollupEdges
struct
{
// Monitor holds the value of the monitor edge.
Monitor
*
ChannelMonitor
`json:"monitor,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes
[
1
]
bool
}
// MonitorOrErr returns the Monitor value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func
(
e
ChannelMonitorDailyRollupEdges
)
MonitorOrErr
()
(
*
ChannelMonitor
,
error
)
{
if
e
.
Monitor
!=
nil
{
return
e
.
Monitor
,
nil
}
else
if
e
.
loadedTypes
[
0
]
{
return
nil
,
&
NotFoundError
{
label
:
channelmonitor
.
Label
}
}
return
nil
,
&
NotLoadedError
{
edge
:
"monitor"
}
}
// scanValues returns the types for scanning values from sql.Rows.
func
(
*
ChannelMonitorDailyRollup
)
scanValues
(
columns
[]
string
)
([]
any
,
error
)
{
values
:=
make
([]
any
,
len
(
columns
))
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
channelmonitordailyrollup
.
FieldID
,
channelmonitordailyrollup
.
FieldMonitorID
,
channelmonitordailyrollup
.
FieldTotalChecks
,
channelmonitordailyrollup
.
FieldOkCount
,
channelmonitordailyrollup
.
FieldOperationalCount
,
channelmonitordailyrollup
.
FieldDegradedCount
,
channelmonitordailyrollup
.
FieldFailedCount
,
channelmonitordailyrollup
.
FieldErrorCount
,
channelmonitordailyrollup
.
FieldSumLatencyMs
,
channelmonitordailyrollup
.
FieldCountLatency
,
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
channelmonitordailyrollup
.
FieldCountPingLatency
:
values
[
i
]
=
new
(
sql
.
NullInt64
)
case
channelmonitordailyrollup
.
FieldModel
:
values
[
i
]
=
new
(
sql
.
NullString
)
case
channelmonitordailyrollup
.
FieldBucketDate
,
channelmonitordailyrollup
.
FieldComputedAt
:
values
[
i
]
=
new
(
sql
.
NullTime
)
default
:
values
[
i
]
=
new
(
sql
.
UnknownType
)
}
}
return
values
,
nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the ChannelMonitorDailyRollup fields.
func
(
_m
*
ChannelMonitorDailyRollup
)
assignValues
(
columns
[]
string
,
values
[]
any
)
error
{
if
m
,
n
:=
len
(
values
),
len
(
columns
);
m
<
n
{
return
fmt
.
Errorf
(
"mismatch number of scan values: %d != %d"
,
m
,
n
)
}
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
channelmonitordailyrollup
.
FieldID
:
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
)
if
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field id"
,
value
)
}
_m
.
ID
=
int64
(
value
.
Int64
)
case
channelmonitordailyrollup
.
FieldMonitorID
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field monitor_id"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
MonitorID
=
value
.
Int64
}
case
channelmonitordailyrollup
.
FieldModel
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field model"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Model
=
value
.
String
}
case
channelmonitordailyrollup
.
FieldBucketDate
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field bucket_date"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
BucketDate
=
value
.
Time
}
case
channelmonitordailyrollup
.
FieldTotalChecks
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field total_checks"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
TotalChecks
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldOkCount
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field ok_count"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
OkCount
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldOperationalCount
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field operational_count"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
OperationalCount
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldDegradedCount
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field degraded_count"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
DegradedCount
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldFailedCount
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field failed_count"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
FailedCount
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldErrorCount
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field error_count"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
ErrorCount
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldSumLatencyMs
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field sum_latency_ms"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
SumLatencyMs
=
value
.
Int64
}
case
channelmonitordailyrollup
.
FieldCountLatency
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field count_latency"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
CountLatency
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldSumPingLatencyMs
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field sum_ping_latency_ms"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
SumPingLatencyMs
=
value
.
Int64
}
case
channelmonitordailyrollup
.
FieldCountPingLatency
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field count_ping_latency"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
CountPingLatency
=
int
(
value
.
Int64
)
}
case
channelmonitordailyrollup
.
FieldComputedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field computed_at"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
ComputedAt
=
value
.
Time
}
default
:
_m
.
selectValues
.
Set
(
columns
[
i
],
values
[
i
])
}
}
return
nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the ChannelMonitorDailyRollup.
// This includes values selected through modifiers, order, etc.
func
(
_m
*
ChannelMonitorDailyRollup
)
Value
(
name
string
)
(
ent
.
Value
,
error
)
{
return
_m
.
selectValues
.
Get
(
name
)
}
// QueryMonitor queries the "monitor" edge of the ChannelMonitorDailyRollup entity.
func
(
_m
*
ChannelMonitorDailyRollup
)
QueryMonitor
()
*
ChannelMonitorQuery
{
return
NewChannelMonitorDailyRollupClient
(
_m
.
config
)
.
QueryMonitor
(
_m
)
}
// Update returns a builder for updating this ChannelMonitorDailyRollup.
// Note that you need to call ChannelMonitorDailyRollup.Unwrap() before calling this method if this ChannelMonitorDailyRollup
// was returned from a transaction, and the transaction was committed or rolled back.
func
(
_m
*
ChannelMonitorDailyRollup
)
Update
()
*
ChannelMonitorDailyRollupUpdateOne
{
return
NewChannelMonitorDailyRollupClient
(
_m
.
config
)
.
UpdateOne
(
_m
)
}
// Unwrap unwraps the ChannelMonitorDailyRollup entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func
(
_m
*
ChannelMonitorDailyRollup
)
Unwrap
()
*
ChannelMonitorDailyRollup
{
_tx
,
ok
:=
_m
.
config
.
driver
.
(
*
txDriver
)
if
!
ok
{
panic
(
"ent: ChannelMonitorDailyRollup is not a transactional entity"
)
}
_m
.
config
.
driver
=
_tx
.
drv
return
_m
}
// String implements the fmt.Stringer.
func
(
_m
*
ChannelMonitorDailyRollup
)
String
()
string
{
var
builder
strings
.
Builder
builder
.
WriteString
(
"ChannelMonitorDailyRollup("
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"id=%v, "
,
_m
.
ID
))
builder
.
WriteString
(
"monitor_id="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
MonitorID
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"model="
)
builder
.
WriteString
(
_m
.
Model
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"bucket_date="
)
builder
.
WriteString
(
_m
.
BucketDate
.
Format
(
time
.
ANSIC
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"total_checks="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
TotalChecks
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"ok_count="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
OkCount
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"operational_count="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
OperationalCount
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"degraded_count="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
DegradedCount
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"failed_count="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
FailedCount
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"error_count="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
ErrorCount
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"sum_latency_ms="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
SumLatencyMs
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"count_latency="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
CountLatency
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"sum_ping_latency_ms="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
SumPingLatencyMs
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"count_ping_latency="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
CountPingLatency
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"computed_at="
)
builder
.
WriteString
(
_m
.
ComputedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteByte
(
')'
)
return
builder
.
String
()
}
// ChannelMonitorDailyRollups is a parsable slice of ChannelMonitorDailyRollup.
type
ChannelMonitorDailyRollups
[]
*
ChannelMonitorDailyRollup
backend/ent/channelmonitordailyrollup/channelmonitordailyrollup.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
channelmonitordailyrollup
import
(
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const
(
// Label holds the string label denoting the channelmonitordailyrollup type in the database.
Label
=
"channel_monitor_daily_rollup"
// 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"
// FieldBucketDate holds the string denoting the bucket_date field in the database.
FieldBucketDate
=
"bucket_date"
// FieldTotalChecks holds the string denoting the total_checks field in the database.
FieldTotalChecks
=
"total_checks"
// FieldOkCount holds the string denoting the ok_count field in the database.
FieldOkCount
=
"ok_count"
// FieldOperationalCount holds the string denoting the operational_count field in the database.
FieldOperationalCount
=
"operational_count"
// FieldDegradedCount holds the string denoting the degraded_count field in the database.
FieldDegradedCount
=
"degraded_count"
// FieldFailedCount holds the string denoting the failed_count field in the database.
FieldFailedCount
=
"failed_count"
// FieldErrorCount holds the string denoting the error_count field in the database.
FieldErrorCount
=
"error_count"
// FieldSumLatencyMs holds the string denoting the sum_latency_ms field in the database.
FieldSumLatencyMs
=
"sum_latency_ms"
// FieldCountLatency holds the string denoting the count_latency field in the database.
FieldCountLatency
=
"count_latency"
// FieldSumPingLatencyMs holds the string denoting the sum_ping_latency_ms field in the database.
FieldSumPingLatencyMs
=
"sum_ping_latency_ms"
// FieldCountPingLatency holds the string denoting the count_ping_latency field in the database.
FieldCountPingLatency
=
"count_ping_latency"
// FieldComputedAt holds the string denoting the computed_at field in the database.
FieldComputedAt
=
"computed_at"
// EdgeMonitor holds the string denoting the monitor edge name in mutations.
EdgeMonitor
=
"monitor"
// Table holds the table name of the channelmonitordailyrollup in the database.
Table
=
"channel_monitor_daily_rollups"
// MonitorTable is the table that holds the monitor relation/edge.
MonitorTable
=
"channel_monitor_daily_rollups"
// 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 channelmonitordailyrollup fields.
var
Columns
=
[]
string
{
FieldID
,
FieldMonitorID
,
FieldModel
,
FieldBucketDate
,
FieldTotalChecks
,
FieldOkCount
,
FieldOperationalCount
,
FieldDegradedCount
,
FieldFailedCount
,
FieldErrorCount
,
FieldSumLatencyMs
,
FieldCountLatency
,
FieldSumPingLatencyMs
,
FieldCountPingLatency
,
FieldComputedAt
,
}
// 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
// DefaultTotalChecks holds the default value on creation for the "total_checks" field.
DefaultTotalChecks
int
// DefaultOkCount holds the default value on creation for the "ok_count" field.
DefaultOkCount
int
// DefaultOperationalCount holds the default value on creation for the "operational_count" field.
DefaultOperationalCount
int
// DefaultDegradedCount holds the default value on creation for the "degraded_count" field.
DefaultDegradedCount
int
// DefaultFailedCount holds the default value on creation for the "failed_count" field.
DefaultFailedCount
int
// DefaultErrorCount holds the default value on creation for the "error_count" field.
DefaultErrorCount
int
// DefaultSumLatencyMs holds the default value on creation for the "sum_latency_ms" field.
DefaultSumLatencyMs
int64
// DefaultCountLatency holds the default value on creation for the "count_latency" field.
DefaultCountLatency
int
// DefaultSumPingLatencyMs holds the default value on creation for the "sum_ping_latency_ms" field.
DefaultSumPingLatencyMs
int64
// DefaultCountPingLatency holds the default value on creation for the "count_ping_latency" field.
DefaultCountPingLatency
int
// DefaultComputedAt holds the default value on creation for the "computed_at" field.
DefaultComputedAt
func
()
time
.
Time
// UpdateDefaultComputedAt holds the default value on update for the "computed_at" field.
UpdateDefaultComputedAt
func
()
time
.
Time
)
// OrderOption defines the ordering options for the ChannelMonitorDailyRollup 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
()
}
// ByBucketDate orders the results by the bucket_date field.
func
ByBucketDate
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldBucketDate
,
opts
...
)
.
ToFunc
()
}
// ByTotalChecks orders the results by the total_checks field.
func
ByTotalChecks
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldTotalChecks
,
opts
...
)
.
ToFunc
()
}
// ByOkCount orders the results by the ok_count field.
func
ByOkCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldOkCount
,
opts
...
)
.
ToFunc
()
}
// ByOperationalCount orders the results by the operational_count field.
func
ByOperationalCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldOperationalCount
,
opts
...
)
.
ToFunc
()
}
// ByDegradedCount orders the results by the degraded_count field.
func
ByDegradedCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldDegradedCount
,
opts
...
)
.
ToFunc
()
}
// ByFailedCount orders the results by the failed_count field.
func
ByFailedCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldFailedCount
,
opts
...
)
.
ToFunc
()
}
// ByErrorCount orders the results by the error_count field.
func
ByErrorCount
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldErrorCount
,
opts
...
)
.
ToFunc
()
}
// BySumLatencyMs orders the results by the sum_latency_ms field.
func
BySumLatencyMs
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldSumLatencyMs
,
opts
...
)
.
ToFunc
()
}
// ByCountLatency orders the results by the count_latency field.
func
ByCountLatency
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldCountLatency
,
opts
...
)
.
ToFunc
()
}
// BySumPingLatencyMs orders the results by the sum_ping_latency_ms field.
func
BySumPingLatencyMs
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldSumPingLatencyMs
,
opts
...
)
.
ToFunc
()
}
// ByCountPingLatency orders the results by the count_ping_latency field.
func
ByCountPingLatency
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldCountPingLatency
,
opts
...
)
.
ToFunc
()
}
// ByComputedAt orders the results by the computed_at field.
func
ByComputedAt
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldComputedAt
,
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
),
)
}
backend/ent/channelmonitordailyrollup/where.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
channelmonitordailyrollup
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
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDEQ applies the EQ predicate on the ID field.
func
IDEQ
(
id
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDNEQ applies the NEQ predicate on the ID field.
func
IDNEQ
(
id
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldID
,
id
))
}
// IDIn applies the In predicate on the ID field.
func
IDIn
(
ids
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldID
,
ids
...
))
}
// IDNotIn applies the NotIn predicate on the ID field.
func
IDNotIn
(
ids
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldID
,
ids
...
))
}
// IDGT applies the GT predicate on the ID field.
func
IDGT
(
id
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldID
,
id
))
}
// IDGTE applies the GTE predicate on the ID field.
func
IDGTE
(
id
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldID
,
id
))
}
// IDLT applies the LT predicate on the ID field.
func
IDLT
(
id
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldID
,
id
))
}
// IDLTE applies the LTE predicate on the ID field.
func
IDLTE
(
id
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldID
,
id
))
}
// MonitorID applies equality check predicate on the "monitor_id" field. It's identical to MonitorIDEQ.
func
MonitorID
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldMonitorID
,
v
))
}
// Model applies equality check predicate on the "model" field. It's identical to ModelEQ.
func
Model
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldModel
,
v
))
}
// BucketDate applies equality check predicate on the "bucket_date" field. It's identical to BucketDateEQ.
func
BucketDate
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldBucketDate
,
v
))
}
// TotalChecks applies equality check predicate on the "total_checks" field. It's identical to TotalChecksEQ.
func
TotalChecks
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldTotalChecks
,
v
))
}
// OkCount applies equality check predicate on the "ok_count" field. It's identical to OkCountEQ.
func
OkCount
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldOkCount
,
v
))
}
// OperationalCount applies equality check predicate on the "operational_count" field. It's identical to OperationalCountEQ.
func
OperationalCount
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldOperationalCount
,
v
))
}
// DegradedCount applies equality check predicate on the "degraded_count" field. It's identical to DegradedCountEQ.
func
DegradedCount
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldDegradedCount
,
v
))
}
// FailedCount applies equality check predicate on the "failed_count" field. It's identical to FailedCountEQ.
func
FailedCount
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldFailedCount
,
v
))
}
// ErrorCount applies equality check predicate on the "error_count" field. It's identical to ErrorCountEQ.
func
ErrorCount
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldErrorCount
,
v
))
}
// SumLatencyMs applies equality check predicate on the "sum_latency_ms" field. It's identical to SumLatencyMsEQ.
func
SumLatencyMs
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldSumLatencyMs
,
v
))
}
// CountLatency applies equality check predicate on the "count_latency" field. It's identical to CountLatencyEQ.
func
CountLatency
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldCountLatency
,
v
))
}
// SumPingLatencyMs applies equality check predicate on the "sum_ping_latency_ms" field. It's identical to SumPingLatencyMsEQ.
func
SumPingLatencyMs
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldSumPingLatencyMs
,
v
))
}
// CountPingLatency applies equality check predicate on the "count_ping_latency" field. It's identical to CountPingLatencyEQ.
func
CountPingLatency
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldCountPingLatency
,
v
))
}
// ComputedAt applies equality check predicate on the "computed_at" field. It's identical to ComputedAtEQ.
func
ComputedAt
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldComputedAt
,
v
))
}
// MonitorIDEQ applies the EQ predicate on the "monitor_id" field.
func
MonitorIDEQ
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldMonitorID
,
v
))
}
// MonitorIDNEQ applies the NEQ predicate on the "monitor_id" field.
func
MonitorIDNEQ
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldMonitorID
,
v
))
}
// MonitorIDIn applies the In predicate on the "monitor_id" field.
func
MonitorIDIn
(
vs
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldMonitorID
,
vs
...
))
}
// MonitorIDNotIn applies the NotIn predicate on the "monitor_id" field.
func
MonitorIDNotIn
(
vs
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldMonitorID
,
vs
...
))
}
// ModelEQ applies the EQ predicate on the "model" field.
func
ModelEQ
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldModel
,
v
))
}
// ModelNEQ applies the NEQ predicate on the "model" field.
func
ModelNEQ
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldModel
,
v
))
}
// ModelIn applies the In predicate on the "model" field.
func
ModelIn
(
vs
...
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldModel
,
vs
...
))
}
// ModelNotIn applies the NotIn predicate on the "model" field.
func
ModelNotIn
(
vs
...
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldModel
,
vs
...
))
}
// ModelGT applies the GT predicate on the "model" field.
func
ModelGT
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldModel
,
v
))
}
// ModelGTE applies the GTE predicate on the "model" field.
func
ModelGTE
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldModel
,
v
))
}
// ModelLT applies the LT predicate on the "model" field.
func
ModelLT
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldModel
,
v
))
}
// ModelLTE applies the LTE predicate on the "model" field.
func
ModelLTE
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldModel
,
v
))
}
// ModelContains applies the Contains predicate on the "model" field.
func
ModelContains
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldContains
(
FieldModel
,
v
))
}
// ModelHasPrefix applies the HasPrefix predicate on the "model" field.
func
ModelHasPrefix
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldHasPrefix
(
FieldModel
,
v
))
}
// ModelHasSuffix applies the HasSuffix predicate on the "model" field.
func
ModelHasSuffix
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldHasSuffix
(
FieldModel
,
v
))
}
// ModelEqualFold applies the EqualFold predicate on the "model" field.
func
ModelEqualFold
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEqualFold
(
FieldModel
,
v
))
}
// ModelContainsFold applies the ContainsFold predicate on the "model" field.
func
ModelContainsFold
(
v
string
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldContainsFold
(
FieldModel
,
v
))
}
// BucketDateEQ applies the EQ predicate on the "bucket_date" field.
func
BucketDateEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldBucketDate
,
v
))
}
// BucketDateNEQ applies the NEQ predicate on the "bucket_date" field.
func
BucketDateNEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldBucketDate
,
v
))
}
// BucketDateIn applies the In predicate on the "bucket_date" field.
func
BucketDateIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldBucketDate
,
vs
...
))
}
// BucketDateNotIn applies the NotIn predicate on the "bucket_date" field.
func
BucketDateNotIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldBucketDate
,
vs
...
))
}
// BucketDateGT applies the GT predicate on the "bucket_date" field.
func
BucketDateGT
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldBucketDate
,
v
))
}
// BucketDateGTE applies the GTE predicate on the "bucket_date" field.
func
BucketDateGTE
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldBucketDate
,
v
))
}
// BucketDateLT applies the LT predicate on the "bucket_date" field.
func
BucketDateLT
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldBucketDate
,
v
))
}
// BucketDateLTE applies the LTE predicate on the "bucket_date" field.
func
BucketDateLTE
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldBucketDate
,
v
))
}
// TotalChecksEQ applies the EQ predicate on the "total_checks" field.
func
TotalChecksEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldTotalChecks
,
v
))
}
// TotalChecksNEQ applies the NEQ predicate on the "total_checks" field.
func
TotalChecksNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldTotalChecks
,
v
))
}
// TotalChecksIn applies the In predicate on the "total_checks" field.
func
TotalChecksIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldTotalChecks
,
vs
...
))
}
// TotalChecksNotIn applies the NotIn predicate on the "total_checks" field.
func
TotalChecksNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldTotalChecks
,
vs
...
))
}
// TotalChecksGT applies the GT predicate on the "total_checks" field.
func
TotalChecksGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldTotalChecks
,
v
))
}
// TotalChecksGTE applies the GTE predicate on the "total_checks" field.
func
TotalChecksGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldTotalChecks
,
v
))
}
// TotalChecksLT applies the LT predicate on the "total_checks" field.
func
TotalChecksLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldTotalChecks
,
v
))
}
// TotalChecksLTE applies the LTE predicate on the "total_checks" field.
func
TotalChecksLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldTotalChecks
,
v
))
}
// OkCountEQ applies the EQ predicate on the "ok_count" field.
func
OkCountEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldOkCount
,
v
))
}
// OkCountNEQ applies the NEQ predicate on the "ok_count" field.
func
OkCountNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldOkCount
,
v
))
}
// OkCountIn applies the In predicate on the "ok_count" field.
func
OkCountIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldOkCount
,
vs
...
))
}
// OkCountNotIn applies the NotIn predicate on the "ok_count" field.
func
OkCountNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldOkCount
,
vs
...
))
}
// OkCountGT applies the GT predicate on the "ok_count" field.
func
OkCountGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldOkCount
,
v
))
}
// OkCountGTE applies the GTE predicate on the "ok_count" field.
func
OkCountGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldOkCount
,
v
))
}
// OkCountLT applies the LT predicate on the "ok_count" field.
func
OkCountLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldOkCount
,
v
))
}
// OkCountLTE applies the LTE predicate on the "ok_count" field.
func
OkCountLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldOkCount
,
v
))
}
// OperationalCountEQ applies the EQ predicate on the "operational_count" field.
func
OperationalCountEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldOperationalCount
,
v
))
}
// OperationalCountNEQ applies the NEQ predicate on the "operational_count" field.
func
OperationalCountNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldOperationalCount
,
v
))
}
// OperationalCountIn applies the In predicate on the "operational_count" field.
func
OperationalCountIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldOperationalCount
,
vs
...
))
}
// OperationalCountNotIn applies the NotIn predicate on the "operational_count" field.
func
OperationalCountNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldOperationalCount
,
vs
...
))
}
// OperationalCountGT applies the GT predicate on the "operational_count" field.
func
OperationalCountGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldOperationalCount
,
v
))
}
// OperationalCountGTE applies the GTE predicate on the "operational_count" field.
func
OperationalCountGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldOperationalCount
,
v
))
}
// OperationalCountLT applies the LT predicate on the "operational_count" field.
func
OperationalCountLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldOperationalCount
,
v
))
}
// OperationalCountLTE applies the LTE predicate on the "operational_count" field.
func
OperationalCountLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldOperationalCount
,
v
))
}
// DegradedCountEQ applies the EQ predicate on the "degraded_count" field.
func
DegradedCountEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldDegradedCount
,
v
))
}
// DegradedCountNEQ applies the NEQ predicate on the "degraded_count" field.
func
DegradedCountNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldDegradedCount
,
v
))
}
// DegradedCountIn applies the In predicate on the "degraded_count" field.
func
DegradedCountIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldDegradedCount
,
vs
...
))
}
// DegradedCountNotIn applies the NotIn predicate on the "degraded_count" field.
func
DegradedCountNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldDegradedCount
,
vs
...
))
}
// DegradedCountGT applies the GT predicate on the "degraded_count" field.
func
DegradedCountGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldDegradedCount
,
v
))
}
// DegradedCountGTE applies the GTE predicate on the "degraded_count" field.
func
DegradedCountGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldDegradedCount
,
v
))
}
// DegradedCountLT applies the LT predicate on the "degraded_count" field.
func
DegradedCountLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldDegradedCount
,
v
))
}
// DegradedCountLTE applies the LTE predicate on the "degraded_count" field.
func
DegradedCountLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldDegradedCount
,
v
))
}
// FailedCountEQ applies the EQ predicate on the "failed_count" field.
func
FailedCountEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldFailedCount
,
v
))
}
// FailedCountNEQ applies the NEQ predicate on the "failed_count" field.
func
FailedCountNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldFailedCount
,
v
))
}
// FailedCountIn applies the In predicate on the "failed_count" field.
func
FailedCountIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldFailedCount
,
vs
...
))
}
// FailedCountNotIn applies the NotIn predicate on the "failed_count" field.
func
FailedCountNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldFailedCount
,
vs
...
))
}
// FailedCountGT applies the GT predicate on the "failed_count" field.
func
FailedCountGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldFailedCount
,
v
))
}
// FailedCountGTE applies the GTE predicate on the "failed_count" field.
func
FailedCountGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldFailedCount
,
v
))
}
// FailedCountLT applies the LT predicate on the "failed_count" field.
func
FailedCountLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldFailedCount
,
v
))
}
// FailedCountLTE applies the LTE predicate on the "failed_count" field.
func
FailedCountLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldFailedCount
,
v
))
}
// ErrorCountEQ applies the EQ predicate on the "error_count" field.
func
ErrorCountEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldErrorCount
,
v
))
}
// ErrorCountNEQ applies the NEQ predicate on the "error_count" field.
func
ErrorCountNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldErrorCount
,
v
))
}
// ErrorCountIn applies the In predicate on the "error_count" field.
func
ErrorCountIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldErrorCount
,
vs
...
))
}
// ErrorCountNotIn applies the NotIn predicate on the "error_count" field.
func
ErrorCountNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldErrorCount
,
vs
...
))
}
// ErrorCountGT applies the GT predicate on the "error_count" field.
func
ErrorCountGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldErrorCount
,
v
))
}
// ErrorCountGTE applies the GTE predicate on the "error_count" field.
func
ErrorCountGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldErrorCount
,
v
))
}
// ErrorCountLT applies the LT predicate on the "error_count" field.
func
ErrorCountLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldErrorCount
,
v
))
}
// ErrorCountLTE applies the LTE predicate on the "error_count" field.
func
ErrorCountLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldErrorCount
,
v
))
}
// SumLatencyMsEQ applies the EQ predicate on the "sum_latency_ms" field.
func
SumLatencyMsEQ
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldSumLatencyMs
,
v
))
}
// SumLatencyMsNEQ applies the NEQ predicate on the "sum_latency_ms" field.
func
SumLatencyMsNEQ
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldSumLatencyMs
,
v
))
}
// SumLatencyMsIn applies the In predicate on the "sum_latency_ms" field.
func
SumLatencyMsIn
(
vs
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldSumLatencyMs
,
vs
...
))
}
// SumLatencyMsNotIn applies the NotIn predicate on the "sum_latency_ms" field.
func
SumLatencyMsNotIn
(
vs
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldSumLatencyMs
,
vs
...
))
}
// SumLatencyMsGT applies the GT predicate on the "sum_latency_ms" field.
func
SumLatencyMsGT
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldSumLatencyMs
,
v
))
}
// SumLatencyMsGTE applies the GTE predicate on the "sum_latency_ms" field.
func
SumLatencyMsGTE
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldSumLatencyMs
,
v
))
}
// SumLatencyMsLT applies the LT predicate on the "sum_latency_ms" field.
func
SumLatencyMsLT
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldSumLatencyMs
,
v
))
}
// SumLatencyMsLTE applies the LTE predicate on the "sum_latency_ms" field.
func
SumLatencyMsLTE
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldSumLatencyMs
,
v
))
}
// CountLatencyEQ applies the EQ predicate on the "count_latency" field.
func
CountLatencyEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldCountLatency
,
v
))
}
// CountLatencyNEQ applies the NEQ predicate on the "count_latency" field.
func
CountLatencyNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldCountLatency
,
v
))
}
// CountLatencyIn applies the In predicate on the "count_latency" field.
func
CountLatencyIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldCountLatency
,
vs
...
))
}
// CountLatencyNotIn applies the NotIn predicate on the "count_latency" field.
func
CountLatencyNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldCountLatency
,
vs
...
))
}
// CountLatencyGT applies the GT predicate on the "count_latency" field.
func
CountLatencyGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldCountLatency
,
v
))
}
// CountLatencyGTE applies the GTE predicate on the "count_latency" field.
func
CountLatencyGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldCountLatency
,
v
))
}
// CountLatencyLT applies the LT predicate on the "count_latency" field.
func
CountLatencyLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldCountLatency
,
v
))
}
// CountLatencyLTE applies the LTE predicate on the "count_latency" field.
func
CountLatencyLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldCountLatency
,
v
))
}
// SumPingLatencyMsEQ applies the EQ predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsEQ
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldSumPingLatencyMs
,
v
))
}
// SumPingLatencyMsNEQ applies the NEQ predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsNEQ
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldSumPingLatencyMs
,
v
))
}
// SumPingLatencyMsIn applies the In predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsIn
(
vs
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldSumPingLatencyMs
,
vs
...
))
}
// SumPingLatencyMsNotIn applies the NotIn predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsNotIn
(
vs
...
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldSumPingLatencyMs
,
vs
...
))
}
// SumPingLatencyMsGT applies the GT predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsGT
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldSumPingLatencyMs
,
v
))
}
// SumPingLatencyMsGTE applies the GTE predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsGTE
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldSumPingLatencyMs
,
v
))
}
// SumPingLatencyMsLT applies the LT predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsLT
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldSumPingLatencyMs
,
v
))
}
// SumPingLatencyMsLTE applies the LTE predicate on the "sum_ping_latency_ms" field.
func
SumPingLatencyMsLTE
(
v
int64
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldSumPingLatencyMs
,
v
))
}
// CountPingLatencyEQ applies the EQ predicate on the "count_ping_latency" field.
func
CountPingLatencyEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldCountPingLatency
,
v
))
}
// CountPingLatencyNEQ applies the NEQ predicate on the "count_ping_latency" field.
func
CountPingLatencyNEQ
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldCountPingLatency
,
v
))
}
// CountPingLatencyIn applies the In predicate on the "count_ping_latency" field.
func
CountPingLatencyIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldCountPingLatency
,
vs
...
))
}
// CountPingLatencyNotIn applies the NotIn predicate on the "count_ping_latency" field.
func
CountPingLatencyNotIn
(
vs
...
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldCountPingLatency
,
vs
...
))
}
// CountPingLatencyGT applies the GT predicate on the "count_ping_latency" field.
func
CountPingLatencyGT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldCountPingLatency
,
v
))
}
// CountPingLatencyGTE applies the GTE predicate on the "count_ping_latency" field.
func
CountPingLatencyGTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldCountPingLatency
,
v
))
}
// CountPingLatencyLT applies the LT predicate on the "count_ping_latency" field.
func
CountPingLatencyLT
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldCountPingLatency
,
v
))
}
// CountPingLatencyLTE applies the LTE predicate on the "count_ping_latency" field.
func
CountPingLatencyLTE
(
v
int
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldCountPingLatency
,
v
))
}
// ComputedAtEQ applies the EQ predicate on the "computed_at" field.
func
ComputedAtEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldEQ
(
FieldComputedAt
,
v
))
}
// ComputedAtNEQ applies the NEQ predicate on the "computed_at" field.
func
ComputedAtNEQ
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNEQ
(
FieldComputedAt
,
v
))
}
// ComputedAtIn applies the In predicate on the "computed_at" field.
func
ComputedAtIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldIn
(
FieldComputedAt
,
vs
...
))
}
// ComputedAtNotIn applies the NotIn predicate on the "computed_at" field.
func
ComputedAtNotIn
(
vs
...
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldNotIn
(
FieldComputedAt
,
vs
...
))
}
// ComputedAtGT applies the GT predicate on the "computed_at" field.
func
ComputedAtGT
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGT
(
FieldComputedAt
,
v
))
}
// ComputedAtGTE applies the GTE predicate on the "computed_at" field.
func
ComputedAtGTE
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldGTE
(
FieldComputedAt
,
v
))
}
// ComputedAtLT applies the LT predicate on the "computed_at" field.
func
ComputedAtLT
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLT
(
FieldComputedAt
,
v
))
}
// ComputedAtLTE applies the LTE predicate on the "computed_at" field.
func
ComputedAtLTE
(
v
time
.
Time
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
FieldLTE
(
FieldComputedAt
,
v
))
}
// HasMonitor applies the HasEdge predicate on the "monitor" edge.
func
HasMonitor
()
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
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
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
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
.
ChannelMonitorDailyRollup
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
AndPredicates
(
predicates
...
))
}
// Or groups predicates with the OR operator between them.
func
Or
(
predicates
...
predicate
.
ChannelMonitorDailyRollup
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
OrPredicates
(
predicates
...
))
}
// Not applies the not operator on the given predicate.
func
Not
(
p
predicate
.
ChannelMonitorDailyRollup
)
predicate
.
ChannelMonitorDailyRollup
{
return
predicate
.
ChannelMonitorDailyRollup
(
sql
.
NotPredicates
(
p
))
}
backend/ent/channelmonitordailyrollup_create.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
)
// ChannelMonitorDailyRollupCreate is the builder for creating a ChannelMonitorDailyRollup entity.
type
ChannelMonitorDailyRollupCreate
struct
{
config
mutation
*
ChannelMonitorDailyRollupMutation
hooks
[]
Hook
conflict
[]
sql
.
ConflictOption
}
// SetMonitorID sets the "monitor_id" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetMonitorID
(
v
int64
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetMonitorID
(
v
)
return
_c
}
// SetModel sets the "model" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetModel
(
v
string
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetModel
(
v
)
return
_c
}
// SetBucketDate sets the "bucket_date" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetBucketDate
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetBucketDate
(
v
)
return
_c
}
// SetTotalChecks sets the "total_checks" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetTotalChecks
(
v
)
return
_c
}
// SetNillableTotalChecks sets the "total_checks" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableTotalChecks
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetTotalChecks
(
*
v
)
}
return
_c
}
// SetOkCount sets the "ok_count" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetOkCount
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetOkCount
(
v
)
return
_c
}
// SetNillableOkCount sets the "ok_count" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableOkCount
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetOkCount
(
*
v
)
}
return
_c
}
// SetOperationalCount sets the "operational_count" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetOperationalCount
(
v
)
return
_c
}
// SetNillableOperationalCount sets the "operational_count" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableOperationalCount
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetOperationalCount
(
*
v
)
}
return
_c
}
// SetDegradedCount sets the "degraded_count" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetDegradedCount
(
v
)
return
_c
}
// SetNillableDegradedCount sets the "degraded_count" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableDegradedCount
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetDegradedCount
(
*
v
)
}
return
_c
}
// SetFailedCount sets the "failed_count" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetFailedCount
(
v
)
return
_c
}
// SetNillableFailedCount sets the "failed_count" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableFailedCount
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetFailedCount
(
*
v
)
}
return
_c
}
// SetErrorCount sets the "error_count" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetErrorCount
(
v
)
return
_c
}
// SetNillableErrorCount sets the "error_count" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableErrorCount
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetErrorCount
(
*
v
)
}
return
_c
}
// SetSumLatencyMs sets the "sum_latency_ms" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetSumLatencyMs
(
v
)
return
_c
}
// SetNillableSumLatencyMs sets the "sum_latency_ms" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableSumLatencyMs
(
v
*
int64
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetSumLatencyMs
(
*
v
)
}
return
_c
}
// SetCountLatency sets the "count_latency" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetCountLatency
(
v
)
return
_c
}
// SetNillableCountLatency sets the "count_latency" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableCountLatency
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetCountLatency
(
*
v
)
}
return
_c
}
// SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetSumPingLatencyMs
(
v
)
return
_c
}
// SetNillableSumPingLatencyMs sets the "sum_ping_latency_ms" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableSumPingLatencyMs
(
v
*
int64
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetSumPingLatencyMs
(
*
v
)
}
return
_c
}
// SetCountPingLatency sets the "count_ping_latency" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetCountPingLatency
(
v
)
return
_c
}
// SetNillableCountPingLatency sets the "count_ping_latency" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableCountPingLatency
(
v
*
int
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetCountPingLatency
(
*
v
)
}
return
_c
}
// SetComputedAt sets the "computed_at" field.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetComputedAt
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupCreate
{
_c
.
mutation
.
SetComputedAt
(
v
)
return
_c
}
// SetNillableComputedAt sets the "computed_at" field if the given value is not nil.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetNillableComputedAt
(
v
*
time
.
Time
)
*
ChannelMonitorDailyRollupCreate
{
if
v
!=
nil
{
_c
.
SetComputedAt
(
*
v
)
}
return
_c
}
// SetMonitor sets the "monitor" edge to the ChannelMonitor entity.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SetMonitor
(
v
*
ChannelMonitor
)
*
ChannelMonitorDailyRollupCreate
{
return
_c
.
SetMonitorID
(
v
.
ID
)
}
// Mutation returns the ChannelMonitorDailyRollupMutation object of the builder.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
Mutation
()
*
ChannelMonitorDailyRollupMutation
{
return
_c
.
mutation
}
// Save creates the ChannelMonitorDailyRollup in the database.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
Save
(
ctx
context
.
Context
)
(
*
ChannelMonitorDailyRollup
,
error
)
{
_c
.
defaults
()
return
withHooks
(
ctx
,
_c
.
sqlSave
,
_c
.
mutation
,
_c
.
hooks
)
}
// SaveX calls Save and panics if Save returns an error.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
SaveX
(
ctx
context
.
Context
)
*
ChannelMonitorDailyRollup
{
v
,
err
:=
_c
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
v
}
// Exec executes the query.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_c
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_c
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// defaults sets the default values of the builder before save.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
defaults
()
{
if
_
,
ok
:=
_c
.
mutation
.
TotalChecks
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultTotalChecks
_c
.
mutation
.
SetTotalChecks
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
OkCount
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultOkCount
_c
.
mutation
.
SetOkCount
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
OperationalCount
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultOperationalCount
_c
.
mutation
.
SetOperationalCount
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
DegradedCount
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultDegradedCount
_c
.
mutation
.
SetDegradedCount
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
FailedCount
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultFailedCount
_c
.
mutation
.
SetFailedCount
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
ErrorCount
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultErrorCount
_c
.
mutation
.
SetErrorCount
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
SumLatencyMs
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultSumLatencyMs
_c
.
mutation
.
SetSumLatencyMs
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
CountLatency
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultCountLatency
_c
.
mutation
.
SetCountLatency
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
SumPingLatencyMs
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultSumPingLatencyMs
_c
.
mutation
.
SetSumPingLatencyMs
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
CountPingLatency
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultCountPingLatency
_c
.
mutation
.
SetCountPingLatency
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
ComputedAt
();
!
ok
{
v
:=
channelmonitordailyrollup
.
DefaultComputedAt
()
_c
.
mutation
.
SetComputedAt
(
v
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
check
()
error
{
if
_
,
ok
:=
_c
.
mutation
.
MonitorID
();
!
ok
{
return
&
ValidationError
{
Name
:
"monitor_id"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.monitor_id"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
Model
();
!
ok
{
return
&
ValidationError
{
Name
:
"model"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.model"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
Model
();
ok
{
if
err
:=
channelmonitordailyrollup
.
ModelValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"model"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitorDailyRollup.model": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
BucketDate
();
!
ok
{
return
&
ValidationError
{
Name
:
"bucket_date"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.bucket_date"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
TotalChecks
();
!
ok
{
return
&
ValidationError
{
Name
:
"total_checks"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.total_checks"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
OkCount
();
!
ok
{
return
&
ValidationError
{
Name
:
"ok_count"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.ok_count"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
OperationalCount
();
!
ok
{
return
&
ValidationError
{
Name
:
"operational_count"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.operational_count"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
DegradedCount
();
!
ok
{
return
&
ValidationError
{
Name
:
"degraded_count"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.degraded_count"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
FailedCount
();
!
ok
{
return
&
ValidationError
{
Name
:
"failed_count"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.failed_count"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
ErrorCount
();
!
ok
{
return
&
ValidationError
{
Name
:
"error_count"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.error_count"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
SumLatencyMs
();
!
ok
{
return
&
ValidationError
{
Name
:
"sum_latency_ms"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.sum_latency_ms"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
CountLatency
();
!
ok
{
return
&
ValidationError
{
Name
:
"count_latency"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.count_latency"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
SumPingLatencyMs
();
!
ok
{
return
&
ValidationError
{
Name
:
"sum_ping_latency_ms"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.sum_ping_latency_ms"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
CountPingLatency
();
!
ok
{
return
&
ValidationError
{
Name
:
"count_ping_latency"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.count_ping_latency"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
ComputedAt
();
!
ok
{
return
&
ValidationError
{
Name
:
"computed_at"
,
err
:
errors
.
New
(
`ent: missing required field "ChannelMonitorDailyRollup.computed_at"`
)}
}
if
len
(
_c
.
mutation
.
MonitorIDs
())
==
0
{
return
&
ValidationError
{
Name
:
"monitor"
,
err
:
errors
.
New
(
`ent: missing required edge "ChannelMonitorDailyRollup.monitor"`
)}
}
return
nil
}
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
sqlSave
(
ctx
context
.
Context
)
(
*
ChannelMonitorDailyRollup
,
error
)
{
if
err
:=
_c
.
check
();
err
!=
nil
{
return
nil
,
err
}
_node
,
_spec
:=
_c
.
createSpec
()
if
err
:=
sqlgraph
.
CreateNode
(
ctx
,
_c
.
driver
,
_spec
);
err
!=
nil
{
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
nil
,
err
}
id
:=
_spec
.
ID
.
Value
.
(
int64
)
_node
.
ID
=
int64
(
id
)
_c
.
mutation
.
id
=
&
_node
.
ID
_c
.
mutation
.
done
=
true
return
_node
,
nil
}
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
createSpec
()
(
*
ChannelMonitorDailyRollup
,
*
sqlgraph
.
CreateSpec
)
{
var
(
_node
=
&
ChannelMonitorDailyRollup
{
config
:
_c
.
config
}
_spec
=
sqlgraph
.
NewCreateSpec
(
channelmonitordailyrollup
.
Table
,
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
))
)
_spec
.
OnConflict
=
_c
.
conflict
if
value
,
ok
:=
_c
.
mutation
.
Model
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldModel
,
field
.
TypeString
,
value
)
_node
.
Model
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
BucketDate
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldBucketDate
,
field
.
TypeTime
,
value
)
_node
.
BucketDate
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
TotalChecks
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldTotalChecks
,
field
.
TypeInt
,
value
)
_node
.
TotalChecks
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
OkCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldOkCount
,
field
.
TypeInt
,
value
)
_node
.
OkCount
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
OperationalCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldOperationalCount
,
field
.
TypeInt
,
value
)
_node
.
OperationalCount
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
DegradedCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldDegradedCount
,
field
.
TypeInt
,
value
)
_node
.
DegradedCount
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
FailedCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldFailedCount
,
field
.
TypeInt
,
value
)
_node
.
FailedCount
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
ErrorCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldErrorCount
,
field
.
TypeInt
,
value
)
_node
.
ErrorCount
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
SumLatencyMs
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldSumLatencyMs
,
field
.
TypeInt64
,
value
)
_node
.
SumLatencyMs
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
CountLatency
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldCountLatency
,
field
.
TypeInt
,
value
)
_node
.
CountLatency
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
SumPingLatencyMs
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
field
.
TypeInt64
,
value
)
_node
.
SumPingLatencyMs
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
CountPingLatency
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldCountPingLatency
,
field
.
TypeInt
,
value
)
_node
.
CountPingLatency
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
ComputedAt
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldComputedAt
,
field
.
TypeTime
,
value
)
_node
.
ComputedAt
=
value
}
if
nodes
:=
_c
.
mutation
.
MonitorIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
true
,
Table
:
channelmonitordailyrollup
.
MonitorTable
,
Columns
:
[]
string
{
channelmonitordailyrollup
.
MonitorColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_node
.
MonitorID
=
nodes
[
0
]
_spec
.
Edges
=
append
(
_spec
.
Edges
,
edge
)
}
return
_node
,
_spec
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.ChannelMonitorDailyRollup.Create().
// SetMonitorID(v).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
// sql.ResolveWithNewValues(),
// ).
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.ChannelMonitorDailyRollupUpsert) {
// SetMonitorID(v+v).
// }).
// Exec(ctx)
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
OnConflict
(
opts
...
sql
.
ConflictOption
)
*
ChannelMonitorDailyRollupUpsertOne
{
_c
.
conflict
=
opts
return
&
ChannelMonitorDailyRollupUpsertOne
{
create
:
_c
,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.ChannelMonitorDailyRollup.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func
(
_c
*
ChannelMonitorDailyRollupCreate
)
OnConflictColumns
(
columns
...
string
)
*
ChannelMonitorDailyRollupUpsertOne
{
_c
.
conflict
=
append
(
_c
.
conflict
,
sql
.
ConflictColumns
(
columns
...
))
return
&
ChannelMonitorDailyRollupUpsertOne
{
create
:
_c
,
}
}
type
(
// ChannelMonitorDailyRollupUpsertOne is the builder for "upsert"-ing
// one ChannelMonitorDailyRollup node.
ChannelMonitorDailyRollupUpsertOne
struct
{
create
*
ChannelMonitorDailyRollupCreate
}
// ChannelMonitorDailyRollupUpsert is the "OnConflict" setter.
ChannelMonitorDailyRollupUpsert
struct
{
*
sql
.
UpdateSet
}
)
// SetMonitorID sets the "monitor_id" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetMonitorID
(
v
int64
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldMonitorID
,
v
)
return
u
}
// UpdateMonitorID sets the "monitor_id" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateMonitorID
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldMonitorID
)
return
u
}
// SetModel sets the "model" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetModel
(
v
string
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldModel
,
v
)
return
u
}
// UpdateModel sets the "model" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateModel
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldModel
)
return
u
}
// SetBucketDate sets the "bucket_date" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetBucketDate
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldBucketDate
,
v
)
return
u
}
// UpdateBucketDate sets the "bucket_date" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateBucketDate
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldBucketDate
)
return
u
}
// SetTotalChecks sets the "total_checks" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldTotalChecks
,
v
)
return
u
}
// UpdateTotalChecks sets the "total_checks" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateTotalChecks
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldTotalChecks
)
return
u
}
// AddTotalChecks adds v to the "total_checks" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldTotalChecks
,
v
)
return
u
}
// SetOkCount sets the "ok_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldOkCount
,
v
)
return
u
}
// UpdateOkCount sets the "ok_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateOkCount
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldOkCount
)
return
u
}
// AddOkCount adds v to the "ok_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldOkCount
,
v
)
return
u
}
// SetOperationalCount sets the "operational_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldOperationalCount
,
v
)
return
u
}
// UpdateOperationalCount sets the "operational_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateOperationalCount
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldOperationalCount
)
return
u
}
// AddOperationalCount adds v to the "operational_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldOperationalCount
,
v
)
return
u
}
// SetDegradedCount sets the "degraded_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldDegradedCount
,
v
)
return
u
}
// UpdateDegradedCount sets the "degraded_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateDegradedCount
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldDegradedCount
)
return
u
}
// AddDegradedCount adds v to the "degraded_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldDegradedCount
,
v
)
return
u
}
// SetFailedCount sets the "failed_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldFailedCount
,
v
)
return
u
}
// UpdateFailedCount sets the "failed_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateFailedCount
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldFailedCount
)
return
u
}
// AddFailedCount adds v to the "failed_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldFailedCount
,
v
)
return
u
}
// SetErrorCount sets the "error_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldErrorCount
,
v
)
return
u
}
// UpdateErrorCount sets the "error_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateErrorCount
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldErrorCount
)
return
u
}
// AddErrorCount adds v to the "error_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldErrorCount
,
v
)
return
u
}
// SetSumLatencyMs sets the "sum_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldSumLatencyMs
,
v
)
return
u
}
// UpdateSumLatencyMs sets the "sum_latency_ms" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateSumLatencyMs
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldSumLatencyMs
)
return
u
}
// AddSumLatencyMs adds v to the "sum_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldSumLatencyMs
,
v
)
return
u
}
// SetCountLatency sets the "count_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldCountLatency
,
v
)
return
u
}
// UpdateCountLatency sets the "count_latency" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateCountLatency
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldCountLatency
)
return
u
}
// AddCountLatency adds v to the "count_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldCountLatency
,
v
)
return
u
}
// SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
v
)
return
u
}
// UpdateSumPingLatencyMs sets the "sum_ping_latency_ms" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateSumPingLatencyMs
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
)
return
u
}
// AddSumPingLatencyMs adds v to the "sum_ping_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
v
)
return
u
}
// SetCountPingLatency sets the "count_ping_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldCountPingLatency
,
v
)
return
u
}
// UpdateCountPingLatency sets the "count_ping_latency" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateCountPingLatency
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldCountPingLatency
)
return
u
}
// AddCountPingLatency adds v to the "count_ping_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
AddCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Add
(
channelmonitordailyrollup
.
FieldCountPingLatency
,
v
)
return
u
}
// SetComputedAt sets the "computed_at" field.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
SetComputedAt
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpsert
{
u
.
Set
(
channelmonitordailyrollup
.
FieldComputedAt
,
v
)
return
u
}
// UpdateComputedAt sets the "computed_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsert
)
UpdateComputedAt
()
*
ChannelMonitorDailyRollupUpsert
{
u
.
SetExcluded
(
channelmonitordailyrollup
.
FieldComputedAt
)
return
u
}
// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
// client.ChannelMonitorDailyRollup.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateNewValues
()
*
ChannelMonitorDailyRollupUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithNewValues
())
return
u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.ChannelMonitorDailyRollup.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
Ignore
()
*
ChannelMonitorDailyRollupUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithIgnore
())
return
u
}
// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
DoNothing
()
*
ChannelMonitorDailyRollupUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
DoNothing
())
return
u
}
// Update allows overriding fields `UPDATE` values. See the ChannelMonitorDailyRollupCreate.OnConflict
// documentation for more info.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
Update
(
set
func
(
*
ChannelMonitorDailyRollupUpsert
))
*
ChannelMonitorDailyRollupUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
update
*
sql
.
UpdateSet
)
{
set
(
&
ChannelMonitorDailyRollupUpsert
{
UpdateSet
:
update
})
}))
return
u
}
// SetMonitorID sets the "monitor_id" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetMonitorID
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetMonitorID
(
v
)
})
}
// UpdateMonitorID sets the "monitor_id" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateMonitorID
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateMonitorID
()
})
}
// SetModel sets the "model" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetModel
(
v
string
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetModel
(
v
)
})
}
// UpdateModel sets the "model" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateModel
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateModel
()
})
}
// SetBucketDate sets the "bucket_date" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetBucketDate
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetBucketDate
(
v
)
})
}
// UpdateBucketDate sets the "bucket_date" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateBucketDate
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateBucketDate
()
})
}
// SetTotalChecks sets the "total_checks" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetTotalChecks
(
v
)
})
}
// AddTotalChecks adds v to the "total_checks" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddTotalChecks
(
v
)
})
}
// UpdateTotalChecks sets the "total_checks" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateTotalChecks
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateTotalChecks
()
})
}
// SetOkCount sets the "ok_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetOkCount
(
v
)
})
}
// AddOkCount adds v to the "ok_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddOkCount
(
v
)
})
}
// UpdateOkCount sets the "ok_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateOkCount
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateOkCount
()
})
}
// SetOperationalCount sets the "operational_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetOperationalCount
(
v
)
})
}
// AddOperationalCount adds v to the "operational_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddOperationalCount
(
v
)
})
}
// UpdateOperationalCount sets the "operational_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateOperationalCount
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateOperationalCount
()
})
}
// SetDegradedCount sets the "degraded_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetDegradedCount
(
v
)
})
}
// AddDegradedCount adds v to the "degraded_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddDegradedCount
(
v
)
})
}
// UpdateDegradedCount sets the "degraded_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateDegradedCount
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateDegradedCount
()
})
}
// SetFailedCount sets the "failed_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetFailedCount
(
v
)
})
}
// AddFailedCount adds v to the "failed_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddFailedCount
(
v
)
})
}
// UpdateFailedCount sets the "failed_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateFailedCount
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateFailedCount
()
})
}
// SetErrorCount sets the "error_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetErrorCount
(
v
)
})
}
// AddErrorCount adds v to the "error_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddErrorCount
(
v
)
})
}
// UpdateErrorCount sets the "error_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateErrorCount
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateErrorCount
()
})
}
// SetSumLatencyMs sets the "sum_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetSumLatencyMs
(
v
)
})
}
// AddSumLatencyMs adds v to the "sum_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddSumLatencyMs
(
v
)
})
}
// UpdateSumLatencyMs sets the "sum_latency_ms" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateSumLatencyMs
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateSumLatencyMs
()
})
}
// SetCountLatency sets the "count_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetCountLatency
(
v
)
})
}
// AddCountLatency adds v to the "count_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddCountLatency
(
v
)
})
}
// UpdateCountLatency sets the "count_latency" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateCountLatency
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateCountLatency
()
})
}
// SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetSumPingLatencyMs
(
v
)
})
}
// AddSumPingLatencyMs adds v to the "sum_ping_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddSumPingLatencyMs
(
v
)
})
}
// UpdateSumPingLatencyMs sets the "sum_ping_latency_ms" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateSumPingLatencyMs
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateSumPingLatencyMs
()
})
}
// SetCountPingLatency sets the "count_ping_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetCountPingLatency
(
v
)
})
}
// AddCountPingLatency adds v to the "count_ping_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
AddCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddCountPingLatency
(
v
)
})
}
// UpdateCountPingLatency sets the "count_ping_latency" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateCountPingLatency
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateCountPingLatency
()
})
}
// SetComputedAt sets the "computed_at" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
SetComputedAt
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetComputedAt
(
v
)
})
}
// UpdateComputedAt sets the "computed_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
UpdateComputedAt
()
*
ChannelMonitorDailyRollupUpsertOne
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateComputedAt
()
})
}
// Exec executes the query.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
Exec
(
ctx
context
.
Context
)
error
{
if
len
(
u
.
create
.
conflict
)
==
0
{
return
errors
.
New
(
"ent: missing options for ChannelMonitorDailyRollupCreate.OnConflict"
)
}
return
u
.
create
.
Exec
(
ctx
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
u
.
create
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// Exec executes the UPSERT query and returns the inserted/updated ID.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
ID
(
ctx
context
.
Context
)
(
id
int64
,
err
error
)
{
node
,
err
:=
u
.
create
.
Save
(
ctx
)
if
err
!=
nil
{
return
id
,
err
}
return
node
.
ID
,
nil
}
// IDX is like ID, but panics if an error occurs.
func
(
u
*
ChannelMonitorDailyRollupUpsertOne
)
IDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
u
.
ID
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
id
}
// ChannelMonitorDailyRollupCreateBulk is the builder for creating many ChannelMonitorDailyRollup entities in bulk.
type
ChannelMonitorDailyRollupCreateBulk
struct
{
config
err
error
builders
[]
*
ChannelMonitorDailyRollupCreate
conflict
[]
sql
.
ConflictOption
}
// Save creates the ChannelMonitorDailyRollup entities in the database.
func
(
_c
*
ChannelMonitorDailyRollupCreateBulk
)
Save
(
ctx
context
.
Context
)
([]
*
ChannelMonitorDailyRollup
,
error
)
{
if
_c
.
err
!=
nil
{
return
nil
,
_c
.
err
}
specs
:=
make
([]
*
sqlgraph
.
CreateSpec
,
len
(
_c
.
builders
))
nodes
:=
make
([]
*
ChannelMonitorDailyRollup
,
len
(
_c
.
builders
))
mutators
:=
make
([]
Mutator
,
len
(
_c
.
builders
))
for
i
:=
range
_c
.
builders
{
func
(
i
int
,
root
context
.
Context
)
{
builder
:=
_c
.
builders
[
i
]
builder
.
defaults
()
var
mut
Mutator
=
MutateFunc
(
func
(
ctx
context
.
Context
,
m
Mutation
)
(
Value
,
error
)
{
mutation
,
ok
:=
m
.
(
*
ChannelMonitorDailyRollupMutation
)
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"unexpected mutation type %T"
,
m
)
}
if
err
:=
builder
.
check
();
err
!=
nil
{
return
nil
,
err
}
builder
.
mutation
=
mutation
var
err
error
nodes
[
i
],
specs
[
i
]
=
builder
.
createSpec
()
if
i
<
len
(
mutators
)
-
1
{
_
,
err
=
mutators
[
i
+
1
]
.
Mutate
(
root
,
_c
.
builders
[
i
+
1
]
.
mutation
)
}
else
{
spec
:=
&
sqlgraph
.
BatchCreateSpec
{
Nodes
:
specs
}
spec
.
OnConflict
=
_c
.
conflict
// Invoke the actual operation on the latest mutation in the chain.
if
err
=
sqlgraph
.
BatchCreate
(
ctx
,
_c
.
driver
,
spec
);
err
!=
nil
{
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
}
}
if
err
!=
nil
{
return
nil
,
err
}
mutation
.
id
=
&
nodes
[
i
]
.
ID
if
specs
[
i
]
.
ID
.
Value
!=
nil
{
id
:=
specs
[
i
]
.
ID
.
Value
.
(
int64
)
nodes
[
i
]
.
ID
=
int64
(
id
)
}
mutation
.
done
=
true
return
nodes
[
i
],
nil
})
for
i
:=
len
(
builder
.
hooks
)
-
1
;
i
>=
0
;
i
--
{
mut
=
builder
.
hooks
[
i
](
mut
)
}
mutators
[
i
]
=
mut
}(
i
,
ctx
)
}
if
len
(
mutators
)
>
0
{
if
_
,
err
:=
mutators
[
0
]
.
Mutate
(
ctx
,
_c
.
builders
[
0
]
.
mutation
);
err
!=
nil
{
return
nil
,
err
}
}
return
nodes
,
nil
}
// SaveX is like Save, but panics if an error occurs.
func
(
_c
*
ChannelMonitorDailyRollupCreateBulk
)
SaveX
(
ctx
context
.
Context
)
[]
*
ChannelMonitorDailyRollup
{
v
,
err
:=
_c
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
v
}
// Exec executes the query.
func
(
_c
*
ChannelMonitorDailyRollupCreateBulk
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_c
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_c
*
ChannelMonitorDailyRollupCreateBulk
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_c
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.ChannelMonitorDailyRollup.CreateBulk(builders...).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
// sql.ResolveWithNewValues(),
// ).
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.ChannelMonitorDailyRollupUpsert) {
// SetMonitorID(v+v).
// }).
// Exec(ctx)
func
(
_c
*
ChannelMonitorDailyRollupCreateBulk
)
OnConflict
(
opts
...
sql
.
ConflictOption
)
*
ChannelMonitorDailyRollupUpsertBulk
{
_c
.
conflict
=
opts
return
&
ChannelMonitorDailyRollupUpsertBulk
{
create
:
_c
,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.ChannelMonitorDailyRollup.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func
(
_c
*
ChannelMonitorDailyRollupCreateBulk
)
OnConflictColumns
(
columns
...
string
)
*
ChannelMonitorDailyRollupUpsertBulk
{
_c
.
conflict
=
append
(
_c
.
conflict
,
sql
.
ConflictColumns
(
columns
...
))
return
&
ChannelMonitorDailyRollupUpsertBulk
{
create
:
_c
,
}
}
// ChannelMonitorDailyRollupUpsertBulk is the builder for "upsert"-ing
// a bulk of ChannelMonitorDailyRollup nodes.
type
ChannelMonitorDailyRollupUpsertBulk
struct
{
create
*
ChannelMonitorDailyRollupCreateBulk
}
// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
// client.ChannelMonitorDailyRollup.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateNewValues
()
*
ChannelMonitorDailyRollupUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithNewValues
())
return
u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.ChannelMonitorDailyRollup.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
Ignore
()
*
ChannelMonitorDailyRollupUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWithIgnore
())
return
u
}
// DoNothing configures the conflict_action to `DO NOTHING`.
// Supported only by SQLite and PostgreSQL.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
DoNothing
()
*
ChannelMonitorDailyRollupUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
DoNothing
())
return
u
}
// Update allows overriding fields `UPDATE` values. See the ChannelMonitorDailyRollupCreateBulk.OnConflict
// documentation for more info.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
Update
(
set
func
(
*
ChannelMonitorDailyRollupUpsert
))
*
ChannelMonitorDailyRollupUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
update
*
sql
.
UpdateSet
)
{
set
(
&
ChannelMonitorDailyRollupUpsert
{
UpdateSet
:
update
})
}))
return
u
}
// SetMonitorID sets the "monitor_id" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetMonitorID
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetMonitorID
(
v
)
})
}
// UpdateMonitorID sets the "monitor_id" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateMonitorID
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateMonitorID
()
})
}
// SetModel sets the "model" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetModel
(
v
string
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetModel
(
v
)
})
}
// UpdateModel sets the "model" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateModel
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateModel
()
})
}
// SetBucketDate sets the "bucket_date" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetBucketDate
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetBucketDate
(
v
)
})
}
// UpdateBucketDate sets the "bucket_date" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateBucketDate
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateBucketDate
()
})
}
// SetTotalChecks sets the "total_checks" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetTotalChecks
(
v
)
})
}
// AddTotalChecks adds v to the "total_checks" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddTotalChecks
(
v
)
})
}
// UpdateTotalChecks sets the "total_checks" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateTotalChecks
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateTotalChecks
()
})
}
// SetOkCount sets the "ok_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetOkCount
(
v
)
})
}
// AddOkCount adds v to the "ok_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddOkCount
(
v
)
})
}
// UpdateOkCount sets the "ok_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateOkCount
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateOkCount
()
})
}
// SetOperationalCount sets the "operational_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetOperationalCount
(
v
)
})
}
// AddOperationalCount adds v to the "operational_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddOperationalCount
(
v
)
})
}
// UpdateOperationalCount sets the "operational_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateOperationalCount
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateOperationalCount
()
})
}
// SetDegradedCount sets the "degraded_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetDegradedCount
(
v
)
})
}
// AddDegradedCount adds v to the "degraded_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddDegradedCount
(
v
)
})
}
// UpdateDegradedCount sets the "degraded_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateDegradedCount
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateDegradedCount
()
})
}
// SetFailedCount sets the "failed_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetFailedCount
(
v
)
})
}
// AddFailedCount adds v to the "failed_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddFailedCount
(
v
)
})
}
// UpdateFailedCount sets the "failed_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateFailedCount
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateFailedCount
()
})
}
// SetErrorCount sets the "error_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetErrorCount
(
v
)
})
}
// AddErrorCount adds v to the "error_count" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddErrorCount
(
v
)
})
}
// UpdateErrorCount sets the "error_count" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateErrorCount
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateErrorCount
()
})
}
// SetSumLatencyMs sets the "sum_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetSumLatencyMs
(
v
)
})
}
// AddSumLatencyMs adds v to the "sum_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddSumLatencyMs
(
v
)
})
}
// UpdateSumLatencyMs sets the "sum_latency_ms" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateSumLatencyMs
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateSumLatencyMs
()
})
}
// SetCountLatency sets the "count_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetCountLatency
(
v
)
})
}
// AddCountLatency adds v to the "count_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddCountLatency
(
v
)
})
}
// UpdateCountLatency sets the "count_latency" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateCountLatency
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateCountLatency
()
})
}
// SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetSumPingLatencyMs
(
v
)
})
}
// AddSumPingLatencyMs adds v to the "sum_ping_latency_ms" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddSumPingLatencyMs
(
v
)
})
}
// UpdateSumPingLatencyMs sets the "sum_ping_latency_ms" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateSumPingLatencyMs
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateSumPingLatencyMs
()
})
}
// SetCountPingLatency sets the "count_ping_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetCountPingLatency
(
v
)
})
}
// AddCountPingLatency adds v to the "count_ping_latency" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
AddCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
AddCountPingLatency
(
v
)
})
}
// UpdateCountPingLatency sets the "count_ping_latency" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateCountPingLatency
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateCountPingLatency
()
})
}
// SetComputedAt sets the "computed_at" field.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
SetComputedAt
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
SetComputedAt
(
v
)
})
}
// UpdateComputedAt sets the "computed_at" field to the value that was provided on create.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
UpdateComputedAt
()
*
ChannelMonitorDailyRollupUpsertBulk
{
return
u
.
Update
(
func
(
s
*
ChannelMonitorDailyRollupUpsert
)
{
s
.
UpdateComputedAt
()
})
}
// Exec executes the query.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
Exec
(
ctx
context
.
Context
)
error
{
if
u
.
create
.
err
!=
nil
{
return
u
.
create
.
err
}
for
i
,
b
:=
range
u
.
create
.
builders
{
if
len
(
b
.
conflict
)
!=
0
{
return
fmt
.
Errorf
(
"ent: OnConflict was set for builder %d. Set it on the ChannelMonitorDailyRollupCreateBulk instead"
,
i
)
}
}
if
len
(
u
.
create
.
conflict
)
==
0
{
return
errors
.
New
(
"ent: missing options for ChannelMonitorDailyRollupCreateBulk.OnConflict"
)
}
return
u
.
create
.
Exec
(
ctx
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
u
*
ChannelMonitorDailyRollupUpsertBulk
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
u
.
create
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
backend/ent/channelmonitordailyrollup_delete.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ChannelMonitorDailyRollupDelete is the builder for deleting a ChannelMonitorDailyRollup entity.
type
ChannelMonitorDailyRollupDelete
struct
{
config
hooks
[]
Hook
mutation
*
ChannelMonitorDailyRollupMutation
}
// Where appends a list predicates to the ChannelMonitorDailyRollupDelete builder.
func
(
_d
*
ChannelMonitorDailyRollupDelete
)
Where
(
ps
...
predicate
.
ChannelMonitorDailyRollup
)
*
ChannelMonitorDailyRollupDelete
{
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func
(
_d
*
ChannelMonitorDailyRollupDelete
)
Exec
(
ctx
context
.
Context
)
(
int
,
error
)
{
return
withHooks
(
ctx
,
_d
.
sqlExec
,
_d
.
mutation
,
_d
.
hooks
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_d
*
ChannelMonitorDailyRollupDelete
)
ExecX
(
ctx
context
.
Context
)
int
{
n
,
err
:=
_d
.
Exec
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
n
}
func
(
_d
*
ChannelMonitorDailyRollupDelete
)
sqlExec
(
ctx
context
.
Context
)
(
int
,
error
)
{
_spec
:=
sqlgraph
.
NewDeleteSpec
(
channelmonitordailyrollup
.
Table
,
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
))
if
ps
:=
_d
.
mutation
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
affected
,
err
:=
sqlgraph
.
DeleteNodes
(
ctx
,
_d
.
driver
,
_spec
)
if
err
!=
nil
&&
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
_d
.
mutation
.
done
=
true
return
affected
,
err
}
// ChannelMonitorDailyRollupDeleteOne is the builder for deleting a single ChannelMonitorDailyRollup entity.
type
ChannelMonitorDailyRollupDeleteOne
struct
{
_d
*
ChannelMonitorDailyRollupDelete
}
// Where appends a list predicates to the ChannelMonitorDailyRollupDelete builder.
func
(
_d
*
ChannelMonitorDailyRollupDeleteOne
)
Where
(
ps
...
predicate
.
ChannelMonitorDailyRollup
)
*
ChannelMonitorDailyRollupDeleteOne
{
_d
.
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query.
func
(
_d
*
ChannelMonitorDailyRollupDeleteOne
)
Exec
(
ctx
context
.
Context
)
error
{
n
,
err
:=
_d
.
_d
.
Exec
(
ctx
)
switch
{
case
err
!=
nil
:
return
err
case
n
==
0
:
return
&
NotFoundError
{
channelmonitordailyrollup
.
Label
}
default
:
return
nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_d
*
ChannelMonitorDailyRollupDeleteOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_d
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
backend/ent/channelmonitordailyrollup_query.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"fmt"
"math"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ChannelMonitorDailyRollupQuery is the builder for querying ChannelMonitorDailyRollup entities.
type
ChannelMonitorDailyRollupQuery
struct
{
config
ctx
*
QueryContext
order
[]
channelmonitordailyrollup
.
OrderOption
inters
[]
Interceptor
predicates
[]
predicate
.
ChannelMonitorDailyRollup
withMonitor
*
ChannelMonitorQuery
modifiers
[]
func
(
*
sql
.
Selector
)
// intermediate query (i.e. traversal path).
sql
*
sql
.
Selector
path
func
(
context
.
Context
)
(
*
sql
.
Selector
,
error
)
}
// Where adds a new predicate for the ChannelMonitorDailyRollupQuery builder.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Where
(
ps
...
predicate
.
ChannelMonitorDailyRollup
)
*
ChannelMonitorDailyRollupQuery
{
_q
.
predicates
=
append
(
_q
.
predicates
,
ps
...
)
return
_q
}
// Limit the number of records to be returned by this query.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Limit
(
limit
int
)
*
ChannelMonitorDailyRollupQuery
{
_q
.
ctx
.
Limit
=
&
limit
return
_q
}
// Offset to start from.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Offset
(
offset
int
)
*
ChannelMonitorDailyRollupQuery
{
_q
.
ctx
.
Offset
=
&
offset
return
_q
}
// Unique configures the query builder to filter duplicate records on query.
// By default, unique is set to true, and can be disabled using this method.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Unique
(
unique
bool
)
*
ChannelMonitorDailyRollupQuery
{
_q
.
ctx
.
Unique
=
&
unique
return
_q
}
// Order specifies how the records should be ordered.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Order
(
o
...
channelmonitordailyrollup
.
OrderOption
)
*
ChannelMonitorDailyRollupQuery
{
_q
.
order
=
append
(
_q
.
order
,
o
...
)
return
_q
}
// QueryMonitor chains the current query on the "monitor" edge.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
QueryMonitor
()
*
ChannelMonitorQuery
{
query
:=
(
&
ChannelMonitorClient
{
config
:
_q
.
config
})
.
Query
()
query
.
path
=
func
(
ctx
context
.
Context
)
(
fromU
*
sql
.
Selector
,
err
error
)
{
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
selector
:=
_q
.
sqlQuery
(
ctx
)
if
err
:=
selector
.
Err
();
err
!=
nil
{
return
nil
,
err
}
step
:=
sqlgraph
.
NewStep
(
sqlgraph
.
From
(
channelmonitordailyrollup
.
Table
,
channelmonitordailyrollup
.
FieldID
,
selector
),
sqlgraph
.
To
(
channelmonitor
.
Table
,
channelmonitor
.
FieldID
),
sqlgraph
.
Edge
(
sqlgraph
.
M2O
,
true
,
channelmonitordailyrollup
.
MonitorTable
,
channelmonitordailyrollup
.
MonitorColumn
),
)
fromU
=
sqlgraph
.
SetNeighbors
(
_q
.
driver
.
Dialect
(),
step
)
return
fromU
,
nil
}
return
query
}
// First returns the first ChannelMonitorDailyRollup entity from the query.
// Returns a *NotFoundError when no ChannelMonitorDailyRollup was found.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
First
(
ctx
context
.
Context
)
(
*
ChannelMonitorDailyRollup
,
error
)
{
nodes
,
err
:=
_q
.
Limit
(
1
)
.
All
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryFirst
))
if
err
!=
nil
{
return
nil
,
err
}
if
len
(
nodes
)
==
0
{
return
nil
,
&
NotFoundError
{
channelmonitordailyrollup
.
Label
}
}
return
nodes
[
0
],
nil
}
// FirstX is like First, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
FirstX
(
ctx
context
.
Context
)
*
ChannelMonitorDailyRollup
{
node
,
err
:=
_q
.
First
(
ctx
)
if
err
!=
nil
&&
!
IsNotFound
(
err
)
{
panic
(
err
)
}
return
node
}
// FirstID returns the first ChannelMonitorDailyRollup ID from the query.
// Returns a *NotFoundError when no ChannelMonitorDailyRollup ID was found.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
FirstID
(
ctx
context
.
Context
)
(
id
int64
,
err
error
)
{
var
ids
[]
int64
if
ids
,
err
=
_q
.
Limit
(
1
)
.
IDs
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryFirstID
));
err
!=
nil
{
return
}
if
len
(
ids
)
==
0
{
err
=
&
NotFoundError
{
channelmonitordailyrollup
.
Label
}
return
}
return
ids
[
0
],
nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
FirstIDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
_q
.
FirstID
(
ctx
)
if
err
!=
nil
&&
!
IsNotFound
(
err
)
{
panic
(
err
)
}
return
id
}
// Only returns a single ChannelMonitorDailyRollup entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one ChannelMonitorDailyRollup entity is found.
// Returns a *NotFoundError when no ChannelMonitorDailyRollup entities are found.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Only
(
ctx
context
.
Context
)
(
*
ChannelMonitorDailyRollup
,
error
)
{
nodes
,
err
:=
_q
.
Limit
(
2
)
.
All
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryOnly
))
if
err
!=
nil
{
return
nil
,
err
}
switch
len
(
nodes
)
{
case
1
:
return
nodes
[
0
],
nil
case
0
:
return
nil
,
&
NotFoundError
{
channelmonitordailyrollup
.
Label
}
default
:
return
nil
,
&
NotSingularError
{
channelmonitordailyrollup
.
Label
}
}
}
// OnlyX is like Only, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
OnlyX
(
ctx
context
.
Context
)
*
ChannelMonitorDailyRollup
{
node
,
err
:=
_q
.
Only
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
node
}
// OnlyID is like Only, but returns the only ChannelMonitorDailyRollup ID in the query.
// Returns a *NotSingularError when more than one ChannelMonitorDailyRollup ID is found.
// Returns a *NotFoundError when no entities are found.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
OnlyID
(
ctx
context
.
Context
)
(
id
int64
,
err
error
)
{
var
ids
[]
int64
if
ids
,
err
=
_q
.
Limit
(
2
)
.
IDs
(
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryOnlyID
));
err
!=
nil
{
return
}
switch
len
(
ids
)
{
case
1
:
id
=
ids
[
0
]
case
0
:
err
=
&
NotFoundError
{
channelmonitordailyrollup
.
Label
}
default
:
err
=
&
NotSingularError
{
channelmonitordailyrollup
.
Label
}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
OnlyIDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
_q
.
OnlyID
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
id
}
// All executes the query and returns a list of ChannelMonitorDailyRollups.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
All
(
ctx
context
.
Context
)
([]
*
ChannelMonitorDailyRollup
,
error
)
{
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryAll
)
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
qr
:=
querierAll
[[]
*
ChannelMonitorDailyRollup
,
*
ChannelMonitorDailyRollupQuery
]()
return
withInterceptors
[[]
*
ChannelMonitorDailyRollup
](
ctx
,
_q
,
qr
,
_q
.
inters
)
}
// AllX is like All, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
AllX
(
ctx
context
.
Context
)
[]
*
ChannelMonitorDailyRollup
{
nodes
,
err
:=
_q
.
All
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
nodes
}
// IDs executes the query and returns a list of ChannelMonitorDailyRollup IDs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
IDs
(
ctx
context
.
Context
)
(
ids
[]
int64
,
err
error
)
{
if
_q
.
ctx
.
Unique
==
nil
&&
_q
.
path
!=
nil
{
_q
.
Unique
(
true
)
}
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryIDs
)
if
err
=
_q
.
Select
(
channelmonitordailyrollup
.
FieldID
)
.
Scan
(
ctx
,
&
ids
);
err
!=
nil
{
return
nil
,
err
}
return
ids
,
nil
}
// IDsX is like IDs, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
IDsX
(
ctx
context
.
Context
)
[]
int64
{
ids
,
err
:=
_q
.
IDs
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
ids
}
// Count returns the count of the given query.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Count
(
ctx
context
.
Context
)
(
int
,
error
)
{
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryCount
)
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
0
,
err
}
return
withInterceptors
[
int
](
ctx
,
_q
,
querierCount
[
*
ChannelMonitorDailyRollupQuery
](),
_q
.
inters
)
}
// CountX is like Count, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
CountX
(
ctx
context
.
Context
)
int
{
count
,
err
:=
_q
.
Count
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
count
}
// Exist returns true if the query has elements in the graph.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Exist
(
ctx
context
.
Context
)
(
bool
,
error
)
{
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryExist
)
switch
_
,
err
:=
_q
.
FirstID
(
ctx
);
{
case
IsNotFound
(
err
)
:
return
false
,
nil
case
err
!=
nil
:
return
false
,
fmt
.
Errorf
(
"ent: check existence: %w"
,
err
)
default
:
return
true
,
nil
}
}
// ExistX is like Exist, but panics if an error occurs.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
ExistX
(
ctx
context
.
Context
)
bool
{
exist
,
err
:=
_q
.
Exist
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
exist
}
// Clone returns a duplicate of the ChannelMonitorDailyRollupQuery builder, including all associated steps. It can be
// used to prepare common query builders and use them differently after the clone is made.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Clone
()
*
ChannelMonitorDailyRollupQuery
{
if
_q
==
nil
{
return
nil
}
return
&
ChannelMonitorDailyRollupQuery
{
config
:
_q
.
config
,
ctx
:
_q
.
ctx
.
Clone
(),
order
:
append
([]
channelmonitordailyrollup
.
OrderOption
{},
_q
.
order
...
),
inters
:
append
([]
Interceptor
{},
_q
.
inters
...
),
predicates
:
append
([]
predicate
.
ChannelMonitorDailyRollup
{},
_q
.
predicates
...
),
withMonitor
:
_q
.
withMonitor
.
Clone
(),
// clone intermediate query.
sql
:
_q
.
sql
.
Clone
(),
path
:
_q
.
path
,
}
}
// WithMonitor tells the query-builder to eager-load the nodes that are connected to
// the "monitor" edge. The optional arguments are used to configure the query builder of the edge.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
WithMonitor
(
opts
...
func
(
*
ChannelMonitorQuery
))
*
ChannelMonitorDailyRollupQuery
{
query
:=
(
&
ChannelMonitorClient
{
config
:
_q
.
config
})
.
Query
()
for
_
,
opt
:=
range
opts
{
opt
(
query
)
}
_q
.
withMonitor
=
query
return
_q
}
// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
// var v []struct {
// MonitorID int64 `json:"monitor_id,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.ChannelMonitorDailyRollup.Query().
// GroupBy(channelmonitordailyrollup.FieldMonitorID).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
GroupBy
(
field
string
,
fields
...
string
)
*
ChannelMonitorDailyRollupGroupBy
{
_q
.
ctx
.
Fields
=
append
([]
string
{
field
},
fields
...
)
grbuild
:=
&
ChannelMonitorDailyRollupGroupBy
{
build
:
_q
}
grbuild
.
flds
=
&
_q
.
ctx
.
Fields
grbuild
.
label
=
channelmonitordailyrollup
.
Label
grbuild
.
scan
=
grbuild
.
Scan
return
grbuild
}
// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
// var v []struct {
// MonitorID int64 `json:"monitor_id,omitempty"`
// }
//
// client.ChannelMonitorDailyRollup.Query().
// Select(channelmonitordailyrollup.FieldMonitorID).
// Scan(ctx, &v)
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Select
(
fields
...
string
)
*
ChannelMonitorDailyRollupSelect
{
_q
.
ctx
.
Fields
=
append
(
_q
.
ctx
.
Fields
,
fields
...
)
sbuild
:=
&
ChannelMonitorDailyRollupSelect
{
ChannelMonitorDailyRollupQuery
:
_q
}
sbuild
.
label
=
channelmonitordailyrollup
.
Label
sbuild
.
flds
,
sbuild
.
scan
=
&
_q
.
ctx
.
Fields
,
sbuild
.
Scan
return
sbuild
}
// Aggregate returns a ChannelMonitorDailyRollupSelect configured with the given aggregations.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
Aggregate
(
fns
...
AggregateFunc
)
*
ChannelMonitorDailyRollupSelect
{
return
_q
.
Select
()
.
Aggregate
(
fns
...
)
}
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
prepareQuery
(
ctx
context
.
Context
)
error
{
for
_
,
inter
:=
range
_q
.
inters
{
if
inter
==
nil
{
return
fmt
.
Errorf
(
"ent: uninitialized interceptor (forgotten import ent/runtime?)"
)
}
if
trv
,
ok
:=
inter
.
(
Traverser
);
ok
{
if
err
:=
trv
.
Traverse
(
ctx
,
_q
);
err
!=
nil
{
return
err
}
}
}
for
_
,
f
:=
range
_q
.
ctx
.
Fields
{
if
!
channelmonitordailyrollup
.
ValidColumn
(
f
)
{
return
&
ValidationError
{
Name
:
f
,
err
:
fmt
.
Errorf
(
"ent: invalid field %q for query"
,
f
)}
}
}
if
_q
.
path
!=
nil
{
prev
,
err
:=
_q
.
path
(
ctx
)
if
err
!=
nil
{
return
err
}
_q
.
sql
=
prev
}
return
nil
}
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
sqlAll
(
ctx
context
.
Context
,
hooks
...
queryHook
)
([]
*
ChannelMonitorDailyRollup
,
error
)
{
var
(
nodes
=
[]
*
ChannelMonitorDailyRollup
{}
_spec
=
_q
.
querySpec
()
loadedTypes
=
[
1
]
bool
{
_q
.
withMonitor
!=
nil
,
}
)
_spec
.
ScanValues
=
func
(
columns
[]
string
)
([]
any
,
error
)
{
return
(
*
ChannelMonitorDailyRollup
)
.
scanValues
(
nil
,
columns
)
}
_spec
.
Assign
=
func
(
columns
[]
string
,
values
[]
any
)
error
{
node
:=
&
ChannelMonitorDailyRollup
{
config
:
_q
.
config
}
nodes
=
append
(
nodes
,
node
)
node
.
Edges
.
loadedTypes
=
loadedTypes
return
node
.
assignValues
(
columns
,
values
)
}
if
len
(
_q
.
modifiers
)
>
0
{
_spec
.
Modifiers
=
_q
.
modifiers
}
for
i
:=
range
hooks
{
hooks
[
i
](
ctx
,
_spec
)
}
if
err
:=
sqlgraph
.
QueryNodes
(
ctx
,
_q
.
driver
,
_spec
);
err
!=
nil
{
return
nil
,
err
}
if
len
(
nodes
)
==
0
{
return
nodes
,
nil
}
if
query
:=
_q
.
withMonitor
;
query
!=
nil
{
if
err
:=
_q
.
loadMonitor
(
ctx
,
query
,
nodes
,
nil
,
func
(
n
*
ChannelMonitorDailyRollup
,
e
*
ChannelMonitor
)
{
n
.
Edges
.
Monitor
=
e
});
err
!=
nil
{
return
nil
,
err
}
}
return
nodes
,
nil
}
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
loadMonitor
(
ctx
context
.
Context
,
query
*
ChannelMonitorQuery
,
nodes
[]
*
ChannelMonitorDailyRollup
,
init
func
(
*
ChannelMonitorDailyRollup
),
assign
func
(
*
ChannelMonitorDailyRollup
,
*
ChannelMonitor
))
error
{
ids
:=
make
([]
int64
,
0
,
len
(
nodes
))
nodeids
:=
make
(
map
[
int64
][]
*
ChannelMonitorDailyRollup
)
for
i
:=
range
nodes
{
fk
:=
nodes
[
i
]
.
MonitorID
if
_
,
ok
:=
nodeids
[
fk
];
!
ok
{
ids
=
append
(
ids
,
fk
)
}
nodeids
[
fk
]
=
append
(
nodeids
[
fk
],
nodes
[
i
])
}
if
len
(
ids
)
==
0
{
return
nil
}
query
.
Where
(
channelmonitor
.
IDIn
(
ids
...
))
neighbors
,
err
:=
query
.
All
(
ctx
)
if
err
!=
nil
{
return
err
}
for
_
,
n
:=
range
neighbors
{
nodes
,
ok
:=
nodeids
[
n
.
ID
]
if
!
ok
{
return
fmt
.
Errorf
(
`unexpected foreign-key "monitor_id" returned %v`
,
n
.
ID
)
}
for
i
:=
range
nodes
{
assign
(
nodes
[
i
],
n
)
}
}
return
nil
}
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
sqlCount
(
ctx
context
.
Context
)
(
int
,
error
)
{
_spec
:=
_q
.
querySpec
()
if
len
(
_q
.
modifiers
)
>
0
{
_spec
.
Modifiers
=
_q
.
modifiers
}
_spec
.
Node
.
Columns
=
_q
.
ctx
.
Fields
if
len
(
_q
.
ctx
.
Fields
)
>
0
{
_spec
.
Unique
=
_q
.
ctx
.
Unique
!=
nil
&&
*
_q
.
ctx
.
Unique
}
return
sqlgraph
.
CountNodes
(
ctx
,
_q
.
driver
,
_spec
)
}
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
querySpec
()
*
sqlgraph
.
QuerySpec
{
_spec
:=
sqlgraph
.
NewQuerySpec
(
channelmonitordailyrollup
.
Table
,
channelmonitordailyrollup
.
Columns
,
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
))
_spec
.
From
=
_q
.
sql
if
unique
:=
_q
.
ctx
.
Unique
;
unique
!=
nil
{
_spec
.
Unique
=
*
unique
}
else
if
_q
.
path
!=
nil
{
_spec
.
Unique
=
true
}
if
fields
:=
_q
.
ctx
.
Fields
;
len
(
fields
)
>
0
{
_spec
.
Node
.
Columns
=
make
([]
string
,
0
,
len
(
fields
))
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
channelmonitordailyrollup
.
FieldID
)
for
i
:=
range
fields
{
if
fields
[
i
]
!=
channelmonitordailyrollup
.
FieldID
{
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
fields
[
i
])
}
}
if
_q
.
withMonitor
!=
nil
{
_spec
.
Node
.
AddColumnOnce
(
channelmonitordailyrollup
.
FieldMonitorID
)
}
}
if
ps
:=
_q
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
if
limit
:=
_q
.
ctx
.
Limit
;
limit
!=
nil
{
_spec
.
Limit
=
*
limit
}
if
offset
:=
_q
.
ctx
.
Offset
;
offset
!=
nil
{
_spec
.
Offset
=
*
offset
}
if
ps
:=
_q
.
order
;
len
(
ps
)
>
0
{
_spec
.
Order
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
return
_spec
}
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
sqlQuery
(
ctx
context
.
Context
)
*
sql
.
Selector
{
builder
:=
sql
.
Dialect
(
_q
.
driver
.
Dialect
())
t1
:=
builder
.
Table
(
channelmonitordailyrollup
.
Table
)
columns
:=
_q
.
ctx
.
Fields
if
len
(
columns
)
==
0
{
columns
=
channelmonitordailyrollup
.
Columns
}
selector
:=
builder
.
Select
(
t1
.
Columns
(
columns
...
)
...
)
.
From
(
t1
)
if
_q
.
sql
!=
nil
{
selector
=
_q
.
sql
selector
.
Select
(
selector
.
Columns
(
columns
...
)
...
)
}
if
_q
.
ctx
.
Unique
!=
nil
&&
*
_q
.
ctx
.
Unique
{
selector
.
Distinct
()
}
for
_
,
m
:=
range
_q
.
modifiers
{
m
(
selector
)
}
for
_
,
p
:=
range
_q
.
predicates
{
p
(
selector
)
}
for
_
,
p
:=
range
_q
.
order
{
p
(
selector
)
}
if
offset
:=
_q
.
ctx
.
Offset
;
offset
!=
nil
{
// limit is mandatory for offset clause. We start
// with default value, and override it below if needed.
selector
.
Offset
(
*
offset
)
.
Limit
(
math
.
MaxInt32
)
}
if
limit
:=
_q
.
ctx
.
Limit
;
limit
!=
nil
{
selector
.
Limit
(
*
limit
)
}
return
selector
}
// ForUpdate locks the selected rows against concurrent updates, and prevent them from being
// updated, deleted or "selected ... for update" by other sessions, until the transaction is
// either committed or rolled-back.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
ForUpdate
(
opts
...
sql
.
LockOption
)
*
ChannelMonitorDailyRollupQuery
{
if
_q
.
driver
.
Dialect
()
==
dialect
.
Postgres
{
_q
.
Unique
(
false
)
}
_q
.
modifiers
=
append
(
_q
.
modifiers
,
func
(
s
*
sql
.
Selector
)
{
s
.
ForUpdate
(
opts
...
)
})
return
_q
}
// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock
// on any rows that are read. Other sessions can read the rows, but cannot modify them
// until your transaction commits.
func
(
_q
*
ChannelMonitorDailyRollupQuery
)
ForShare
(
opts
...
sql
.
LockOption
)
*
ChannelMonitorDailyRollupQuery
{
if
_q
.
driver
.
Dialect
()
==
dialect
.
Postgres
{
_q
.
Unique
(
false
)
}
_q
.
modifiers
=
append
(
_q
.
modifiers
,
func
(
s
*
sql
.
Selector
)
{
s
.
ForShare
(
opts
...
)
})
return
_q
}
// ChannelMonitorDailyRollupGroupBy is the group-by builder for ChannelMonitorDailyRollup entities.
type
ChannelMonitorDailyRollupGroupBy
struct
{
selector
build
*
ChannelMonitorDailyRollupQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func
(
_g
*
ChannelMonitorDailyRollupGroupBy
)
Aggregate
(
fns
...
AggregateFunc
)
*
ChannelMonitorDailyRollupGroupBy
{
_g
.
fns
=
append
(
_g
.
fns
,
fns
...
)
return
_g
}
// Scan applies the selector query and scans the result into the given value.
func
(
_g
*
ChannelMonitorDailyRollupGroupBy
)
Scan
(
ctx
context
.
Context
,
v
any
)
error
{
ctx
=
setContextOp
(
ctx
,
_g
.
build
.
ctx
,
ent
.
OpQueryGroupBy
)
if
err
:=
_g
.
build
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
err
}
return
scanWithInterceptors
[
*
ChannelMonitorDailyRollupQuery
,
*
ChannelMonitorDailyRollupGroupBy
](
ctx
,
_g
.
build
,
_g
,
_g
.
build
.
inters
,
v
)
}
func
(
_g
*
ChannelMonitorDailyRollupGroupBy
)
sqlScan
(
ctx
context
.
Context
,
root
*
ChannelMonitorDailyRollupQuery
,
v
any
)
error
{
selector
:=
root
.
sqlQuery
(
ctx
)
.
Select
()
aggregation
:=
make
([]
string
,
0
,
len
(
_g
.
fns
))
for
_
,
fn
:=
range
_g
.
fns
{
aggregation
=
append
(
aggregation
,
fn
(
selector
))
}
if
len
(
selector
.
SelectedColumns
())
==
0
{
columns
:=
make
([]
string
,
0
,
len
(
*
_g
.
flds
)
+
len
(
_g
.
fns
))
for
_
,
f
:=
range
*
_g
.
flds
{
columns
=
append
(
columns
,
selector
.
C
(
f
))
}
columns
=
append
(
columns
,
aggregation
...
)
selector
.
Select
(
columns
...
)
}
selector
.
GroupBy
(
selector
.
Columns
(
*
_g
.
flds
...
)
...
)
if
err
:=
selector
.
Err
();
err
!=
nil
{
return
err
}
rows
:=
&
sql
.
Rows
{}
query
,
args
:=
selector
.
Query
()
if
err
:=
_g
.
build
.
driver
.
Query
(
ctx
,
query
,
args
,
rows
);
err
!=
nil
{
return
err
}
defer
rows
.
Close
()
return
sql
.
ScanSlice
(
rows
,
v
)
}
// ChannelMonitorDailyRollupSelect is the builder for selecting fields of ChannelMonitorDailyRollup entities.
type
ChannelMonitorDailyRollupSelect
struct
{
*
ChannelMonitorDailyRollupQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func
(
_s
*
ChannelMonitorDailyRollupSelect
)
Aggregate
(
fns
...
AggregateFunc
)
*
ChannelMonitorDailyRollupSelect
{
_s
.
fns
=
append
(
_s
.
fns
,
fns
...
)
return
_s
}
// Scan applies the selector query and scans the result into the given value.
func
(
_s
*
ChannelMonitorDailyRollupSelect
)
Scan
(
ctx
context
.
Context
,
v
any
)
error
{
ctx
=
setContextOp
(
ctx
,
_s
.
ctx
,
ent
.
OpQuerySelect
)
if
err
:=
_s
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
err
}
return
scanWithInterceptors
[
*
ChannelMonitorDailyRollupQuery
,
*
ChannelMonitorDailyRollupSelect
](
ctx
,
_s
.
ChannelMonitorDailyRollupQuery
,
_s
,
_s
.
inters
,
v
)
}
func
(
_s
*
ChannelMonitorDailyRollupSelect
)
sqlScan
(
ctx
context
.
Context
,
root
*
ChannelMonitorDailyRollupQuery
,
v
any
)
error
{
selector
:=
root
.
sqlQuery
(
ctx
)
aggregation
:=
make
([]
string
,
0
,
len
(
_s
.
fns
))
for
_
,
fn
:=
range
_s
.
fns
{
aggregation
=
append
(
aggregation
,
fn
(
selector
))
}
switch
n
:=
len
(
*
_s
.
selector
.
flds
);
{
case
n
==
0
&&
len
(
aggregation
)
>
0
:
selector
.
Select
(
aggregation
...
)
case
n
!=
0
&&
len
(
aggregation
)
>
0
:
selector
.
AppendSelect
(
aggregation
...
)
}
rows
:=
&
sql
.
Rows
{}
query
,
args
:=
selector
.
Query
()
if
err
:=
_s
.
driver
.
Query
(
ctx
,
query
,
args
,
rows
);
err
!=
nil
{
return
err
}
defer
rows
.
Close
()
return
sql
.
ScanSlice
(
rows
,
v
)
}
backend/ent/channelmonitordailyrollup_update.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ChannelMonitorDailyRollupUpdate is the builder for updating ChannelMonitorDailyRollup entities.
type
ChannelMonitorDailyRollupUpdate
struct
{
config
hooks
[]
Hook
mutation
*
ChannelMonitorDailyRollupMutation
}
// Where appends a list predicates to the ChannelMonitorDailyRollupUpdate builder.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
Where
(
ps
...
predicate
.
ChannelMonitorDailyRollup
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
Where
(
ps
...
)
return
_u
}
// SetMonitorID sets the "monitor_id" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetMonitorID
(
v
int64
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
SetMonitorID
(
v
)
return
_u
}
// SetNillableMonitorID sets the "monitor_id" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableMonitorID
(
v
*
int64
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetMonitorID
(
*
v
)
}
return
_u
}
// SetModel sets the "model" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetModel
(
v
string
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
SetModel
(
v
)
return
_u
}
// SetNillableModel sets the "model" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableModel
(
v
*
string
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetModel
(
*
v
)
}
return
_u
}
// SetBucketDate sets the "bucket_date" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetBucketDate
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
SetBucketDate
(
v
)
return
_u
}
// SetNillableBucketDate sets the "bucket_date" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableBucketDate
(
v
*
time
.
Time
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetBucketDate
(
*
v
)
}
return
_u
}
// SetTotalChecks sets the "total_checks" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetTotalChecks
()
_u
.
mutation
.
SetTotalChecks
(
v
)
return
_u
}
// SetNillableTotalChecks sets the "total_checks" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableTotalChecks
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetTotalChecks
(
*
v
)
}
return
_u
}
// AddTotalChecks adds value to the "total_checks" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddTotalChecks
(
v
)
return
_u
}
// SetOkCount sets the "ok_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetOkCount
()
_u
.
mutation
.
SetOkCount
(
v
)
return
_u
}
// SetNillableOkCount sets the "ok_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableOkCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetOkCount
(
*
v
)
}
return
_u
}
// AddOkCount adds value to the "ok_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddOkCount
(
v
)
return
_u
}
// SetOperationalCount sets the "operational_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetOperationalCount
()
_u
.
mutation
.
SetOperationalCount
(
v
)
return
_u
}
// SetNillableOperationalCount sets the "operational_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableOperationalCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetOperationalCount
(
*
v
)
}
return
_u
}
// AddOperationalCount adds value to the "operational_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddOperationalCount
(
v
)
return
_u
}
// SetDegradedCount sets the "degraded_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetDegradedCount
()
_u
.
mutation
.
SetDegradedCount
(
v
)
return
_u
}
// SetNillableDegradedCount sets the "degraded_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableDegradedCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetDegradedCount
(
*
v
)
}
return
_u
}
// AddDegradedCount adds value to the "degraded_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddDegradedCount
(
v
)
return
_u
}
// SetFailedCount sets the "failed_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetFailedCount
()
_u
.
mutation
.
SetFailedCount
(
v
)
return
_u
}
// SetNillableFailedCount sets the "failed_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableFailedCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetFailedCount
(
*
v
)
}
return
_u
}
// AddFailedCount adds value to the "failed_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddFailedCount
(
v
)
return
_u
}
// SetErrorCount sets the "error_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetErrorCount
()
_u
.
mutation
.
SetErrorCount
(
v
)
return
_u
}
// SetNillableErrorCount sets the "error_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableErrorCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetErrorCount
(
*
v
)
}
return
_u
}
// AddErrorCount adds value to the "error_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddErrorCount
(
v
)
return
_u
}
// SetSumLatencyMs sets the "sum_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetSumLatencyMs
()
_u
.
mutation
.
SetSumLatencyMs
(
v
)
return
_u
}
// SetNillableSumLatencyMs sets the "sum_latency_ms" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableSumLatencyMs
(
v
*
int64
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetSumLatencyMs
(
*
v
)
}
return
_u
}
// AddSumLatencyMs adds value to the "sum_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddSumLatencyMs
(
v
)
return
_u
}
// SetCountLatency sets the "count_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetCountLatency
()
_u
.
mutation
.
SetCountLatency
(
v
)
return
_u
}
// SetNillableCountLatency sets the "count_latency" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableCountLatency
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetCountLatency
(
*
v
)
}
return
_u
}
// AddCountLatency adds value to the "count_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddCountLatency
(
v
)
return
_u
}
// SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetSumPingLatencyMs
()
_u
.
mutation
.
SetSumPingLatencyMs
(
v
)
return
_u
}
// SetNillableSumPingLatencyMs sets the "sum_ping_latency_ms" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableSumPingLatencyMs
(
v
*
int64
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetSumPingLatencyMs
(
*
v
)
}
return
_u
}
// AddSumPingLatencyMs adds value to the "sum_ping_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddSumPingLatencyMs
(
v
)
return
_u
}
// SetCountPingLatency sets the "count_ping_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ResetCountPingLatency
()
_u
.
mutation
.
SetCountPingLatency
(
v
)
return
_u
}
// SetNillableCountPingLatency sets the "count_ping_latency" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetNillableCountPingLatency
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdate
{
if
v
!=
nil
{
_u
.
SetCountPingLatency
(
*
v
)
}
return
_u
}
// AddCountPingLatency adds value to the "count_ping_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
AddCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
AddCountPingLatency
(
v
)
return
_u
}
// SetComputedAt sets the "computed_at" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetComputedAt
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
SetComputedAt
(
v
)
return
_u
}
// SetMonitor sets the "monitor" edge to the ChannelMonitor entity.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SetMonitor
(
v
*
ChannelMonitor
)
*
ChannelMonitorDailyRollupUpdate
{
return
_u
.
SetMonitorID
(
v
.
ID
)
}
// Mutation returns the ChannelMonitorDailyRollupMutation object of the builder.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
Mutation
()
*
ChannelMonitorDailyRollupMutation
{
return
_u
.
mutation
}
// ClearMonitor clears the "monitor" edge to the ChannelMonitor entity.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
ClearMonitor
()
*
ChannelMonitorDailyRollupUpdate
{
_u
.
mutation
.
ClearMonitor
()
return
_u
}
// Save executes the query and returns the number of nodes affected by the update operation.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
Save
(
ctx
context
.
Context
)
(
int
,
error
)
{
_u
.
defaults
()
return
withHooks
(
ctx
,
_u
.
sqlSave
,
_u
.
mutation
,
_u
.
hooks
)
}
// SaveX is like Save, but panics if an error occurs.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
SaveX
(
ctx
context
.
Context
)
int
{
affected
,
err
:=
_u
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
affected
}
// Exec executes the query.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_u
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_u
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// defaults sets the default values of the builder before save.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
defaults
()
{
if
_
,
ok
:=
_u
.
mutation
.
ComputedAt
();
!
ok
{
v
:=
channelmonitordailyrollup
.
UpdateDefaultComputedAt
()
_u
.
mutation
.
SetComputedAt
(
v
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
check
()
error
{
if
v
,
ok
:=
_u
.
mutation
.
Model
();
ok
{
if
err
:=
channelmonitordailyrollup
.
ModelValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"model"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitorDailyRollup.model": %w`
,
err
)}
}
}
if
_u
.
mutation
.
MonitorCleared
()
&&
len
(
_u
.
mutation
.
MonitorIDs
())
>
0
{
return
errors
.
New
(
`ent: clearing a required unique edge "ChannelMonitorDailyRollup.monitor"`
)
}
return
nil
}
func
(
_u
*
ChannelMonitorDailyRollupUpdate
)
sqlSave
(
ctx
context
.
Context
)
(
_node
int
,
err
error
)
{
if
err
:=
_u
.
check
();
err
!=
nil
{
return
_node
,
err
}
_spec
:=
sqlgraph
.
NewUpdateSpec
(
channelmonitordailyrollup
.
Table
,
channelmonitordailyrollup
.
Columns
,
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
))
if
ps
:=
_u
.
mutation
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
if
value
,
ok
:=
_u
.
mutation
.
Model
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldModel
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BucketDate
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldBucketDate
,
field
.
TypeTime
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
TotalChecks
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldTotalChecks
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedTotalChecks
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldTotalChecks
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
OkCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldOkCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedOkCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldOkCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
OperationalCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldOperationalCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedOperationalCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldOperationalCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
DegradedCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldDegradedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedDegradedCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldDegradedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
FailedCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldFailedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedFailedCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldFailedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ErrorCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldErrorCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedErrorCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldErrorCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
SumLatencyMs
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldSumLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedSumLatencyMs
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldSumLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
CountLatency
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldCountLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedCountLatency
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldCountLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
SumPingLatencyMs
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedSumPingLatencyMs
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
CountPingLatency
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldCountPingLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedCountPingLatency
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldCountPingLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ComputedAt
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldComputedAt
,
field
.
TypeTime
,
value
)
}
if
_u
.
mutation
.
MonitorCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
true
,
Table
:
channelmonitordailyrollup
.
MonitorTable
,
Columns
:
[]
string
{
channelmonitordailyrollup
.
MonitorColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
MonitorIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
true
,
Table
:
channelmonitordailyrollup
.
MonitorTable
,
Columns
:
[]
string
{
channelmonitordailyrollup
.
MonitorColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
if
_node
,
err
=
sqlgraph
.
UpdateNodes
(
ctx
,
_u
.
driver
,
_spec
);
err
!=
nil
{
if
_
,
ok
:=
err
.
(
*
sqlgraph
.
NotFoundError
);
ok
{
err
=
&
NotFoundError
{
channelmonitordailyrollup
.
Label
}
}
else
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
0
,
err
}
_u
.
mutation
.
done
=
true
return
_node
,
nil
}
// ChannelMonitorDailyRollupUpdateOne is the builder for updating a single ChannelMonitorDailyRollup entity.
type
ChannelMonitorDailyRollupUpdateOne
struct
{
config
fields
[]
string
hooks
[]
Hook
mutation
*
ChannelMonitorDailyRollupMutation
}
// SetMonitorID sets the "monitor_id" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetMonitorID
(
v
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
SetMonitorID
(
v
)
return
_u
}
// SetNillableMonitorID sets the "monitor_id" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableMonitorID
(
v
*
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetMonitorID
(
*
v
)
}
return
_u
}
// SetModel sets the "model" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetModel
(
v
string
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
SetModel
(
v
)
return
_u
}
// SetNillableModel sets the "model" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableModel
(
v
*
string
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetModel
(
*
v
)
}
return
_u
}
// SetBucketDate sets the "bucket_date" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetBucketDate
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
SetBucketDate
(
v
)
return
_u
}
// SetNillableBucketDate sets the "bucket_date" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableBucketDate
(
v
*
time
.
Time
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetBucketDate
(
*
v
)
}
return
_u
}
// SetTotalChecks sets the "total_checks" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetTotalChecks
()
_u
.
mutation
.
SetTotalChecks
(
v
)
return
_u
}
// SetNillableTotalChecks sets the "total_checks" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableTotalChecks
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetTotalChecks
(
*
v
)
}
return
_u
}
// AddTotalChecks adds value to the "total_checks" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddTotalChecks
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddTotalChecks
(
v
)
return
_u
}
// SetOkCount sets the "ok_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetOkCount
()
_u
.
mutation
.
SetOkCount
(
v
)
return
_u
}
// SetNillableOkCount sets the "ok_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableOkCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetOkCount
(
*
v
)
}
return
_u
}
// AddOkCount adds value to the "ok_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddOkCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddOkCount
(
v
)
return
_u
}
// SetOperationalCount sets the "operational_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetOperationalCount
()
_u
.
mutation
.
SetOperationalCount
(
v
)
return
_u
}
// SetNillableOperationalCount sets the "operational_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableOperationalCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetOperationalCount
(
*
v
)
}
return
_u
}
// AddOperationalCount adds value to the "operational_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddOperationalCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddOperationalCount
(
v
)
return
_u
}
// SetDegradedCount sets the "degraded_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetDegradedCount
()
_u
.
mutation
.
SetDegradedCount
(
v
)
return
_u
}
// SetNillableDegradedCount sets the "degraded_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableDegradedCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetDegradedCount
(
*
v
)
}
return
_u
}
// AddDegradedCount adds value to the "degraded_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddDegradedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddDegradedCount
(
v
)
return
_u
}
// SetFailedCount sets the "failed_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetFailedCount
()
_u
.
mutation
.
SetFailedCount
(
v
)
return
_u
}
// SetNillableFailedCount sets the "failed_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableFailedCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetFailedCount
(
*
v
)
}
return
_u
}
// AddFailedCount adds value to the "failed_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddFailedCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddFailedCount
(
v
)
return
_u
}
// SetErrorCount sets the "error_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetErrorCount
()
_u
.
mutation
.
SetErrorCount
(
v
)
return
_u
}
// SetNillableErrorCount sets the "error_count" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableErrorCount
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetErrorCount
(
*
v
)
}
return
_u
}
// AddErrorCount adds value to the "error_count" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddErrorCount
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddErrorCount
(
v
)
return
_u
}
// SetSumLatencyMs sets the "sum_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetSumLatencyMs
()
_u
.
mutation
.
SetSumLatencyMs
(
v
)
return
_u
}
// SetNillableSumLatencyMs sets the "sum_latency_ms" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableSumLatencyMs
(
v
*
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetSumLatencyMs
(
*
v
)
}
return
_u
}
// AddSumLatencyMs adds value to the "sum_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddSumLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddSumLatencyMs
(
v
)
return
_u
}
// SetCountLatency sets the "count_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetCountLatency
()
_u
.
mutation
.
SetCountLatency
(
v
)
return
_u
}
// SetNillableCountLatency sets the "count_latency" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableCountLatency
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetCountLatency
(
*
v
)
}
return
_u
}
// AddCountLatency adds value to the "count_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddCountLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddCountLatency
(
v
)
return
_u
}
// SetSumPingLatencyMs sets the "sum_ping_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetSumPingLatencyMs
()
_u
.
mutation
.
SetSumPingLatencyMs
(
v
)
return
_u
}
// SetNillableSumPingLatencyMs sets the "sum_ping_latency_ms" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableSumPingLatencyMs
(
v
*
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetSumPingLatencyMs
(
*
v
)
}
return
_u
}
// AddSumPingLatencyMs adds value to the "sum_ping_latency_ms" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddSumPingLatencyMs
(
v
int64
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddSumPingLatencyMs
(
v
)
return
_u
}
// SetCountPingLatency sets the "count_ping_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ResetCountPingLatency
()
_u
.
mutation
.
SetCountPingLatency
(
v
)
return
_u
}
// SetNillableCountPingLatency sets the "count_ping_latency" field if the given value is not nil.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetNillableCountPingLatency
(
v
*
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
if
v
!=
nil
{
_u
.
SetCountPingLatency
(
*
v
)
}
return
_u
}
// AddCountPingLatency adds value to the "count_ping_latency" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
AddCountPingLatency
(
v
int
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
AddCountPingLatency
(
v
)
return
_u
}
// SetComputedAt sets the "computed_at" field.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetComputedAt
(
v
time
.
Time
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
SetComputedAt
(
v
)
return
_u
}
// SetMonitor sets the "monitor" edge to the ChannelMonitor entity.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SetMonitor
(
v
*
ChannelMonitor
)
*
ChannelMonitorDailyRollupUpdateOne
{
return
_u
.
SetMonitorID
(
v
.
ID
)
}
// Mutation returns the ChannelMonitorDailyRollupMutation object of the builder.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
Mutation
()
*
ChannelMonitorDailyRollupMutation
{
return
_u
.
mutation
}
// ClearMonitor clears the "monitor" edge to the ChannelMonitor entity.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
ClearMonitor
()
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
ClearMonitor
()
return
_u
}
// Where appends a list predicates to the ChannelMonitorDailyRollupUpdate builder.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
Where
(
ps
...
predicate
.
ChannelMonitorDailyRollup
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
mutation
.
Where
(
ps
...
)
return
_u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
Select
(
field
string
,
fields
...
string
)
*
ChannelMonitorDailyRollupUpdateOne
{
_u
.
fields
=
append
([]
string
{
field
},
fields
...
)
return
_u
}
// Save executes the query and returns the updated ChannelMonitorDailyRollup entity.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
Save
(
ctx
context
.
Context
)
(
*
ChannelMonitorDailyRollup
,
error
)
{
_u
.
defaults
()
return
withHooks
(
ctx
,
_u
.
sqlSave
,
_u
.
mutation
,
_u
.
hooks
)
}
// SaveX is like Save, but panics if an error occurs.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
SaveX
(
ctx
context
.
Context
)
*
ChannelMonitorDailyRollup
{
node
,
err
:=
_u
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
node
}
// Exec executes the query on the entity.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_u
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_u
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// defaults sets the default values of the builder before save.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
defaults
()
{
if
_
,
ok
:=
_u
.
mutation
.
ComputedAt
();
!
ok
{
v
:=
channelmonitordailyrollup
.
UpdateDefaultComputedAt
()
_u
.
mutation
.
SetComputedAt
(
v
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
check
()
error
{
if
v
,
ok
:=
_u
.
mutation
.
Model
();
ok
{
if
err
:=
channelmonitordailyrollup
.
ModelValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"model"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "ChannelMonitorDailyRollup.model": %w`
,
err
)}
}
}
if
_u
.
mutation
.
MonitorCleared
()
&&
len
(
_u
.
mutation
.
MonitorIDs
())
>
0
{
return
errors
.
New
(
`ent: clearing a required unique edge "ChannelMonitorDailyRollup.monitor"`
)
}
return
nil
}
func
(
_u
*
ChannelMonitorDailyRollupUpdateOne
)
sqlSave
(
ctx
context
.
Context
)
(
_node
*
ChannelMonitorDailyRollup
,
err
error
)
{
if
err
:=
_u
.
check
();
err
!=
nil
{
return
_node
,
err
}
_spec
:=
sqlgraph
.
NewUpdateSpec
(
channelmonitordailyrollup
.
Table
,
channelmonitordailyrollup
.
Columns
,
sqlgraph
.
NewFieldSpec
(
channelmonitordailyrollup
.
FieldID
,
field
.
TypeInt64
))
id
,
ok
:=
_u
.
mutation
.
ID
()
if
!
ok
{
return
nil
,
&
ValidationError
{
Name
:
"id"
,
err
:
errors
.
New
(
`ent: missing "ChannelMonitorDailyRollup.id" for update`
)}
}
_spec
.
Node
.
ID
.
Value
=
id
if
fields
:=
_u
.
fields
;
len
(
fields
)
>
0
{
_spec
.
Node
.
Columns
=
make
([]
string
,
0
,
len
(
fields
))
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
channelmonitordailyrollup
.
FieldID
)
for
_
,
f
:=
range
fields
{
if
!
channelmonitordailyrollup
.
ValidColumn
(
f
)
{
return
nil
,
&
ValidationError
{
Name
:
f
,
err
:
fmt
.
Errorf
(
"ent: invalid field %q for query"
,
f
)}
}
if
f
!=
channelmonitordailyrollup
.
FieldID
{
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
f
)
}
}
}
if
ps
:=
_u
.
mutation
.
predicates
;
len
(
ps
)
>
0
{
_spec
.
Predicate
=
func
(
selector
*
sql
.
Selector
)
{
for
i
:=
range
ps
{
ps
[
i
](
selector
)
}
}
}
if
value
,
ok
:=
_u
.
mutation
.
Model
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldModel
,
field
.
TypeString
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
BucketDate
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldBucketDate
,
field
.
TypeTime
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
TotalChecks
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldTotalChecks
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedTotalChecks
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldTotalChecks
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
OkCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldOkCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedOkCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldOkCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
OperationalCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldOperationalCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedOperationalCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldOperationalCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
DegradedCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldDegradedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedDegradedCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldDegradedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
FailedCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldFailedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedFailedCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldFailedCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ErrorCount
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldErrorCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedErrorCount
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldErrorCount
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
SumLatencyMs
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldSumLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedSumLatencyMs
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldSumLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
CountLatency
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldCountLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedCountLatency
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldCountLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
SumPingLatencyMs
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedSumPingLatencyMs
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldSumPingLatencyMs
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
CountPingLatency
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldCountPingLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedCountPingLatency
();
ok
{
_spec
.
AddField
(
channelmonitordailyrollup
.
FieldCountPingLatency
,
field
.
TypeInt
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
ComputedAt
();
ok
{
_spec
.
SetField
(
channelmonitordailyrollup
.
FieldComputedAt
,
field
.
TypeTime
,
value
)
}
if
_u
.
mutation
.
MonitorCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
true
,
Table
:
channelmonitordailyrollup
.
MonitorTable
,
Columns
:
[]
string
{
channelmonitordailyrollup
.
MonitorColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
),
},
}
_spec
.
Edges
.
Clear
=
append
(
_spec
.
Edges
.
Clear
,
edge
)
}
if
nodes
:=
_u
.
mutation
.
MonitorIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
Inverse
:
true
,
Table
:
channelmonitordailyrollup
.
MonitorTable
,
Columns
:
[]
string
{
channelmonitordailyrollup
.
MonitorColumn
},
Bidi
:
false
,
Target
:
&
sqlgraph
.
EdgeTarget
{
IDSpec
:
sqlgraph
.
NewFieldSpec
(
channelmonitor
.
FieldID
,
field
.
TypeInt64
),
},
}
for
_
,
k
:=
range
nodes
{
edge
.
Target
.
Nodes
=
append
(
edge
.
Target
.
Nodes
,
k
)
}
_spec
.
Edges
.
Add
=
append
(
_spec
.
Edges
.
Add
,
edge
)
}
_node
=
&
ChannelMonitorDailyRollup
{
config
:
_u
.
config
}
_spec
.
Assign
=
_node
.
assignValues
_spec
.
ScanValues
=
_node
.
scanValues
if
err
=
sqlgraph
.
UpdateNode
(
ctx
,
_u
.
driver
,
_spec
);
err
!=
nil
{
if
_
,
ok
:=
err
.
(
*
sqlgraph
.
NotFoundError
);
ok
{
err
=
&
NotFoundError
{
channelmonitordailyrollup
.
Label
}
}
else
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
nil
,
err
}
_u
.
mutation
.
done
=
true
return
_node
,
nil
}
backend/ent/channelmonitorhistory.go
0 → 100644
View file @
ac114738
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
)
// ChannelMonitorHistory is the model entity for the ChannelMonitorHistory schema.
type
ChannelMonitorHistory
struct
{
config
`json:"-"`
// ID of the ent.
ID
int64
`json:"id,omitempty"`
// MonitorID holds the value of the "monitor_id" field.
MonitorID
int64
`json:"monitor_id,omitempty"`
// Model holds the value of the "model" field.
Model
string
`json:"model,omitempty"`
// Status holds the value of the "status" field.
Status
channelmonitorhistory
.
Status
`json:"status,omitempty"`
// LatencyMs holds the value of the "latency_ms" field.
LatencyMs
*
int
`json:"latency_ms,omitempty"`
// PingLatencyMs holds the value of the "ping_latency_ms" field.
PingLatencyMs
*
int
`json:"ping_latency_ms,omitempty"`
// Message holds the value of the "message" field.
Message
string
`json:"message,omitempty"`
// CheckedAt holds the value of the "checked_at" field.
CheckedAt
time
.
Time
`json:"checked_at,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the ChannelMonitorHistoryQuery when eager-loading is set.
Edges
ChannelMonitorHistoryEdges
`json:"edges"`
selectValues
sql
.
SelectValues
}
// ChannelMonitorHistoryEdges holds the relations/edges for other nodes in the graph.
type
ChannelMonitorHistoryEdges
struct
{
// Monitor holds the value of the monitor edge.
Monitor
*
ChannelMonitor
`json:"monitor,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes
[
1
]
bool
}
// MonitorOrErr returns the Monitor value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func
(
e
ChannelMonitorHistoryEdges
)
MonitorOrErr
()
(
*
ChannelMonitor
,
error
)
{
if
e
.
Monitor
!=
nil
{
return
e
.
Monitor
,
nil
}
else
if
e
.
loadedTypes
[
0
]
{
return
nil
,
&
NotFoundError
{
label
:
channelmonitor
.
Label
}
}
return
nil
,
&
NotLoadedError
{
edge
:
"monitor"
}
}
// scanValues returns the types for scanning values from sql.Rows.
func
(
*
ChannelMonitorHistory
)
scanValues
(
columns
[]
string
)
([]
any
,
error
)
{
values
:=
make
([]
any
,
len
(
columns
))
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
channelmonitorhistory
.
FieldID
,
channelmonitorhistory
.
FieldMonitorID
,
channelmonitorhistory
.
FieldLatencyMs
,
channelmonitorhistory
.
FieldPingLatencyMs
:
values
[
i
]
=
new
(
sql
.
NullInt64
)
case
channelmonitorhistory
.
FieldModel
,
channelmonitorhistory
.
FieldStatus
,
channelmonitorhistory
.
FieldMessage
:
values
[
i
]
=
new
(
sql
.
NullString
)
case
channelmonitorhistory
.
FieldCheckedAt
:
values
[
i
]
=
new
(
sql
.
NullTime
)
default
:
values
[
i
]
=
new
(
sql
.
UnknownType
)
}
}
return
values
,
nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the ChannelMonitorHistory fields.
func
(
_m
*
ChannelMonitorHistory
)
assignValues
(
columns
[]
string
,
values
[]
any
)
error
{
if
m
,
n
:=
len
(
values
),
len
(
columns
);
m
<
n
{
return
fmt
.
Errorf
(
"mismatch number of scan values: %d != %d"
,
m
,
n
)
}
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
channelmonitorhistory
.
FieldID
:
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
)
if
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field id"
,
value
)
}
_m
.
ID
=
int64
(
value
.
Int64
)
case
channelmonitorhistory
.
FieldMonitorID
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field monitor_id"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
MonitorID
=
value
.
Int64
}
case
channelmonitorhistory
.
FieldModel
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field model"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Model
=
value
.
String
}
case
channelmonitorhistory
.
FieldStatus
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field status"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Status
=
channelmonitorhistory
.
Status
(
value
.
String
)
}
case
channelmonitorhistory
.
FieldLatencyMs
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field latency_ms"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
LatencyMs
=
new
(
int
)
*
_m
.
LatencyMs
=
int
(
value
.
Int64
)
}
case
channelmonitorhistory
.
FieldPingLatencyMs
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field ping_latency_ms"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
PingLatencyMs
=
new
(
int
)
*
_m
.
PingLatencyMs
=
int
(
value
.
Int64
)
}
case
channelmonitorhistory
.
FieldMessage
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field message"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Message
=
value
.
String
}
case
channelmonitorhistory
.
FieldCheckedAt
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullTime
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field checked_at"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
CheckedAt
=
value
.
Time
}
default
:
_m
.
selectValues
.
Set
(
columns
[
i
],
values
[
i
])
}
}
return
nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the ChannelMonitorHistory.
// This includes values selected through modifiers, order, etc.
func
(
_m
*
ChannelMonitorHistory
)
Value
(
name
string
)
(
ent
.
Value
,
error
)
{
return
_m
.
selectValues
.
Get
(
name
)
}
// QueryMonitor queries the "monitor" edge of the ChannelMonitorHistory entity.
func
(
_m
*
ChannelMonitorHistory
)
QueryMonitor
()
*
ChannelMonitorQuery
{
return
NewChannelMonitorHistoryClient
(
_m
.
config
)
.
QueryMonitor
(
_m
)
}
// Update returns a builder for updating this ChannelMonitorHistory.
// Note that you need to call ChannelMonitorHistory.Unwrap() before calling this method if this ChannelMonitorHistory
// was returned from a transaction, and the transaction was committed or rolled back.
func
(
_m
*
ChannelMonitorHistory
)
Update
()
*
ChannelMonitorHistoryUpdateOne
{
return
NewChannelMonitorHistoryClient
(
_m
.
config
)
.
UpdateOne
(
_m
)
}
// Unwrap unwraps the ChannelMonitorHistory entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func
(
_m
*
ChannelMonitorHistory
)
Unwrap
()
*
ChannelMonitorHistory
{
_tx
,
ok
:=
_m
.
config
.
driver
.
(
*
txDriver
)
if
!
ok
{
panic
(
"ent: ChannelMonitorHistory is not a transactional entity"
)
}
_m
.
config
.
driver
=
_tx
.
drv
return
_m
}
// String implements the fmt.Stringer.
func
(
_m
*
ChannelMonitorHistory
)
String
()
string
{
var
builder
strings
.
Builder
builder
.
WriteString
(
"ChannelMonitorHistory("
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"id=%v, "
,
_m
.
ID
))
builder
.
WriteString
(
"monitor_id="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
MonitorID
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"model="
)
builder
.
WriteString
(
_m
.
Model
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"status="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
Status
))
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
LatencyMs
;
v
!=
nil
{
builder
.
WriteString
(
"latency_ms="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
*
v
))
}
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
PingLatencyMs
;
v
!=
nil
{
builder
.
WriteString
(
"ping_latency_ms="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
*
v
))
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"message="
)
builder
.
WriteString
(
_m
.
Message
)
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"checked_at="
)
builder
.
WriteString
(
_m
.
CheckedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteByte
(
')'
)
return
builder
.
String
()
}
// ChannelMonitorHistories is a parsable slice of ChannelMonitorHistory.
type
ChannelMonitorHistories
[]
*
ChannelMonitorHistory
backend/ent/channelmonitorhistory/channelmonitorhistory.go
0 → 100644
View file @
ac114738
// 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
),
)
}
backend/ent/channelmonitorhistory/where.go
0 → 100644
View file @
ac114738
// 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
))
}
Prev
1
2
3
4
5
…
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment