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
994da655
"backend/vscode:/vscode.git/clone" did not exist on "5f41899705cca0a88e6823f18522a974b22870a1"
Commit
994da655
authored
Apr 24, 2026
by
陈曦
Browse files
收集req和resp的相关更改
parent
8f7ac1ea
Changes
37
Show whitespace changes
Inline
Side-by-side
backend/cmd/server/wire_gen.go
View file @
994da655
...
...
@@ -223,10 +223,12 @@ func initializeApplication(buildInfo handler.BuildInfo) (*Application, error) {
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
)
usageRecordWorkerPool
:=
service
.
NewUsageRecordWorkerPool
(
configConfig
)
requestCaptureLogRepository
:=
repository
.
NewRequestCaptureLogRepository
(
client
)
requestCaptureService
:=
service
.
NewRequestCaptureService
(
requestCaptureLogRepository
,
configConfig
)
userMsgQueueCache
:=
repository
.
NewUserMsgQueueCache
(
redisClient
)
userMessageQueueService
:=
service
.
ProvideUserMessageQueueService
(
userMsgQueueCache
,
rpmCache
,
configConfig
)
gatewayHandler
:=
handler
.
NewGatewayHandler
(
gatewayService
,
geminiMessagesCompatService
,
antigravityGatewayService
,
userService
,
concurrencyService
,
billingCacheService
,
usageService
,
apiKeyService
,
usageRecordWorkerPool
,
errorPassthroughService
,
userMessageQueueService
,
configConfig
,
settingService
)
openAIGatewayHandler
:=
handler
.
NewOpenAIGatewayHandler
(
openAIGatewayService
,
concurrencyService
,
billingCacheService
,
apiKeyService
,
usageRecordWorkerPool
,
errorPassthroughService
,
configConfig
)
gatewayHandler
:=
handler
.
NewGatewayHandler
(
gatewayService
,
geminiMessagesCompatService
,
antigravityGatewayService
,
userService
,
concurrencyService
,
billingCacheService
,
usageService
,
apiKeyService
,
usageRecordWorkerPool
,
errorPassthroughService
,
requestCaptureService
,
userMessageQueueService
,
configConfig
,
settingService
)
openAIGatewayHandler
:=
handler
.
NewOpenAIGatewayHandler
(
openAIGatewayService
,
concurrencyService
,
billingCacheService
,
apiKeyService
,
usageRecordWorkerPool
,
errorPassthroughService
,
requestCaptureService
,
configConfig
)
handlerSettingHandler
:=
handler
.
ProvideSettingHandler
(
settingService
,
buildInfo
)
totpHandler
:=
handler
.
NewTotpHandler
(
totpService
)
handlerPaymentHandler
:=
handler
.
NewPaymentHandler
(
paymentService
,
paymentConfigService
,
channelService
)
...
...
backend/ent/apikey.go
View file @
994da655
...
...
@@ -66,6 +66,8 @@ type APIKey struct {
Window1dStart
*
time
.
Time
`json:"window_1d_start,omitempty"`
// Start time of the current 7d rate limit window
Window7dStart
*
time
.
Time
`json:"window_7d_start,omitempty"`
// 是否对该 API Key 的请求体进行存储捕获
CaptureRequests
bool
`json:"capture_requests,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the APIKeyQuery when eager-loading is set.
Edges
APIKeyEdges
`json:"edges"`
...
...
@@ -123,6 +125,8 @@ func (*APIKey) scanValues(columns []string) ([]any, error) {
switch
columns
[
i
]
{
case
apikey
.
FieldIPWhitelist
,
apikey
.
FieldIPBlacklist
:
values
[
i
]
=
new
([]
byte
)
case
apikey
.
FieldCaptureRequests
:
values
[
i
]
=
new
(
sql
.
NullBool
)
case
apikey
.
FieldQuota
,
apikey
.
FieldQuotaUsed
,
apikey
.
FieldRateLimit5h
,
apikey
.
FieldRateLimit1d
,
apikey
.
FieldRateLimit7d
,
apikey
.
FieldUsage5h
,
apikey
.
FieldUsage1d
,
apikey
.
FieldUsage7d
:
values
[
i
]
=
new
(
sql
.
NullFloat64
)
case
apikey
.
FieldID
,
apikey
.
FieldUserID
,
apikey
.
FieldGroupID
:
...
...
@@ -301,6 +305,12 @@ func (_m *APIKey) assignValues(columns []string, values []any) error {
_m
.
Window7dStart
=
new
(
time
.
Time
)
*
_m
.
Window7dStart
=
value
.
Time
}
case
apikey
.
FieldCaptureRequests
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullBool
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field capture_requests"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
CaptureRequests
=
value
.
Bool
}
default
:
_m
.
selectValues
.
Set
(
columns
[
i
],
values
[
i
])
}
...
...
@@ -434,6 +444,9 @@ func (_m *APIKey) String() string {
builder
.
WriteString
(
"window_7d_start="
)
builder
.
WriteString
(
v
.
Format
(
time
.
ANSIC
))
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"capture_requests="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
CaptureRequests
))
builder
.
WriteByte
(
')'
)
return
builder
.
String
()
}
...
...
backend/ent/apikey/apikey.go
View file @
994da655
...
...
@@ -61,6 +61,8 @@ const (
FieldWindow1dStart
=
"window_1d_start"
// FieldWindow7dStart holds the string denoting the window_7d_start field in the database.
FieldWindow7dStart
=
"window_7d_start"
// FieldCaptureRequests holds the string denoting the capture_requests field in the database.
FieldCaptureRequests
=
"capture_requests"
// EdgeUser holds the string denoting the user edge name in mutations.
EdgeUser
=
"user"
// EdgeGroup holds the string denoting the group edge name in mutations.
...
...
@@ -118,6 +120,7 @@ var Columns = []string{
FieldWindow5hStart
,
FieldWindow1dStart
,
FieldWindow7dStart
,
FieldCaptureRequests
,
}
// ValidColumn reports if the column name is valid (part of the table columns).
...
...
@@ -168,6 +171,8 @@ var (
DefaultUsage1d
float64
// DefaultUsage7d holds the default value on creation for the "usage_7d" field.
DefaultUsage7d
float64
// DefaultCaptureRequests holds the default value on creation for the "capture_requests" field.
DefaultCaptureRequests
bool
)
// OrderOption defines the ordering options for the APIKey queries.
...
...
@@ -283,6 +288,11 @@ func ByWindow7dStart(opts ...sql.OrderTermOption) OrderOption {
return
sql
.
OrderByField
(
FieldWindow7dStart
,
opts
...
)
.
ToFunc
()
}
// ByCaptureRequests orders the results by the capture_requests field.
func
ByCaptureRequests
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldCaptureRequests
,
opts
...
)
.
ToFunc
()
}
// ByUserField orders the results by user field.
func
ByUserField
(
field
string
,
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
func
(
s
*
sql
.
Selector
)
{
...
...
backend/ent/apikey/where.go
View file @
994da655
...
...
@@ -160,6 +160,11 @@ func Window7dStart(v time.Time) predicate.APIKey {
return
predicate
.
APIKey
(
sql
.
FieldEQ
(
FieldWindow7dStart
,
v
))
}
// CaptureRequests applies equality check predicate on the "capture_requests" field. It's identical to CaptureRequestsEQ.
func
CaptureRequests
(
v
bool
)
predicate
.
APIKey
{
return
predicate
.
APIKey
(
sql
.
FieldEQ
(
FieldCaptureRequests
,
v
))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func
CreatedAtEQ
(
v
time
.
Time
)
predicate
.
APIKey
{
return
predicate
.
APIKey
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
...
...
@@ -1125,6 +1130,16 @@ func Window7dStartNotNil() predicate.APIKey {
return
predicate
.
APIKey
(
sql
.
FieldNotNull
(
FieldWindow7dStart
))
}
// CaptureRequestsEQ applies the EQ predicate on the "capture_requests" field.
func
CaptureRequestsEQ
(
v
bool
)
predicate
.
APIKey
{
return
predicate
.
APIKey
(
sql
.
FieldEQ
(
FieldCaptureRequests
,
v
))
}
// CaptureRequestsNEQ applies the NEQ predicate on the "capture_requests" field.
func
CaptureRequestsNEQ
(
v
bool
)
predicate
.
APIKey
{
return
predicate
.
APIKey
(
sql
.
FieldNEQ
(
FieldCaptureRequests
,
v
))
}
// HasUser applies the HasEdge predicate on the "user" edge.
func
HasUser
()
predicate
.
APIKey
{
return
predicate
.
APIKey
(
func
(
s
*
sql
.
Selector
)
{
...
...
backend/ent/apikey_create.go
View file @
994da655
...
...
@@ -307,6 +307,20 @@ func (_c *APIKeyCreate) SetNillableWindow7dStart(v *time.Time) *APIKeyCreate {
return
_c
}
// SetCaptureRequests sets the "capture_requests" field.
func
(
_c
*
APIKeyCreate
)
SetCaptureRequests
(
v
bool
)
*
APIKeyCreate
{
_c
.
mutation
.
SetCaptureRequests
(
v
)
return
_c
}
// SetNillableCaptureRequests sets the "capture_requests" field if the given value is not nil.
func
(
_c
*
APIKeyCreate
)
SetNillableCaptureRequests
(
v
*
bool
)
*
APIKeyCreate
{
if
v
!=
nil
{
_c
.
SetCaptureRequests
(
*
v
)
}
return
_c
}
// SetUser sets the "user" edge to the User entity.
func
(
_c
*
APIKeyCreate
)
SetUser
(
v
*
User
)
*
APIKeyCreate
{
return
_c
.
SetUserID
(
v
.
ID
)
...
...
@@ -419,6 +433,10 @@ func (_c *APIKeyCreate) defaults() error {
v
:=
apikey
.
DefaultUsage7d
_c
.
mutation
.
SetUsage7d
(
v
)
}
if
_
,
ok
:=
_c
.
mutation
.
CaptureRequests
();
!
ok
{
v
:=
apikey
.
DefaultCaptureRequests
_c
.
mutation
.
SetCaptureRequests
(
v
)
}
return
nil
}
...
...
@@ -481,6 +499,9 @@ func (_c *APIKeyCreate) check() error {
if
_
,
ok
:=
_c
.
mutation
.
Usage7d
();
!
ok
{
return
&
ValidationError
{
Name
:
"usage_7d"
,
err
:
errors
.
New
(
`ent: missing required field "APIKey.usage_7d"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
CaptureRequests
();
!
ok
{
return
&
ValidationError
{
Name
:
"capture_requests"
,
err
:
errors
.
New
(
`ent: missing required field "APIKey.capture_requests"`
)}
}
if
len
(
_c
.
mutation
.
UserIDs
())
==
0
{
return
&
ValidationError
{
Name
:
"user"
,
err
:
errors
.
New
(
`ent: missing required edge "APIKey.user"`
)}
}
...
...
@@ -595,6 +616,10 @@ func (_c *APIKeyCreate) createSpec() (*APIKey, *sqlgraph.CreateSpec) {
_spec
.
SetField
(
apikey
.
FieldWindow7dStart
,
field
.
TypeTime
,
value
)
_node
.
Window7dStart
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
CaptureRequests
();
ok
{
_spec
.
SetField
(
apikey
.
FieldCaptureRequests
,
field
.
TypeBool
,
value
)
_node
.
CaptureRequests
=
value
}
if
nodes
:=
_c
.
mutation
.
UserIDs
();
len
(
nodes
)
>
0
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
...
...
@@ -1063,6 +1088,18 @@ func (u *APIKeyUpsert) ClearWindow7dStart() *APIKeyUpsert {
return
u
}
// SetCaptureRequests sets the "capture_requests" field.
func
(
u
*
APIKeyUpsert
)
SetCaptureRequests
(
v
bool
)
*
APIKeyUpsert
{
u
.
Set
(
apikey
.
FieldCaptureRequests
,
v
)
return
u
}
// UpdateCaptureRequests sets the "capture_requests" field to the value that was provided on create.
func
(
u
*
APIKeyUpsert
)
UpdateCaptureRequests
()
*
APIKeyUpsert
{
u
.
SetExcluded
(
apikey
.
FieldCaptureRequests
)
return
u
}
// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
...
...
@@ -1535,6 +1572,20 @@ func (u *APIKeyUpsertOne) ClearWindow7dStart() *APIKeyUpsertOne {
})
}
// SetCaptureRequests sets the "capture_requests" field.
func
(
u
*
APIKeyUpsertOne
)
SetCaptureRequests
(
v
bool
)
*
APIKeyUpsertOne
{
return
u
.
Update
(
func
(
s
*
APIKeyUpsert
)
{
s
.
SetCaptureRequests
(
v
)
})
}
// UpdateCaptureRequests sets the "capture_requests" field to the value that was provided on create.
func
(
u
*
APIKeyUpsertOne
)
UpdateCaptureRequests
()
*
APIKeyUpsertOne
{
return
u
.
Update
(
func
(
s
*
APIKeyUpsert
)
{
s
.
UpdateCaptureRequests
()
})
}
// Exec executes the query.
func
(
u
*
APIKeyUpsertOne
)
Exec
(
ctx
context
.
Context
)
error
{
if
len
(
u
.
create
.
conflict
)
==
0
{
...
...
@@ -2173,6 +2224,20 @@ func (u *APIKeyUpsertBulk) ClearWindow7dStart() *APIKeyUpsertBulk {
})
}
// SetCaptureRequests sets the "capture_requests" field.
func
(
u
*
APIKeyUpsertBulk
)
SetCaptureRequests
(
v
bool
)
*
APIKeyUpsertBulk
{
return
u
.
Update
(
func
(
s
*
APIKeyUpsert
)
{
s
.
SetCaptureRequests
(
v
)
})
}
// UpdateCaptureRequests sets the "capture_requests" field to the value that was provided on create.
func
(
u
*
APIKeyUpsertBulk
)
UpdateCaptureRequests
()
*
APIKeyUpsertBulk
{
return
u
.
Update
(
func
(
s
*
APIKeyUpsert
)
{
s
.
UpdateCaptureRequests
()
})
}
// Exec executes the query.
func
(
u
*
APIKeyUpsertBulk
)
Exec
(
ctx
context
.
Context
)
error
{
if
u
.
create
.
err
!=
nil
{
...
...
backend/ent/apikey_update.go
View file @
994da655
...
...
@@ -438,6 +438,20 @@ func (_u *APIKeyUpdate) ClearWindow7dStart() *APIKeyUpdate {
return
_u
}
// SetCaptureRequests sets the "capture_requests" field.
func
(
_u
*
APIKeyUpdate
)
SetCaptureRequests
(
v
bool
)
*
APIKeyUpdate
{
_u
.
mutation
.
SetCaptureRequests
(
v
)
return
_u
}
// SetNillableCaptureRequests sets the "capture_requests" field if the given value is not nil.
func
(
_u
*
APIKeyUpdate
)
SetNillableCaptureRequests
(
v
*
bool
)
*
APIKeyUpdate
{
if
v
!=
nil
{
_u
.
SetCaptureRequests
(
*
v
)
}
return
_u
}
// SetUser sets the "user" edge to the User entity.
func
(
_u
*
APIKeyUpdate
)
SetUser
(
v
*
User
)
*
APIKeyUpdate
{
return
_u
.
SetUserID
(
v
.
ID
)
...
...
@@ -696,6 +710,9 @@ func (_u *APIKeyUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if
_u
.
mutation
.
Window7dStartCleared
()
{
_spec
.
ClearField
(
apikey
.
FieldWindow7dStart
,
field
.
TypeTime
)
}
if
value
,
ok
:=
_u
.
mutation
.
CaptureRequests
();
ok
{
_spec
.
SetField
(
apikey
.
FieldCaptureRequests
,
field
.
TypeBool
,
value
)
}
if
_u
.
mutation
.
UserCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
...
...
@@ -1225,6 +1242,20 @@ func (_u *APIKeyUpdateOne) ClearWindow7dStart() *APIKeyUpdateOne {
return
_u
}
// SetCaptureRequests sets the "capture_requests" field.
func
(
_u
*
APIKeyUpdateOne
)
SetCaptureRequests
(
v
bool
)
*
APIKeyUpdateOne
{
_u
.
mutation
.
SetCaptureRequests
(
v
)
return
_u
}
// SetNillableCaptureRequests sets the "capture_requests" field if the given value is not nil.
func
(
_u
*
APIKeyUpdateOne
)
SetNillableCaptureRequests
(
v
*
bool
)
*
APIKeyUpdateOne
{
if
v
!=
nil
{
_u
.
SetCaptureRequests
(
*
v
)
}
return
_u
}
// SetUser sets the "user" edge to the User entity.
func
(
_u
*
APIKeyUpdateOne
)
SetUser
(
v
*
User
)
*
APIKeyUpdateOne
{
return
_u
.
SetUserID
(
v
.
ID
)
...
...
@@ -1513,6 +1544,9 @@ func (_u *APIKeyUpdateOne) sqlSave(ctx context.Context) (_node *APIKey, err erro
if
_u
.
mutation
.
Window7dStartCleared
()
{
_spec
.
ClearField
(
apikey
.
FieldWindow7dStart
,
field
.
TypeTime
)
}
if
value
,
ok
:=
_u
.
mutation
.
CaptureRequests
();
ok
{
_spec
.
SetField
(
apikey
.
FieldCaptureRequests
,
field
.
TypeBool
,
value
)
}
if
_u
.
mutation
.
UserCleared
()
{
edge
:=
&
sqlgraph
.
EdgeSpec
{
Rel
:
sqlgraph
.
M2O
,
...
...
backend/ent/client.go
View file @
994da655
...
...
@@ -30,6 +30,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/promocodeusage"
"github.com/Wei-Shaw/sub2api/ent/proxy"
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/requestcapturelog"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/subscriptionplan"
...
...
@@ -80,6 +81,8 @@ type Client struct {
Proxy
*
ProxyClient
// RedeemCode is the client for interacting with the RedeemCode builders.
RedeemCode
*
RedeemCodeClient
// RequestCaptureLog is the client for interacting with the RequestCaptureLog builders.
RequestCaptureLog
*
RequestCaptureLogClient
// SecuritySecret is the client for interacting with the SecuritySecret builders.
SecuritySecret
*
SecuritySecretClient
// Setting is the client for interacting with the Setting builders.
...
...
@@ -128,6 +131,7 @@ func (c *Client) init() {
c
.
PromoCodeUsage
=
NewPromoCodeUsageClient
(
c
.
config
)
c
.
Proxy
=
NewProxyClient
(
c
.
config
)
c
.
RedeemCode
=
NewRedeemCodeClient
(
c
.
config
)
c
.
RequestCaptureLog
=
NewRequestCaptureLogClient
(
c
.
config
)
c
.
SecuritySecret
=
NewSecuritySecretClient
(
c
.
config
)
c
.
Setting
=
NewSettingClient
(
c
.
config
)
c
.
SubscriptionPlan
=
NewSubscriptionPlanClient
(
c
.
config
)
...
...
@@ -246,6 +250,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
PromoCodeUsage
:
NewPromoCodeUsageClient
(
cfg
),
Proxy
:
NewProxyClient
(
cfg
),
RedeemCode
:
NewRedeemCodeClient
(
cfg
),
RequestCaptureLog
:
NewRequestCaptureLogClient
(
cfg
),
SecuritySecret
:
NewSecuritySecretClient
(
cfg
),
Setting
:
NewSettingClient
(
cfg
),
SubscriptionPlan
:
NewSubscriptionPlanClient
(
cfg
),
...
...
@@ -291,6 +296,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
PromoCodeUsage
:
NewPromoCodeUsageClient
(
cfg
),
Proxy
:
NewProxyClient
(
cfg
),
RedeemCode
:
NewRedeemCodeClient
(
cfg
),
RequestCaptureLog
:
NewRequestCaptureLogClient
(
cfg
),
SecuritySecret
:
NewSecuritySecretClient
(
cfg
),
Setting
:
NewSettingClient
(
cfg
),
SubscriptionPlan
:
NewSubscriptionPlanClient
(
cfg
),
...
...
@@ -334,9 +340,9 @@ func (c *Client) Use(hooks ...Hook) {
c
.
APIKey
,
c
.
Account
,
c
.
AccountGroup
,
c
.
Announcement
,
c
.
AnnouncementRead
,
c
.
ErrorPassthroughRule
,
c
.
Group
,
c
.
IdempotencyRecord
,
c
.
PaymentAuditLog
,
c
.
PaymentOrder
,
c
.
PaymentProviderInstance
,
c
.
PromoCode
,
c
.
PromoCodeUsage
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
SubscriptionPlan
,
c
.
TLSFingerprintProfile
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAllowedGroup
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
RequestCaptureLog
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
SubscriptionPlan
,
c
.
TLSFingerprintProfile
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAllowedGroup
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
UserSubscription
,
}
{
n
.
Use
(
hooks
...
)
...
...
@@ -350,9 +356,9 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
c
.
APIKey
,
c
.
Account
,
c
.
AccountGroup
,
c
.
Announcement
,
c
.
AnnouncementRead
,
c
.
ErrorPassthroughRule
,
c
.
Group
,
c
.
IdempotencyRecord
,
c
.
PaymentAuditLog
,
c
.
PaymentOrder
,
c
.
PaymentProviderInstance
,
c
.
PromoCode
,
c
.
PromoCodeUsage
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
SubscriptionPlan
,
c
.
TLSFingerprintProfile
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAllowedGroup
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
Proxy
,
c
.
RedeemCode
,
c
.
RequestCaptureLog
,
c
.
SecuritySecret
,
c
.
Setting
,
c
.
SubscriptionPlan
,
c
.
TLSFingerprintProfile
,
c
.
UsageCleanupTask
,
c
.
UsageLog
,
c
.
User
,
c
.
UserAllowedGroup
,
c
.
UserAttributeDefinition
,
c
.
UserAttributeValue
,
c
.
UserSubscription
,
}
{
n
.
Intercept
(
interceptors
...
)
...
...
@@ -392,6 +398,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
return
c
.
Proxy
.
mutate
(
ctx
,
m
)
case
*
RedeemCodeMutation
:
return
c
.
RedeemCode
.
mutate
(
ctx
,
m
)
case
*
RequestCaptureLogMutation
:
return
c
.
RequestCaptureLog
.
mutate
(
ctx
,
m
)
case
*
SecuritySecretMutation
:
return
c
.
SecuritySecret
.
mutate
(
ctx
,
m
)
case
*
SettingMutation
:
...
...
@@ -2805,6 +2813,139 @@ func (c *RedeemCodeClient) mutate(ctx context.Context, m *RedeemCodeMutation) (V
}
}
// RequestCaptureLogClient is a client for the RequestCaptureLog schema.
type
RequestCaptureLogClient
struct
{
config
}
// NewRequestCaptureLogClient returns a client for the RequestCaptureLog from the given config.
func
NewRequestCaptureLogClient
(
c
config
)
*
RequestCaptureLogClient
{
return
&
RequestCaptureLogClient
{
config
:
c
}
}
// Use adds a list of mutation hooks to the hooks stack.
// A call to `Use(f, g, h)` equals to `requestcapturelog.Hooks(f(g(h())))`.
func
(
c
*
RequestCaptureLogClient
)
Use
(
hooks
...
Hook
)
{
c
.
hooks
.
RequestCaptureLog
=
append
(
c
.
hooks
.
RequestCaptureLog
,
hooks
...
)
}
// Intercept adds a list of query interceptors to the interceptors stack.
// A call to `Intercept(f, g, h)` equals to `requestcapturelog.Intercept(f(g(h())))`.
func
(
c
*
RequestCaptureLogClient
)
Intercept
(
interceptors
...
Interceptor
)
{
c
.
inters
.
RequestCaptureLog
=
append
(
c
.
inters
.
RequestCaptureLog
,
interceptors
...
)
}
// Create returns a builder for creating a RequestCaptureLog entity.
func
(
c
*
RequestCaptureLogClient
)
Create
()
*
RequestCaptureLogCreate
{
mutation
:=
newRequestCaptureLogMutation
(
c
.
config
,
OpCreate
)
return
&
RequestCaptureLogCreate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// CreateBulk returns a builder for creating a bulk of RequestCaptureLog entities.
func
(
c
*
RequestCaptureLogClient
)
CreateBulk
(
builders
...*
RequestCaptureLogCreate
)
*
RequestCaptureLogCreateBulk
{
return
&
RequestCaptureLogCreateBulk
{
config
:
c
.
config
,
builders
:
builders
}
}
// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
// a builder and applies setFunc on it.
func
(
c
*
RequestCaptureLogClient
)
MapCreateBulk
(
slice
any
,
setFunc
func
(
*
RequestCaptureLogCreate
,
int
))
*
RequestCaptureLogCreateBulk
{
rv
:=
reflect
.
ValueOf
(
slice
)
if
rv
.
Kind
()
!=
reflect
.
Slice
{
return
&
RequestCaptureLogCreateBulk
{
err
:
fmt
.
Errorf
(
"calling to RequestCaptureLogClient.MapCreateBulk with wrong type %T, need slice"
,
slice
)}
}
builders
:=
make
([]
*
RequestCaptureLogCreate
,
rv
.
Len
())
for
i
:=
0
;
i
<
rv
.
Len
();
i
++
{
builders
[
i
]
=
c
.
Create
()
setFunc
(
builders
[
i
],
i
)
}
return
&
RequestCaptureLogCreateBulk
{
config
:
c
.
config
,
builders
:
builders
}
}
// Update returns an update builder for RequestCaptureLog.
func
(
c
*
RequestCaptureLogClient
)
Update
()
*
RequestCaptureLogUpdate
{
mutation
:=
newRequestCaptureLogMutation
(
c
.
config
,
OpUpdate
)
return
&
RequestCaptureLogUpdate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// UpdateOne returns an update builder for the given entity.
func
(
c
*
RequestCaptureLogClient
)
UpdateOne
(
_m
*
RequestCaptureLog
)
*
RequestCaptureLogUpdateOne
{
mutation
:=
newRequestCaptureLogMutation
(
c
.
config
,
OpUpdateOne
,
withRequestCaptureLog
(
_m
))
return
&
RequestCaptureLogUpdateOne
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// UpdateOneID returns an update builder for the given id.
func
(
c
*
RequestCaptureLogClient
)
UpdateOneID
(
id
int64
)
*
RequestCaptureLogUpdateOne
{
mutation
:=
newRequestCaptureLogMutation
(
c
.
config
,
OpUpdateOne
,
withRequestCaptureLogID
(
id
))
return
&
RequestCaptureLogUpdateOne
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// Delete returns a delete builder for RequestCaptureLog.
func
(
c
*
RequestCaptureLogClient
)
Delete
()
*
RequestCaptureLogDelete
{
mutation
:=
newRequestCaptureLogMutation
(
c
.
config
,
OpDelete
)
return
&
RequestCaptureLogDelete
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
mutation
}
}
// DeleteOne returns a builder for deleting the given entity.
func
(
c
*
RequestCaptureLogClient
)
DeleteOne
(
_m
*
RequestCaptureLog
)
*
RequestCaptureLogDeleteOne
{
return
c
.
DeleteOneID
(
_m
.
ID
)
}
// DeleteOneID returns a builder for deleting the given entity by its id.
func
(
c
*
RequestCaptureLogClient
)
DeleteOneID
(
id
int64
)
*
RequestCaptureLogDeleteOne
{
builder
:=
c
.
Delete
()
.
Where
(
requestcapturelog
.
ID
(
id
))
builder
.
mutation
.
id
=
&
id
builder
.
mutation
.
op
=
OpDeleteOne
return
&
RequestCaptureLogDeleteOne
{
builder
}
}
// Query returns a query builder for RequestCaptureLog.
func
(
c
*
RequestCaptureLogClient
)
Query
()
*
RequestCaptureLogQuery
{
return
&
RequestCaptureLogQuery
{
config
:
c
.
config
,
ctx
:
&
QueryContext
{
Type
:
TypeRequestCaptureLog
},
inters
:
c
.
Interceptors
(),
}
}
// Get returns a RequestCaptureLog entity by its id.
func
(
c
*
RequestCaptureLogClient
)
Get
(
ctx
context
.
Context
,
id
int64
)
(
*
RequestCaptureLog
,
error
)
{
return
c
.
Query
()
.
Where
(
requestcapturelog
.
ID
(
id
))
.
Only
(
ctx
)
}
// GetX is like Get, but panics if an error occurs.
func
(
c
*
RequestCaptureLogClient
)
GetX
(
ctx
context
.
Context
,
id
int64
)
*
RequestCaptureLog
{
obj
,
err
:=
c
.
Get
(
ctx
,
id
)
if
err
!=
nil
{
panic
(
err
)
}
return
obj
}
// Hooks returns the client hooks.
func
(
c
*
RequestCaptureLogClient
)
Hooks
()
[]
Hook
{
return
c
.
hooks
.
RequestCaptureLog
}
// Interceptors returns the client interceptors.
func
(
c
*
RequestCaptureLogClient
)
Interceptors
()
[]
Interceptor
{
return
c
.
inters
.
RequestCaptureLog
}
func
(
c
*
RequestCaptureLogClient
)
mutate
(
ctx
context
.
Context
,
m
*
RequestCaptureLogMutation
)
(
Value
,
error
)
{
switch
m
.
Op
()
{
case
OpCreate
:
return
(
&
RequestCaptureLogCreate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Save
(
ctx
)
case
OpUpdate
:
return
(
&
RequestCaptureLogUpdate
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Save
(
ctx
)
case
OpUpdateOne
:
return
(
&
RequestCaptureLogUpdateOne
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Save
(
ctx
)
case
OpDelete
,
OpDeleteOne
:
return
(
&
RequestCaptureLogDelete
{
config
:
c
.
config
,
hooks
:
c
.
Hooks
(),
mutation
:
m
})
.
Exec
(
ctx
)
default
:
return
nil
,
fmt
.
Errorf
(
"ent: unknown RequestCaptureLog mutation op: %q"
,
m
.
Op
())
}
}
// SecuritySecretClient is a client for the SecuritySecret schema.
type
SecuritySecretClient
struct
{
config
...
...
@@ -4631,17 +4772,17 @@ type (
APIKey
,
Account
,
AccountGroup
,
Announcement
,
AnnouncementRead
,
ErrorPassthroughRule
,
Group
,
IdempotencyRecord
,
PaymentAuditLog
,
PaymentOrder
,
PaymentProviderInstance
,
PromoCode
,
PromoCodeUsage
,
Proxy
,
RedeemCode
,
SecuritySecret
,
Setting
,
SubscriptionPlan
,
TLSFingerprintProfile
,
UsageCleanupTask
,
UsageLog
,
User
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserAttributeValue
,
UserSubscription
[]
ent
.
Hook
RequestCaptureLog
,
SecuritySecret
,
Setting
,
SubscriptionPlan
,
TLSFingerprintProfile
,
UsageCleanupTask
,
UsageLog
,
User
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserAttributeValue
,
UserSubscription
[]
ent
.
Hook
}
inters
struct
{
APIKey
,
Account
,
AccountGroup
,
Announcement
,
AnnouncementRead
,
ErrorPassthroughRule
,
Group
,
IdempotencyRecord
,
PaymentAuditLog
,
PaymentOrder
,
PaymentProviderInstance
,
PromoCode
,
PromoCodeUsage
,
Proxy
,
RedeemCode
,
SecuritySecret
,
Setting
,
SubscriptionPlan
,
TLSFingerprintProfile
,
UsageCleanupTask
,
UsageLog
,
User
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserAttributeValue
,
UserSubscription
[]
ent
.
Interceptor
RequestCaptureLog
,
SecuritySecret
,
Setting
,
SubscriptionPlan
,
TLSFingerprintProfile
,
UsageCleanupTask
,
UsageLog
,
User
,
UserAllowedGroup
,
UserAttributeDefinition
,
UserAttributeValue
,
UserSubscription
[]
ent
.
Interceptor
}
)
...
...
backend/ent/ent.go
View file @
994da655
...
...
@@ -27,6 +27,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/promocodeusage"
"github.com/Wei-Shaw/sub2api/ent/proxy"
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/requestcapturelog"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/subscriptionplan"
...
...
@@ -113,6 +114,7 @@ func checkColumn(t, c string) error {
promocodeusage
.
Table
:
promocodeusage
.
ValidColumn
,
proxy
.
Table
:
proxy
.
ValidColumn
,
redeemcode
.
Table
:
redeemcode
.
ValidColumn
,
requestcapturelog
.
Table
:
requestcapturelog
.
ValidColumn
,
securitysecret
.
Table
:
securitysecret
.
ValidColumn
,
setting
.
Table
:
setting
.
ValidColumn
,
subscriptionplan
.
Table
:
subscriptionplan
.
ValidColumn
,
...
...
backend/ent/hook/hook.go
View file @
994da655
...
...
@@ -189,6 +189,18 @@ func (f RedeemCodeFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value,
return
nil
,
fmt
.
Errorf
(
"unexpected mutation type %T. expect *ent.RedeemCodeMutation"
,
m
)
}
// The RequestCaptureLogFunc type is an adapter to allow the use of ordinary
// function as RequestCaptureLog mutator.
type
RequestCaptureLogFunc
func
(
context
.
Context
,
*
ent
.
RequestCaptureLogMutation
)
(
ent
.
Value
,
error
)
// Mutate calls f(ctx, m).
func
(
f
RequestCaptureLogFunc
)
Mutate
(
ctx
context
.
Context
,
m
ent
.
Mutation
)
(
ent
.
Value
,
error
)
{
if
mv
,
ok
:=
m
.
(
*
ent
.
RequestCaptureLogMutation
);
ok
{
return
f
(
ctx
,
mv
)
}
return
nil
,
fmt
.
Errorf
(
"unexpected mutation type %T. expect *ent.RequestCaptureLogMutation"
,
m
)
}
// The SecuritySecretFunc type is an adapter to allow the use of ordinary
// function as SecuritySecret mutator.
type
SecuritySecretFunc
func
(
context
.
Context
,
*
ent
.
SecuritySecretMutation
)
(
ent
.
Value
,
error
)
...
...
backend/ent/intercept/intercept.go
View file @
994da655
...
...
@@ -24,6 +24,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/promocodeusage"
"github.com/Wei-Shaw/sub2api/ent/proxy"
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/requestcapturelog"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/subscriptionplan"
...
...
@@ -498,6 +499,33 @@ func (f TraverseRedeemCode) Traverse(ctx context.Context, q ent.Query) error {
return
fmt
.
Errorf
(
"unexpected query type %T. expect *ent.RedeemCodeQuery"
,
q
)
}
// The RequestCaptureLogFunc type is an adapter to allow the use of ordinary function as a Querier.
type
RequestCaptureLogFunc
func
(
context
.
Context
,
*
ent
.
RequestCaptureLogQuery
)
(
ent
.
Value
,
error
)
// Query calls f(ctx, q).
func
(
f
RequestCaptureLogFunc
)
Query
(
ctx
context
.
Context
,
q
ent
.
Query
)
(
ent
.
Value
,
error
)
{
if
q
,
ok
:=
q
.
(
*
ent
.
RequestCaptureLogQuery
);
ok
{
return
f
(
ctx
,
q
)
}
return
nil
,
fmt
.
Errorf
(
"unexpected query type %T. expect *ent.RequestCaptureLogQuery"
,
q
)
}
// The TraverseRequestCaptureLog type is an adapter to allow the use of ordinary function as Traverser.
type
TraverseRequestCaptureLog
func
(
context
.
Context
,
*
ent
.
RequestCaptureLogQuery
)
error
// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
func
(
f
TraverseRequestCaptureLog
)
Intercept
(
next
ent
.
Querier
)
ent
.
Querier
{
return
next
}
// Traverse calls f(ctx, q).
func
(
f
TraverseRequestCaptureLog
)
Traverse
(
ctx
context
.
Context
,
q
ent
.
Query
)
error
{
if
q
,
ok
:=
q
.
(
*
ent
.
RequestCaptureLogQuery
);
ok
{
return
f
(
ctx
,
q
)
}
return
fmt
.
Errorf
(
"unexpected query type %T. expect *ent.RequestCaptureLogQuery"
,
q
)
}
// The SecuritySecretFunc type is an adapter to allow the use of ordinary function as a Querier.
type
SecuritySecretFunc
func
(
context
.
Context
,
*
ent
.
SecuritySecretQuery
)
(
ent
.
Value
,
error
)
...
...
@@ -828,6 +856,8 @@ func NewQuery(q ent.Query) (Query, error) {
return
&
query
[
*
ent
.
ProxyQuery
,
predicate
.
Proxy
,
proxy
.
OrderOption
]{
typ
:
ent
.
TypeProxy
,
tq
:
q
},
nil
case
*
ent
.
RedeemCodeQuery
:
return
&
query
[
*
ent
.
RedeemCodeQuery
,
predicate
.
RedeemCode
,
redeemcode
.
OrderOption
]{
typ
:
ent
.
TypeRedeemCode
,
tq
:
q
},
nil
case
*
ent
.
RequestCaptureLogQuery
:
return
&
query
[
*
ent
.
RequestCaptureLogQuery
,
predicate
.
RequestCaptureLog
,
requestcapturelog
.
OrderOption
]{
typ
:
ent
.
TypeRequestCaptureLog
,
tq
:
q
},
nil
case
*
ent
.
SecuritySecretQuery
:
return
&
query
[
*
ent
.
SecuritySecretQuery
,
predicate
.
SecuritySecret
,
securitysecret
.
OrderOption
]{
typ
:
ent
.
TypeSecuritySecret
,
tq
:
q
},
nil
case
*
ent
.
SettingQuery
:
...
...
backend/ent/migrate/schema.go
View file @
994da655
...
...
@@ -33,6 +33,7 @@ var (
{
Name
:
"window_5h_start"
,
Type
:
field
.
TypeTime
,
Nullable
:
true
},
{
Name
:
"window_1d_start"
,
Type
:
field
.
TypeTime
,
Nullable
:
true
},
{
Name
:
"window_7d_start"
,
Type
:
field
.
TypeTime
,
Nullable
:
true
},
{
Name
:
"capture_requests"
,
Type
:
field
.
TypeBool
,
Default
:
false
},
{
Name
:
"group_id"
,
Type
:
field
.
TypeInt64
,
Nullable
:
true
},
{
Name
:
"user_id"
,
Type
:
field
.
TypeInt64
},
}
...
...
@@ -44,13 +45,13 @@ var (
ForeignKeys
:
[]
*
schema
.
ForeignKey
{
{
Symbol
:
"api_keys_groups_api_keys"
,
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
2
]},
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
3
]},
RefColumns
:
[]
*
schema
.
Column
{
GroupsColumns
[
0
]},
OnDelete
:
schema
.
SetNull
,
},
{
Symbol
:
"api_keys_users_api_keys"
,
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
3
]},
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
4
]},
RefColumns
:
[]
*
schema
.
Column
{
UsersColumns
[
0
]},
OnDelete
:
schema
.
NoAction
,
},
...
...
@@ -59,12 +60,12 @@ var (
{
Name
:
"apikey_user_id"
,
Unique
:
false
,
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
3
]},
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
4
]},
},
{
Name
:
"apikey_group_id"
,
Unique
:
false
,
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
2
]},
Columns
:
[]
*
schema
.
Column
{
APIKeysColumns
[
2
3
]},
},
{
Name
:
"apikey_status"
,
...
...
@@ -797,6 +798,38 @@ var (
},
},
}
// RequestCaptureLogsColumns holds the columns for the "request_capture_logs" table.
RequestCaptureLogsColumns
=
[]
*
schema
.
Column
{
{
Name
:
"id"
,
Type
:
field
.
TypeInt64
,
Increment
:
true
},
{
Name
:
"api_key_id"
,
Type
:
field
.
TypeInt64
},
{
Name
:
"user_id"
,
Type
:
field
.
TypeInt64
},
{
Name
:
"request_id"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
64
},
{
Name
:
"path"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
100
},
{
Name
:
"method"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
10
},
{
Name
:
"ip_address"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
45
},
{
Name
:
"request_body"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
2147483647
},
{
Name
:
"response_body"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
2147483647
},
{
Name
:
"nfs_file_path"
,
Type
:
field
.
TypeString
,
Nullable
:
true
,
Size
:
500
},
{
Name
:
"created_at"
,
Type
:
field
.
TypeTime
,
SchemaType
:
map
[
string
]
string
{
"postgres"
:
"timestamptz"
}},
}
// RequestCaptureLogsTable holds the schema information for the "request_capture_logs" table.
RequestCaptureLogsTable
=
&
schema
.
Table
{
Name
:
"request_capture_logs"
,
Columns
:
RequestCaptureLogsColumns
,
PrimaryKey
:
[]
*
schema
.
Column
{
RequestCaptureLogsColumns
[
0
]},
Indexes
:
[]
*
schema
.
Index
{
{
Name
:
"requestcapturelog_api_key_id_created_at"
,
Unique
:
false
,
Columns
:
[]
*
schema
.
Column
{
RequestCaptureLogsColumns
[
1
],
RequestCaptureLogsColumns
[
10
]},
},
{
Name
:
"requestcapturelog_user_id"
,
Unique
:
false
,
Columns
:
[]
*
schema
.
Column
{
RequestCaptureLogsColumns
[
2
]},
},
},
}
// SecuritySecretsColumns holds the columns for the "security_secrets" table.
SecuritySecretsColumns
=
[]
*
schema
.
Column
{
{
Name
:
"id"
,
Type
:
field
.
TypeInt64
,
Increment
:
true
},
...
...
@@ -1328,6 +1361,7 @@ var (
PromoCodeUsagesTable
,
ProxiesTable
,
RedeemCodesTable
,
RequestCaptureLogsTable
,
SecuritySecretsTable
,
SettingsTable
,
SubscriptionPlansTable
,
...
...
@@ -1400,6 +1434,9 @@ func init() {
RedeemCodesTable
.
Annotation
=
&
entsql
.
Annotation
{
Table
:
"redeem_codes"
,
}
RequestCaptureLogsTable
.
Annotation
=
&
entsql
.
Annotation
{
Table
:
"request_capture_logs"
,
}
SecuritySecretsTable
.
Annotation
=
&
entsql
.
Annotation
{
Table
:
"security_secrets"
,
}
...
...
backend/ent/mutation.go
View file @
994da655
...
...
@@ -28,6 +28,7 @@ import (
"github.com/Wei-Shaw/sub2api/ent/promocodeusage"
"github.com/Wei-Shaw/sub2api/ent/proxy"
"github.com/Wei-Shaw/sub2api/ent/redeemcode"
"github.com/Wei-Shaw/sub2api/ent/requestcapturelog"
"github.com/Wei-Shaw/sub2api/ent/securitysecret"
"github.com/Wei-Shaw/sub2api/ent/setting"
"github.com/Wei-Shaw/sub2api/ent/subscriptionplan"
...
...
@@ -66,6 +67,7 @@ const (
TypePromoCodeUsage = "PromoCodeUsage"
TypeProxy = "Proxy"
TypeRedeemCode = "RedeemCode"
TypeRequestCaptureLog = "RequestCaptureLog"
TypeSecuritySecret = "SecuritySecret"
TypeSetting = "Setting"
TypeSubscriptionPlan = "SubscriptionPlan"
...
...
@@ -116,6 +118,7 @@ type APIKeyMutation struct {
window_5h_start *time.Time
window_1d_start *time.Time
window_7d_start *time.Time
capture_requests *bool
clearedFields map[string]struct{}
user *int64
cleareduser bool
...
...
@@ -1364,6 +1367,42 @@ func (m *APIKeyMutation) ResetWindow7dStart() {
delete(m.clearedFields, apikey.FieldWindow7dStart)
}
// SetCaptureRequests sets the "capture_requests" field.
func (m *APIKeyMutation) SetCaptureRequests(b bool) {
m.capture_requests = &b
}
// CaptureRequests returns the value of the "capture_requests" field in the mutation.
func (m *APIKeyMutation) CaptureRequests() (r bool, exists bool) {
v := m.capture_requests
if v == nil {
return
}
return *v, true
}
// OldCaptureRequests returns the old "capture_requests" field's value of the APIKey entity.
// If the APIKey object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *APIKeyMutation) OldCaptureRequests(ctx context.Context) (v bool, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCaptureRequests is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCaptureRequests requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCaptureRequests: %w", err)
}
return oldValue.CaptureRequests, nil
}
// ResetCaptureRequests resets all changes to the "capture_requests" field.
func (m *APIKeyMutation) ResetCaptureRequests() {
m.capture_requests = nil
}
// ClearUser clears the "user" edge to the User entity.
func (m *APIKeyMutation) ClearUser() {
m.cleareduser = true
...
...
@@ -1506,7 +1545,7 @@ func (m *APIKeyMutation) Type() string {
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *APIKeyMutation) Fields() []string {
fields := make([]string, 0, 2
3
)
fields := make([]string, 0, 2
4
)
if m.created_at != nil {
fields = append(fields, apikey.FieldCreatedAt)
}
...
...
@@ -1576,6 +1615,9 @@ func (m *APIKeyMutation) Fields() []string {
if m.window_7d_start != nil {
fields = append(fields, apikey.FieldWindow7dStart)
}
if m.capture_requests != nil {
fields = append(fields, apikey.FieldCaptureRequests)
}
return fields
}
...
...
@@ -1630,6 +1672,8 @@ func (m *APIKeyMutation) Field(name string) (ent.Value, bool) {
return m.Window1dStart()
case apikey.FieldWindow7dStart:
return m.Window7dStart()
case apikey.FieldCaptureRequests:
return m.CaptureRequests()
}
return nil, false
}
...
...
@@ -1685,6 +1729,8 @@ func (m *APIKeyMutation) OldField(ctx context.Context, name string) (ent.Value,
return m.OldWindow1dStart(ctx)
case apikey.FieldWindow7dStart:
return m.OldWindow7dStart(ctx)
case apikey.FieldCaptureRequests:
return m.OldCaptureRequests(ctx)
}
return nil, fmt.Errorf("unknown APIKey field %s", name)
}
...
...
@@ -1855,6 +1901,13 @@ func (m *APIKeyMutation) SetField(name string, value ent.Value) error {
}
m.SetWindow7dStart(v)
return nil
case apikey.FieldCaptureRequests:
v, ok := value.(bool)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCaptureRequests(v)
return nil
}
return fmt.Errorf("unknown APIKey field %s", name)
}
...
...
@@ -2129,6 +2182,9 @@ func (m *APIKeyMutation) ResetField(name string) error {
case apikey.FieldWindow7dStart:
m.ResetWindow7dStart()
return nil
case apikey.FieldCaptureRequests:
m.ResetCaptureRequests()
return nil
}
return fmt.Errorf("unknown APIKey field %s", name)
}
...
...
@@ -20287,6 +20343,1023 @@ func (m *RedeemCodeMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown RedeemCode edge %s", name)
}
// RequestCaptureLogMutation represents an operation that mutates the RequestCaptureLog nodes in the graph.
type RequestCaptureLogMutation struct {
config
op Op
typ string
id *int64
api_key_id *int64
addapi_key_id *int64
user_id *int64
adduser_id *int64
request_id *string
_path *string
method *string
ip_address *string
request_body *string
response_body *string
nfs_file_path *string
created_at *time.Time
clearedFields map[string]struct{}
done bool
oldValue func(context.Context) (*RequestCaptureLog, error)
predicates []predicate.RequestCaptureLog
}
var _ ent.Mutation = (*RequestCaptureLogMutation)(nil)
// requestcapturelogOption allows management of the mutation configuration using functional options.
type requestcapturelogOption func(*RequestCaptureLogMutation)
// newRequestCaptureLogMutation creates new mutation for the RequestCaptureLog entity.
func newRequestCaptureLogMutation(c config, op Op, opts ...requestcapturelogOption) *RequestCaptureLogMutation {
m := &RequestCaptureLogMutation{
config: c,
op: op,
typ: TypeRequestCaptureLog,
clearedFields: make(map[string]struct{}),
}
for _, opt := range opts {
opt(m)
}
return m
}
// withRequestCaptureLogID sets the ID field of the mutation.
func withRequestCaptureLogID(id int64) requestcapturelogOption {
return func(m *RequestCaptureLogMutation) {
var (
err error
once sync.Once
value *RequestCaptureLog
)
m.oldValue = func(ctx context.Context) (*RequestCaptureLog, error) {
once.Do(func() {
if m.done {
err = errors.New("querying old values post mutation is not allowed")
} else {
value, err = m.Client().RequestCaptureLog.Get(ctx, id)
}
})
return value, err
}
m.id = &id
}
}
// withRequestCaptureLog sets the old RequestCaptureLog of the mutation.
func withRequestCaptureLog(node *RequestCaptureLog) requestcapturelogOption {
return func(m *RequestCaptureLogMutation) {
m.oldValue = func(context.Context) (*RequestCaptureLog, error) {
return node, nil
}
m.id = &node.ID
}
}
// Client returns a new `ent.Client` from the mutation. If the mutation was
// executed in a transaction (ent.Tx), a transactional client is returned.
func (m RequestCaptureLogMutation) Client() *Client {
client := &Client{config: m.config}
client.init()
return client
}
// Tx returns an `ent.Tx` for mutations that were executed in transactions;
// it returns an error otherwise.
func (m RequestCaptureLogMutation) Tx() (*Tx, error) {
if _, ok := m.driver.(*txDriver); !ok {
return nil, errors.New("ent: mutation is not running in a transaction")
}
tx := &Tx{config: m.config}
tx.init()
return tx, nil
}
// ID returns the ID value in the mutation. Note that the ID is only available
// if it was provided to the builder or after it was returned from the database.
func (m *RequestCaptureLogMutation) ID() (id int64, exists bool) {
if m.id == nil {
return
}
return *m.id, true
}
// IDs queries the database and returns the entity ids that match the mutation's predicate.
// That means, if the mutation is applied within a transaction with an isolation level such
// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
// or updated by the mutation.
func (m *RequestCaptureLogMutation) IDs(ctx context.Context) ([]int64, error) {
switch {
case m.op.Is(OpUpdateOne | OpDeleteOne):
id, exists := m.ID()
if exists {
return []int64{id}, nil
}
fallthrough
case m.op.Is(OpUpdate | OpDelete):
return m.Client().RequestCaptureLog.Query().Where(m.predicates...).IDs(ctx)
default:
return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
}
}
// SetAPIKeyID sets the "api_key_id" field.
func (m *RequestCaptureLogMutation) SetAPIKeyID(i int64) {
m.api_key_id = &i
m.addapi_key_id = nil
}
// APIKeyID returns the value of the "api_key_id" field in the mutation.
func (m *RequestCaptureLogMutation) APIKeyID() (r int64, exists bool) {
v := m.api_key_id
if v == nil {
return
}
return *v, true
}
// OldAPIKeyID returns the old "api_key_id" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldAPIKeyID(ctx context.Context) (v int64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldAPIKeyID is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldAPIKeyID requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldAPIKeyID: %w", err)
}
return oldValue.APIKeyID, nil
}
// AddAPIKeyID adds i to the "api_key_id" field.
func (m *RequestCaptureLogMutation) AddAPIKeyID(i int64) {
if m.addapi_key_id != nil {
*m.addapi_key_id += i
} else {
m.addapi_key_id = &i
}
}
// AddedAPIKeyID returns the value that was added to the "api_key_id" field in this mutation.
func (m *RequestCaptureLogMutation) AddedAPIKeyID() (r int64, exists bool) {
v := m.addapi_key_id
if v == nil {
return
}
return *v, true
}
// ResetAPIKeyID resets all changes to the "api_key_id" field.
func (m *RequestCaptureLogMutation) ResetAPIKeyID() {
m.api_key_id = nil
m.addapi_key_id = nil
}
// SetUserID sets the "user_id" field.
func (m *RequestCaptureLogMutation) SetUserID(i int64) {
m.user_id = &i
m.adduser_id = nil
}
// UserID returns the value of the "user_id" field in the mutation.
func (m *RequestCaptureLogMutation) UserID() (r int64, exists bool) {
v := m.user_id
if v == nil {
return
}
return *v, true
}
// OldUserID returns the old "user_id" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldUserID(ctx context.Context) (v int64, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldUserID is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldUserID requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldUserID: %w", err)
}
return oldValue.UserID, nil
}
// AddUserID adds i to the "user_id" field.
func (m *RequestCaptureLogMutation) AddUserID(i int64) {
if m.adduser_id != nil {
*m.adduser_id += i
} else {
m.adduser_id = &i
}
}
// AddedUserID returns the value that was added to the "user_id" field in this mutation.
func (m *RequestCaptureLogMutation) AddedUserID() (r int64, exists bool) {
v := m.adduser_id
if v == nil {
return
}
return *v, true
}
// ResetUserID resets all changes to the "user_id" field.
func (m *RequestCaptureLogMutation) ResetUserID() {
m.user_id = nil
m.adduser_id = nil
}
// SetRequestID sets the "request_id" field.
func (m *RequestCaptureLogMutation) SetRequestID(s string) {
m.request_id = &s
}
// RequestID returns the value of the "request_id" field in the mutation.
func (m *RequestCaptureLogMutation) RequestID() (r string, exists bool) {
v := m.request_id
if v == nil {
return
}
return *v, true
}
// OldRequestID returns the old "request_id" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldRequestID(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRequestID is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRequestID requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRequestID: %w", err)
}
return oldValue.RequestID, nil
}
// ClearRequestID clears the value of the "request_id" field.
func (m *RequestCaptureLogMutation) ClearRequestID() {
m.request_id = nil
m.clearedFields[requestcapturelog.FieldRequestID] = struct{}{}
}
// RequestIDCleared returns if the "request_id" field was cleared in this mutation.
func (m *RequestCaptureLogMutation) RequestIDCleared() bool {
_, ok := m.clearedFields[requestcapturelog.FieldRequestID]
return ok
}
// ResetRequestID resets all changes to the "request_id" field.
func (m *RequestCaptureLogMutation) ResetRequestID() {
m.request_id = nil
delete(m.clearedFields, requestcapturelog.FieldRequestID)
}
// SetPath sets the "path" field.
func (m *RequestCaptureLogMutation) SetPath(s string) {
m._path = &s
}
// Path returns the value of the "path" field in the mutation.
func (m *RequestCaptureLogMutation) Path() (r string, exists bool) {
v := m._path
if v == nil {
return
}
return *v, true
}
// OldPath returns the old "path" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldPath(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldPath is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldPath requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldPath: %w", err)
}
return oldValue.Path, nil
}
// ClearPath clears the value of the "path" field.
func (m *RequestCaptureLogMutation) ClearPath() {
m._path = nil
m.clearedFields[requestcapturelog.FieldPath] = struct{}{}
}
// PathCleared returns if the "path" field was cleared in this mutation.
func (m *RequestCaptureLogMutation) PathCleared() bool {
_, ok := m.clearedFields[requestcapturelog.FieldPath]
return ok
}
// ResetPath resets all changes to the "path" field.
func (m *RequestCaptureLogMutation) ResetPath() {
m._path = nil
delete(m.clearedFields, requestcapturelog.FieldPath)
}
// SetMethod sets the "method" field.
func (m *RequestCaptureLogMutation) SetMethod(s string) {
m.method = &s
}
// Method returns the value of the "method" field in the mutation.
func (m *RequestCaptureLogMutation) Method() (r string, exists bool) {
v := m.method
if v == nil {
return
}
return *v, true
}
// OldMethod returns the old "method" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldMethod(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldMethod is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldMethod requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldMethod: %w", err)
}
return oldValue.Method, nil
}
// ClearMethod clears the value of the "method" field.
func (m *RequestCaptureLogMutation) ClearMethod() {
m.method = nil
m.clearedFields[requestcapturelog.FieldMethod] = struct{}{}
}
// MethodCleared returns if the "method" field was cleared in this mutation.
func (m *RequestCaptureLogMutation) MethodCleared() bool {
_, ok := m.clearedFields[requestcapturelog.FieldMethod]
return ok
}
// ResetMethod resets all changes to the "method" field.
func (m *RequestCaptureLogMutation) ResetMethod() {
m.method = nil
delete(m.clearedFields, requestcapturelog.FieldMethod)
}
// SetIPAddress sets the "ip_address" field.
func (m *RequestCaptureLogMutation) SetIPAddress(s string) {
m.ip_address = &s
}
// IPAddress returns the value of the "ip_address" field in the mutation.
func (m *RequestCaptureLogMutation) IPAddress() (r string, exists bool) {
v := m.ip_address
if v == nil {
return
}
return *v, true
}
// OldIPAddress returns the old "ip_address" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldIPAddress(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldIPAddress is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldIPAddress requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldIPAddress: %w", err)
}
return oldValue.IPAddress, nil
}
// ClearIPAddress clears the value of the "ip_address" field.
func (m *RequestCaptureLogMutation) ClearIPAddress() {
m.ip_address = nil
m.clearedFields[requestcapturelog.FieldIPAddress] = struct{}{}
}
// IPAddressCleared returns if the "ip_address" field was cleared in this mutation.
func (m *RequestCaptureLogMutation) IPAddressCleared() bool {
_, ok := m.clearedFields[requestcapturelog.FieldIPAddress]
return ok
}
// ResetIPAddress resets all changes to the "ip_address" field.
func (m *RequestCaptureLogMutation) ResetIPAddress() {
m.ip_address = nil
delete(m.clearedFields, requestcapturelog.FieldIPAddress)
}
// SetRequestBody sets the "request_body" field.
func (m *RequestCaptureLogMutation) SetRequestBody(s string) {
m.request_body = &s
}
// RequestBody returns the value of the "request_body" field in the mutation.
func (m *RequestCaptureLogMutation) RequestBody() (r string, exists bool) {
v := m.request_body
if v == nil {
return
}
return *v, true
}
// OldRequestBody returns the old "request_body" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldRequestBody(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldRequestBody is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldRequestBody requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldRequestBody: %w", err)
}
return oldValue.RequestBody, nil
}
// ClearRequestBody clears the value of the "request_body" field.
func (m *RequestCaptureLogMutation) ClearRequestBody() {
m.request_body = nil
m.clearedFields[requestcapturelog.FieldRequestBody] = struct{}{}
}
// RequestBodyCleared returns if the "request_body" field was cleared in this mutation.
func (m *RequestCaptureLogMutation) RequestBodyCleared() bool {
_, ok := m.clearedFields[requestcapturelog.FieldRequestBody]
return ok
}
// ResetRequestBody resets all changes to the "request_body" field.
func (m *RequestCaptureLogMutation) ResetRequestBody() {
m.request_body = nil
delete(m.clearedFields, requestcapturelog.FieldRequestBody)
}
// SetResponseBody sets the "response_body" field.
func (m *RequestCaptureLogMutation) SetResponseBody(s string) {
m.response_body = &s
}
// ResponseBody returns the value of the "response_body" field in the mutation.
func (m *RequestCaptureLogMutation) ResponseBody() (r string, exists bool) {
v := m.response_body
if v == nil {
return
}
return *v, true
}
// OldResponseBody returns the old "response_body" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldResponseBody(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldResponseBody is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldResponseBody requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldResponseBody: %w", err)
}
return oldValue.ResponseBody, nil
}
// ClearResponseBody clears the value of the "response_body" field.
func (m *RequestCaptureLogMutation) ClearResponseBody() {
m.response_body = nil
m.clearedFields[requestcapturelog.FieldResponseBody] = struct{}{}
}
// ResponseBodyCleared returns if the "response_body" field was cleared in this mutation.
func (m *RequestCaptureLogMutation) ResponseBodyCleared() bool {
_, ok := m.clearedFields[requestcapturelog.FieldResponseBody]
return ok
}
// ResetResponseBody resets all changes to the "response_body" field.
func (m *RequestCaptureLogMutation) ResetResponseBody() {
m.response_body = nil
delete(m.clearedFields, requestcapturelog.FieldResponseBody)
}
// SetNfsFilePath sets the "nfs_file_path" field.
func (m *RequestCaptureLogMutation) SetNfsFilePath(s string) {
m.nfs_file_path = &s
}
// NfsFilePath returns the value of the "nfs_file_path" field in the mutation.
func (m *RequestCaptureLogMutation) NfsFilePath() (r string, exists bool) {
v := m.nfs_file_path
if v == nil {
return
}
return *v, true
}
// OldNfsFilePath returns the old "nfs_file_path" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldNfsFilePath(ctx context.Context) (v *string, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldNfsFilePath is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldNfsFilePath requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldNfsFilePath: %w", err)
}
return oldValue.NfsFilePath, nil
}
// ClearNfsFilePath clears the value of the "nfs_file_path" field.
func (m *RequestCaptureLogMutation) ClearNfsFilePath() {
m.nfs_file_path = nil
m.clearedFields[requestcapturelog.FieldNfsFilePath] = struct{}{}
}
// NfsFilePathCleared returns if the "nfs_file_path" field was cleared in this mutation.
func (m *RequestCaptureLogMutation) NfsFilePathCleared() bool {
_, ok := m.clearedFields[requestcapturelog.FieldNfsFilePath]
return ok
}
// ResetNfsFilePath resets all changes to the "nfs_file_path" field.
func (m *RequestCaptureLogMutation) ResetNfsFilePath() {
m.nfs_file_path = nil
delete(m.clearedFields, requestcapturelog.FieldNfsFilePath)
}
// SetCreatedAt sets the "created_at" field.
func (m *RequestCaptureLogMutation) SetCreatedAt(t time.Time) {
m.created_at = &t
}
// CreatedAt returns the value of the "created_at" field in the mutation.
func (m *RequestCaptureLogMutation) CreatedAt() (r time.Time, exists bool) {
v := m.created_at
if v == nil {
return
}
return *v, true
}
// OldCreatedAt returns the old "created_at" field's value of the RequestCaptureLog entity.
// If the RequestCaptureLog object wasn't provided to the builder, the object is fetched from the database.
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
func (m *RequestCaptureLogMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
if !m.op.Is(OpUpdateOne) {
return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
}
if m.id == nil || m.oldValue == nil {
return v, errors.New("OldCreatedAt requires an ID field in the mutation")
}
oldValue, err := m.oldValue(ctx)
if err != nil {
return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
}
return oldValue.CreatedAt, nil
}
// ResetCreatedAt resets all changes to the "created_at" field.
func (m *RequestCaptureLogMutation) ResetCreatedAt() {
m.created_at = nil
}
// Where appends a list predicates to the RequestCaptureLogMutation builder.
func (m *RequestCaptureLogMutation) Where(ps ...predicate.RequestCaptureLog) {
m.predicates = append(m.predicates, ps...)
}
// WhereP appends storage-level predicates to the RequestCaptureLogMutation builder. Using this method,
// users can use type-assertion to append predicates that do not depend on any generated package.
func (m *RequestCaptureLogMutation) WhereP(ps ...func(*sql.Selector)) {
p := make([]predicate.RequestCaptureLog, len(ps))
for i := range ps {
p[i] = ps[i]
}
m.Where(p...)
}
// Op returns the operation name.
func (m *RequestCaptureLogMutation) Op() Op {
return m.op
}
// SetOp allows setting the mutation operation.
func (m *RequestCaptureLogMutation) SetOp(op Op) {
m.op = op
}
// Type returns the node type of this mutation (RequestCaptureLog).
func (m *RequestCaptureLogMutation) Type() string {
return m.typ
}
// Fields returns all fields that were changed during this mutation. Note that in
// order to get all numeric fields that were incremented/decremented, call
// AddedFields().
func (m *RequestCaptureLogMutation) Fields() []string {
fields := make([]string, 0, 10)
if m.api_key_id != nil {
fields = append(fields, requestcapturelog.FieldAPIKeyID)
}
if m.user_id != nil {
fields = append(fields, requestcapturelog.FieldUserID)
}
if m.request_id != nil {
fields = append(fields, requestcapturelog.FieldRequestID)
}
if m._path != nil {
fields = append(fields, requestcapturelog.FieldPath)
}
if m.method != nil {
fields = append(fields, requestcapturelog.FieldMethod)
}
if m.ip_address != nil {
fields = append(fields, requestcapturelog.FieldIPAddress)
}
if m.request_body != nil {
fields = append(fields, requestcapturelog.FieldRequestBody)
}
if m.response_body != nil {
fields = append(fields, requestcapturelog.FieldResponseBody)
}
if m.nfs_file_path != nil {
fields = append(fields, requestcapturelog.FieldNfsFilePath)
}
if m.created_at != nil {
fields = append(fields, requestcapturelog.FieldCreatedAt)
}
return fields
}
// Field returns the value of a field with the given name. The second boolean
// return value indicates that this field was not set, or was not defined in the
// schema.
func (m *RequestCaptureLogMutation) Field(name string) (ent.Value, bool) {
switch name {
case requestcapturelog.FieldAPIKeyID:
return m.APIKeyID()
case requestcapturelog.FieldUserID:
return m.UserID()
case requestcapturelog.FieldRequestID:
return m.RequestID()
case requestcapturelog.FieldPath:
return m.Path()
case requestcapturelog.FieldMethod:
return m.Method()
case requestcapturelog.FieldIPAddress:
return m.IPAddress()
case requestcapturelog.FieldRequestBody:
return m.RequestBody()
case requestcapturelog.FieldResponseBody:
return m.ResponseBody()
case requestcapturelog.FieldNfsFilePath:
return m.NfsFilePath()
case requestcapturelog.FieldCreatedAt:
return m.CreatedAt()
}
return nil, false
}
// OldField returns the old value of the field from the database. An error is
// returned if the mutation operation is not UpdateOne, or the query to the
// database failed.
func (m *RequestCaptureLogMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
switch name {
case requestcapturelog.FieldAPIKeyID:
return m.OldAPIKeyID(ctx)
case requestcapturelog.FieldUserID:
return m.OldUserID(ctx)
case requestcapturelog.FieldRequestID:
return m.OldRequestID(ctx)
case requestcapturelog.FieldPath:
return m.OldPath(ctx)
case requestcapturelog.FieldMethod:
return m.OldMethod(ctx)
case requestcapturelog.FieldIPAddress:
return m.OldIPAddress(ctx)
case requestcapturelog.FieldRequestBody:
return m.OldRequestBody(ctx)
case requestcapturelog.FieldResponseBody:
return m.OldResponseBody(ctx)
case requestcapturelog.FieldNfsFilePath:
return m.OldNfsFilePath(ctx)
case requestcapturelog.FieldCreatedAt:
return m.OldCreatedAt(ctx)
}
return nil, fmt.Errorf("unknown RequestCaptureLog field %s", name)
}
// SetField sets the value of a field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *RequestCaptureLogMutation) SetField(name string, value ent.Value) error {
switch name {
case requestcapturelog.FieldAPIKeyID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetAPIKeyID(v)
return nil
case requestcapturelog.FieldUserID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetUserID(v)
return nil
case requestcapturelog.FieldRequestID:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRequestID(v)
return nil
case requestcapturelog.FieldPath:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetPath(v)
return nil
case requestcapturelog.FieldMethod:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetMethod(v)
return nil
case requestcapturelog.FieldIPAddress:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetIPAddress(v)
return nil
case requestcapturelog.FieldRequestBody:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetRequestBody(v)
return nil
case requestcapturelog.FieldResponseBody:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetResponseBody(v)
return nil
case requestcapturelog.FieldNfsFilePath:
v, ok := value.(string)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetNfsFilePath(v)
return nil
case requestcapturelog.FieldCreatedAt:
v, ok := value.(time.Time)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.SetCreatedAt(v)
return nil
}
return fmt.Errorf("unknown RequestCaptureLog field %s", name)
}
// AddedFields returns all numeric fields that were incremented/decremented during
// this mutation.
func (m *RequestCaptureLogMutation) AddedFields() []string {
var fields []string
if m.addapi_key_id != nil {
fields = append(fields, requestcapturelog.FieldAPIKeyID)
}
if m.adduser_id != nil {
fields = append(fields, requestcapturelog.FieldUserID)
}
return fields
}
// AddedField returns the numeric value that was incremented/decremented on a field
// with the given name. The second boolean return value indicates that this field
// was not set, or was not defined in the schema.
func (m *RequestCaptureLogMutation) AddedField(name string) (ent.Value, bool) {
switch name {
case requestcapturelog.FieldAPIKeyID:
return m.AddedAPIKeyID()
case requestcapturelog.FieldUserID:
return m.AddedUserID()
}
return nil, false
}
// AddField adds the value to the field with the given name. It returns an error if
// the field is not defined in the schema, or if the type mismatched the field
// type.
func (m *RequestCaptureLogMutation) AddField(name string, value ent.Value) error {
switch name {
case requestcapturelog.FieldAPIKeyID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddAPIKeyID(v)
return nil
case requestcapturelog.FieldUserID:
v, ok := value.(int64)
if !ok {
return fmt.Errorf("unexpected type %T for field %s", value, name)
}
m.AddUserID(v)
return nil
}
return fmt.Errorf("unknown RequestCaptureLog numeric field %s", name)
}
// ClearedFields returns all nullable fields that were cleared during this
// mutation.
func (m *RequestCaptureLogMutation) ClearedFields() []string {
var fields []string
if m.FieldCleared(requestcapturelog.FieldRequestID) {
fields = append(fields, requestcapturelog.FieldRequestID)
}
if m.FieldCleared(requestcapturelog.FieldPath) {
fields = append(fields, requestcapturelog.FieldPath)
}
if m.FieldCleared(requestcapturelog.FieldMethod) {
fields = append(fields, requestcapturelog.FieldMethod)
}
if m.FieldCleared(requestcapturelog.FieldIPAddress) {
fields = append(fields, requestcapturelog.FieldIPAddress)
}
if m.FieldCleared(requestcapturelog.FieldRequestBody) {
fields = append(fields, requestcapturelog.FieldRequestBody)
}
if m.FieldCleared(requestcapturelog.FieldResponseBody) {
fields = append(fields, requestcapturelog.FieldResponseBody)
}
if m.FieldCleared(requestcapturelog.FieldNfsFilePath) {
fields = append(fields, requestcapturelog.FieldNfsFilePath)
}
return fields
}
// FieldCleared returns a boolean indicating if a field with the given name was
// cleared in this mutation.
func (m *RequestCaptureLogMutation) FieldCleared(name string) bool {
_, ok := m.clearedFields[name]
return ok
}
// ClearField clears the value of the field with the given name. It returns an
// error if the field is not defined in the schema.
func (m *RequestCaptureLogMutation) ClearField(name string) error {
switch name {
case requestcapturelog.FieldRequestID:
m.ClearRequestID()
return nil
case requestcapturelog.FieldPath:
m.ClearPath()
return nil
case requestcapturelog.FieldMethod:
m.ClearMethod()
return nil
case requestcapturelog.FieldIPAddress:
m.ClearIPAddress()
return nil
case requestcapturelog.FieldRequestBody:
m.ClearRequestBody()
return nil
case requestcapturelog.FieldResponseBody:
m.ClearResponseBody()
return nil
case requestcapturelog.FieldNfsFilePath:
m.ClearNfsFilePath()
return nil
}
return fmt.Errorf("unknown RequestCaptureLog nullable field %s", name)
}
// ResetField resets all changes in the mutation for the field with the given name.
// It returns an error if the field is not defined in the schema.
func (m *RequestCaptureLogMutation) ResetField(name string) error {
switch name {
case requestcapturelog.FieldAPIKeyID:
m.ResetAPIKeyID()
return nil
case requestcapturelog.FieldUserID:
m.ResetUserID()
return nil
case requestcapturelog.FieldRequestID:
m.ResetRequestID()
return nil
case requestcapturelog.FieldPath:
m.ResetPath()
return nil
case requestcapturelog.FieldMethod:
m.ResetMethod()
return nil
case requestcapturelog.FieldIPAddress:
m.ResetIPAddress()
return nil
case requestcapturelog.FieldRequestBody:
m.ResetRequestBody()
return nil
case requestcapturelog.FieldResponseBody:
m.ResetResponseBody()
return nil
case requestcapturelog.FieldNfsFilePath:
m.ResetNfsFilePath()
return nil
case requestcapturelog.FieldCreatedAt:
m.ResetCreatedAt()
return nil
}
return fmt.Errorf("unknown RequestCaptureLog field %s", name)
}
// AddedEdges returns all edge names that were set/added in this mutation.
func (m *RequestCaptureLogMutation) AddedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// AddedIDs returns all IDs (to other nodes) that were added for the given edge
// name in this mutation.
func (m *RequestCaptureLogMutation) AddedIDs(name string) []ent.Value {
return nil
}
// RemovedEdges returns all edge names that were removed in this mutation.
func (m *RequestCaptureLogMutation) RemovedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
// the given name in this mutation.
func (m *RequestCaptureLogMutation) RemovedIDs(name string) []ent.Value {
return nil
}
// ClearedEdges returns all edge names that were cleared in this mutation.
func (m *RequestCaptureLogMutation) ClearedEdges() []string {
edges := make([]string, 0, 0)
return edges
}
// EdgeCleared returns a boolean which indicates if the edge with the given name
// was cleared in this mutation.
func (m *RequestCaptureLogMutation) EdgeCleared(name string) bool {
return false
}
// ClearEdge clears the value of the edge with the given name. It returns an error
// if that edge is not defined in the schema.
func (m *RequestCaptureLogMutation) ClearEdge(name string) error {
return fmt.Errorf("unknown RequestCaptureLog unique edge %s", name)
}
// ResetEdge resets all changes to the edge with the given name in this mutation.
// It returns an error if the edge is not defined in the schema.
func (m *RequestCaptureLogMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown RequestCaptureLog edge %s", name)
}
// SecuritySecretMutation represents an operation that mutates the SecuritySecret nodes in the graph.
type SecuritySecretMutation struct {
config
backend/ent/predicate/predicate.go
View file @
994da655
...
...
@@ -51,6 +51,9 @@ type Proxy func(*sql.Selector)
// RedeemCode is the predicate function for redeemcode builders.
type
RedeemCode
func
(
*
sql
.
Selector
)
// RequestCaptureLog is the predicate function for requestcapturelog builders.
type
RequestCaptureLog
func
(
*
sql
.
Selector
)
// SecuritySecret is the predicate function for securitysecret builders.
type
SecuritySecret
func
(
*
sql
.
Selector
)
...
...
backend/ent/requestcapturelog.go
0 → 100644
View file @
994da655
// 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/requestcapturelog"
)
// RequestCaptureLog is the model entity for the RequestCaptureLog schema.
type
RequestCaptureLog
struct
{
config
`json:"-"`
// ID of the ent.
ID
int64
`json:"id,omitempty"`
// APIKeyID holds the value of the "api_key_id" field.
APIKeyID
int64
`json:"api_key_id,omitempty"`
// UserID holds the value of the "user_id" field.
UserID
int64
`json:"user_id,omitempty"`
// RequestID holds the value of the "request_id" field.
RequestID
*
string
`json:"request_id,omitempty"`
// Path holds the value of the "path" field.
Path
*
string
`json:"path,omitempty"`
// Method holds the value of the "method" field.
Method
*
string
`json:"method,omitempty"`
// IPAddress holds the value of the "ip_address" field.
IPAddress
*
string
`json:"ip_address,omitempty"`
// RequestBody holds the value of the "request_body" field.
RequestBody
*
string
`json:"request_body,omitempty"`
// ResponseBody holds the value of the "response_body" field.
ResponseBody
*
string
`json:"response_body,omitempty"`
// NfsFilePath holds the value of the "nfs_file_path" field.
NfsFilePath
*
string
`json:"nfs_file_path,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt
time
.
Time
`json:"created_at,omitempty"`
selectValues
sql
.
SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func
(
*
RequestCaptureLog
)
scanValues
(
columns
[]
string
)
([]
any
,
error
)
{
values
:=
make
([]
any
,
len
(
columns
))
for
i
:=
range
columns
{
switch
columns
[
i
]
{
case
requestcapturelog
.
FieldID
,
requestcapturelog
.
FieldAPIKeyID
,
requestcapturelog
.
FieldUserID
:
values
[
i
]
=
new
(
sql
.
NullInt64
)
case
requestcapturelog
.
FieldRequestID
,
requestcapturelog
.
FieldPath
,
requestcapturelog
.
FieldMethod
,
requestcapturelog
.
FieldIPAddress
,
requestcapturelog
.
FieldRequestBody
,
requestcapturelog
.
FieldResponseBody
,
requestcapturelog
.
FieldNfsFilePath
:
values
[
i
]
=
new
(
sql
.
NullString
)
case
requestcapturelog
.
FieldCreatedAt
:
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 RequestCaptureLog fields.
func
(
_m
*
RequestCaptureLog
)
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
requestcapturelog
.
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
requestcapturelog
.
FieldAPIKeyID
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field api_key_id"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
APIKeyID
=
value
.
Int64
}
case
requestcapturelog
.
FieldUserID
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullInt64
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field user_id"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
UserID
=
value
.
Int64
}
case
requestcapturelog
.
FieldRequestID
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field request_id"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
RequestID
=
new
(
string
)
*
_m
.
RequestID
=
value
.
String
}
case
requestcapturelog
.
FieldPath
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field path"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Path
=
new
(
string
)
*
_m
.
Path
=
value
.
String
}
case
requestcapturelog
.
FieldMethod
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field method"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
Method
=
new
(
string
)
*
_m
.
Method
=
value
.
String
}
case
requestcapturelog
.
FieldIPAddress
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field ip_address"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
IPAddress
=
new
(
string
)
*
_m
.
IPAddress
=
value
.
String
}
case
requestcapturelog
.
FieldRequestBody
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field request_body"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
RequestBody
=
new
(
string
)
*
_m
.
RequestBody
=
value
.
String
}
case
requestcapturelog
.
FieldResponseBody
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field response_body"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
ResponseBody
=
new
(
string
)
*
_m
.
ResponseBody
=
value
.
String
}
case
requestcapturelog
.
FieldNfsFilePath
:
if
value
,
ok
:=
values
[
i
]
.
(
*
sql
.
NullString
);
!
ok
{
return
fmt
.
Errorf
(
"unexpected type %T for field nfs_file_path"
,
values
[
i
])
}
else
if
value
.
Valid
{
_m
.
NfsFilePath
=
new
(
string
)
*
_m
.
NfsFilePath
=
value
.
String
}
case
requestcapturelog
.
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
}
default
:
_m
.
selectValues
.
Set
(
columns
[
i
],
values
[
i
])
}
}
return
nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the RequestCaptureLog.
// This includes values selected through modifiers, order, etc.
func
(
_m
*
RequestCaptureLog
)
Value
(
name
string
)
(
ent
.
Value
,
error
)
{
return
_m
.
selectValues
.
Get
(
name
)
}
// Update returns a builder for updating this RequestCaptureLog.
// Note that you need to call RequestCaptureLog.Unwrap() before calling this method if this RequestCaptureLog
// was returned from a transaction, and the transaction was committed or rolled back.
func
(
_m
*
RequestCaptureLog
)
Update
()
*
RequestCaptureLogUpdateOne
{
return
NewRequestCaptureLogClient
(
_m
.
config
)
.
UpdateOne
(
_m
)
}
// Unwrap unwraps the RequestCaptureLog 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
*
RequestCaptureLog
)
Unwrap
()
*
RequestCaptureLog
{
_tx
,
ok
:=
_m
.
config
.
driver
.
(
*
txDriver
)
if
!
ok
{
panic
(
"ent: RequestCaptureLog is not a transactional entity"
)
}
_m
.
config
.
driver
=
_tx
.
drv
return
_m
}
// String implements the fmt.Stringer.
func
(
_m
*
RequestCaptureLog
)
String
()
string
{
var
builder
strings
.
Builder
builder
.
WriteString
(
"RequestCaptureLog("
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"id=%v, "
,
_m
.
ID
))
builder
.
WriteString
(
"api_key_id="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
APIKeyID
))
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"user_id="
)
builder
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
_m
.
UserID
))
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
RequestID
;
v
!=
nil
{
builder
.
WriteString
(
"request_id="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
Path
;
v
!=
nil
{
builder
.
WriteString
(
"path="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
Method
;
v
!=
nil
{
builder
.
WriteString
(
"method="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
IPAddress
;
v
!=
nil
{
builder
.
WriteString
(
"ip_address="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
RequestBody
;
v
!=
nil
{
builder
.
WriteString
(
"request_body="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
ResponseBody
;
v
!=
nil
{
builder
.
WriteString
(
"response_body="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
if
v
:=
_m
.
NfsFilePath
;
v
!=
nil
{
builder
.
WriteString
(
"nfs_file_path="
)
builder
.
WriteString
(
*
v
)
}
builder
.
WriteString
(
", "
)
builder
.
WriteString
(
"created_at="
)
builder
.
WriteString
(
_m
.
CreatedAt
.
Format
(
time
.
ANSIC
))
builder
.
WriteByte
(
')'
)
return
builder
.
String
()
}
// RequestCaptureLogs is a parsable slice of RequestCaptureLog.
type
RequestCaptureLogs
[]
*
RequestCaptureLog
backend/ent/requestcapturelog/requestcapturelog.go
0 → 100644
View file @
994da655
// Code generated by ent, DO NOT EDIT.
package
requestcapturelog
import
(
"time"
"entgo.io/ent/dialect/sql"
)
const
(
// Label holds the string label denoting the requestcapturelog type in the database.
Label
=
"request_capture_log"
// FieldID holds the string denoting the id field in the database.
FieldID
=
"id"
// FieldAPIKeyID holds the string denoting the api_key_id field in the database.
FieldAPIKeyID
=
"api_key_id"
// FieldUserID holds the string denoting the user_id field in the database.
FieldUserID
=
"user_id"
// FieldRequestID holds the string denoting the request_id field in the database.
FieldRequestID
=
"request_id"
// FieldPath holds the string denoting the path field in the database.
FieldPath
=
"path"
// FieldMethod holds the string denoting the method field in the database.
FieldMethod
=
"method"
// FieldIPAddress holds the string denoting the ip_address field in the database.
FieldIPAddress
=
"ip_address"
// FieldRequestBody holds the string denoting the request_body field in the database.
FieldRequestBody
=
"request_body"
// FieldResponseBody holds the string denoting the response_body field in the database.
FieldResponseBody
=
"response_body"
// FieldNfsFilePath holds the string denoting the nfs_file_path field in the database.
FieldNfsFilePath
=
"nfs_file_path"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt
=
"created_at"
// Table holds the table name of the requestcapturelog in the database.
Table
=
"request_capture_logs"
)
// Columns holds all SQL columns for requestcapturelog fields.
var
Columns
=
[]
string
{
FieldID
,
FieldAPIKeyID
,
FieldUserID
,
FieldRequestID
,
FieldPath
,
FieldMethod
,
FieldIPAddress
,
FieldRequestBody
,
FieldResponseBody
,
FieldNfsFilePath
,
FieldCreatedAt
,
}
// 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
(
// RequestIDValidator is a validator for the "request_id" field. It is called by the builders before save.
RequestIDValidator
func
(
string
)
error
// PathValidator is a validator for the "path" field. It is called by the builders before save.
PathValidator
func
(
string
)
error
// MethodValidator is a validator for the "method" field. It is called by the builders before save.
MethodValidator
func
(
string
)
error
// IPAddressValidator is a validator for the "ip_address" field. It is called by the builders before save.
IPAddressValidator
func
(
string
)
error
// NfsFilePathValidator is a validator for the "nfs_file_path" field. It is called by the builders before save.
NfsFilePathValidator
func
(
string
)
error
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt
func
()
time
.
Time
)
// OrderOption defines the ordering options for the RequestCaptureLog 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
()
}
// ByAPIKeyID orders the results by the api_key_id field.
func
ByAPIKeyID
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldAPIKeyID
,
opts
...
)
.
ToFunc
()
}
// ByUserID orders the results by the user_id field.
func
ByUserID
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldUserID
,
opts
...
)
.
ToFunc
()
}
// ByRequestID orders the results by the request_id field.
func
ByRequestID
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldRequestID
,
opts
...
)
.
ToFunc
()
}
// ByPath orders the results by the path field.
func
ByPath
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldPath
,
opts
...
)
.
ToFunc
()
}
// ByMethod orders the results by the method field.
func
ByMethod
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldMethod
,
opts
...
)
.
ToFunc
()
}
// ByIPAddress orders the results by the ip_address field.
func
ByIPAddress
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldIPAddress
,
opts
...
)
.
ToFunc
()
}
// ByRequestBody orders the results by the request_body field.
func
ByRequestBody
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldRequestBody
,
opts
...
)
.
ToFunc
()
}
// ByResponseBody orders the results by the response_body field.
func
ByResponseBody
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldResponseBody
,
opts
...
)
.
ToFunc
()
}
// ByNfsFilePath orders the results by the nfs_file_path field.
func
ByNfsFilePath
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldNfsFilePath
,
opts
...
)
.
ToFunc
()
}
// ByCreatedAt orders the results by the created_at field.
func
ByCreatedAt
(
opts
...
sql
.
OrderTermOption
)
OrderOption
{
return
sql
.
OrderByField
(
FieldCreatedAt
,
opts
...
)
.
ToFunc
()
}
backend/ent/requestcapturelog/where.go
0 → 100644
View file @
994da655
// Code generated by ent, DO NOT EDIT.
package
requestcapturelog
import
(
"time"
"entgo.io/ent/dialect/sql"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ID filters vertices based on their ID field.
func
ID
(
id
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDEQ applies the EQ predicate on the ID field.
func
IDEQ
(
id
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldID
,
id
))
}
// IDNEQ applies the NEQ predicate on the ID field.
func
IDNEQ
(
id
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldID
,
id
))
}
// IDIn applies the In predicate on the ID field.
func
IDIn
(
ids
...
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldID
,
ids
...
))
}
// IDNotIn applies the NotIn predicate on the ID field.
func
IDNotIn
(
ids
...
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldID
,
ids
...
))
}
// IDGT applies the GT predicate on the ID field.
func
IDGT
(
id
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldID
,
id
))
}
// IDGTE applies the GTE predicate on the ID field.
func
IDGTE
(
id
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldID
,
id
))
}
// IDLT applies the LT predicate on the ID field.
func
IDLT
(
id
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldID
,
id
))
}
// IDLTE applies the LTE predicate on the ID field.
func
IDLTE
(
id
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldID
,
id
))
}
// APIKeyID applies equality check predicate on the "api_key_id" field. It's identical to APIKeyIDEQ.
func
APIKeyID
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldAPIKeyID
,
v
))
}
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
func
UserID
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldUserID
,
v
))
}
// RequestID applies equality check predicate on the "request_id" field. It's identical to RequestIDEQ.
func
RequestID
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldRequestID
,
v
))
}
// Path applies equality check predicate on the "path" field. It's identical to PathEQ.
func
Path
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldPath
,
v
))
}
// Method applies equality check predicate on the "method" field. It's identical to MethodEQ.
func
Method
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldMethod
,
v
))
}
// IPAddress applies equality check predicate on the "ip_address" field. It's identical to IPAddressEQ.
func
IPAddress
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldIPAddress
,
v
))
}
// RequestBody applies equality check predicate on the "request_body" field. It's identical to RequestBodyEQ.
func
RequestBody
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldRequestBody
,
v
))
}
// ResponseBody applies equality check predicate on the "response_body" field. It's identical to ResponseBodyEQ.
func
ResponseBody
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldResponseBody
,
v
))
}
// NfsFilePath applies equality check predicate on the "nfs_file_path" field. It's identical to NfsFilePathEQ.
func
NfsFilePath
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldNfsFilePath
,
v
))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func
CreatedAt
(
v
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
}
// APIKeyIDEQ applies the EQ predicate on the "api_key_id" field.
func
APIKeyIDEQ
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldAPIKeyID
,
v
))
}
// APIKeyIDNEQ applies the NEQ predicate on the "api_key_id" field.
func
APIKeyIDNEQ
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldAPIKeyID
,
v
))
}
// APIKeyIDIn applies the In predicate on the "api_key_id" field.
func
APIKeyIDIn
(
vs
...
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldAPIKeyID
,
vs
...
))
}
// APIKeyIDNotIn applies the NotIn predicate on the "api_key_id" field.
func
APIKeyIDNotIn
(
vs
...
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldAPIKeyID
,
vs
...
))
}
// APIKeyIDGT applies the GT predicate on the "api_key_id" field.
func
APIKeyIDGT
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldAPIKeyID
,
v
))
}
// APIKeyIDGTE applies the GTE predicate on the "api_key_id" field.
func
APIKeyIDGTE
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldAPIKeyID
,
v
))
}
// APIKeyIDLT applies the LT predicate on the "api_key_id" field.
func
APIKeyIDLT
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldAPIKeyID
,
v
))
}
// APIKeyIDLTE applies the LTE predicate on the "api_key_id" field.
func
APIKeyIDLTE
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldAPIKeyID
,
v
))
}
// UserIDEQ applies the EQ predicate on the "user_id" field.
func
UserIDEQ
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldUserID
,
v
))
}
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
func
UserIDNEQ
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldUserID
,
v
))
}
// UserIDIn applies the In predicate on the "user_id" field.
func
UserIDIn
(
vs
...
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldUserID
,
vs
...
))
}
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
func
UserIDNotIn
(
vs
...
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldUserID
,
vs
...
))
}
// UserIDGT applies the GT predicate on the "user_id" field.
func
UserIDGT
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldUserID
,
v
))
}
// UserIDGTE applies the GTE predicate on the "user_id" field.
func
UserIDGTE
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldUserID
,
v
))
}
// UserIDLT applies the LT predicate on the "user_id" field.
func
UserIDLT
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldUserID
,
v
))
}
// UserIDLTE applies the LTE predicate on the "user_id" field.
func
UserIDLTE
(
v
int64
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldUserID
,
v
))
}
// RequestIDEQ applies the EQ predicate on the "request_id" field.
func
RequestIDEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldRequestID
,
v
))
}
// RequestIDNEQ applies the NEQ predicate on the "request_id" field.
func
RequestIDNEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldRequestID
,
v
))
}
// RequestIDIn applies the In predicate on the "request_id" field.
func
RequestIDIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldRequestID
,
vs
...
))
}
// RequestIDNotIn applies the NotIn predicate on the "request_id" field.
func
RequestIDNotIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldRequestID
,
vs
...
))
}
// RequestIDGT applies the GT predicate on the "request_id" field.
func
RequestIDGT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldRequestID
,
v
))
}
// RequestIDGTE applies the GTE predicate on the "request_id" field.
func
RequestIDGTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldRequestID
,
v
))
}
// RequestIDLT applies the LT predicate on the "request_id" field.
func
RequestIDLT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldRequestID
,
v
))
}
// RequestIDLTE applies the LTE predicate on the "request_id" field.
func
RequestIDLTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldRequestID
,
v
))
}
// RequestIDContains applies the Contains predicate on the "request_id" field.
func
RequestIDContains
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContains
(
FieldRequestID
,
v
))
}
// RequestIDHasPrefix applies the HasPrefix predicate on the "request_id" field.
func
RequestIDHasPrefix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasPrefix
(
FieldRequestID
,
v
))
}
// RequestIDHasSuffix applies the HasSuffix predicate on the "request_id" field.
func
RequestIDHasSuffix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasSuffix
(
FieldRequestID
,
v
))
}
// RequestIDIsNil applies the IsNil predicate on the "request_id" field.
func
RequestIDIsNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIsNull
(
FieldRequestID
))
}
// RequestIDNotNil applies the NotNil predicate on the "request_id" field.
func
RequestIDNotNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotNull
(
FieldRequestID
))
}
// RequestIDEqualFold applies the EqualFold predicate on the "request_id" field.
func
RequestIDEqualFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEqualFold
(
FieldRequestID
,
v
))
}
// RequestIDContainsFold applies the ContainsFold predicate on the "request_id" field.
func
RequestIDContainsFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContainsFold
(
FieldRequestID
,
v
))
}
// PathEQ applies the EQ predicate on the "path" field.
func
PathEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldPath
,
v
))
}
// PathNEQ applies the NEQ predicate on the "path" field.
func
PathNEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldPath
,
v
))
}
// PathIn applies the In predicate on the "path" field.
func
PathIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldPath
,
vs
...
))
}
// PathNotIn applies the NotIn predicate on the "path" field.
func
PathNotIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldPath
,
vs
...
))
}
// PathGT applies the GT predicate on the "path" field.
func
PathGT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldPath
,
v
))
}
// PathGTE applies the GTE predicate on the "path" field.
func
PathGTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldPath
,
v
))
}
// PathLT applies the LT predicate on the "path" field.
func
PathLT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldPath
,
v
))
}
// PathLTE applies the LTE predicate on the "path" field.
func
PathLTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldPath
,
v
))
}
// PathContains applies the Contains predicate on the "path" field.
func
PathContains
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContains
(
FieldPath
,
v
))
}
// PathHasPrefix applies the HasPrefix predicate on the "path" field.
func
PathHasPrefix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasPrefix
(
FieldPath
,
v
))
}
// PathHasSuffix applies the HasSuffix predicate on the "path" field.
func
PathHasSuffix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasSuffix
(
FieldPath
,
v
))
}
// PathIsNil applies the IsNil predicate on the "path" field.
func
PathIsNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIsNull
(
FieldPath
))
}
// PathNotNil applies the NotNil predicate on the "path" field.
func
PathNotNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotNull
(
FieldPath
))
}
// PathEqualFold applies the EqualFold predicate on the "path" field.
func
PathEqualFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEqualFold
(
FieldPath
,
v
))
}
// PathContainsFold applies the ContainsFold predicate on the "path" field.
func
PathContainsFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContainsFold
(
FieldPath
,
v
))
}
// MethodEQ applies the EQ predicate on the "method" field.
func
MethodEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldMethod
,
v
))
}
// MethodNEQ applies the NEQ predicate on the "method" field.
func
MethodNEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldMethod
,
v
))
}
// MethodIn applies the In predicate on the "method" field.
func
MethodIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldMethod
,
vs
...
))
}
// MethodNotIn applies the NotIn predicate on the "method" field.
func
MethodNotIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldMethod
,
vs
...
))
}
// MethodGT applies the GT predicate on the "method" field.
func
MethodGT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldMethod
,
v
))
}
// MethodGTE applies the GTE predicate on the "method" field.
func
MethodGTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldMethod
,
v
))
}
// MethodLT applies the LT predicate on the "method" field.
func
MethodLT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldMethod
,
v
))
}
// MethodLTE applies the LTE predicate on the "method" field.
func
MethodLTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldMethod
,
v
))
}
// MethodContains applies the Contains predicate on the "method" field.
func
MethodContains
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContains
(
FieldMethod
,
v
))
}
// MethodHasPrefix applies the HasPrefix predicate on the "method" field.
func
MethodHasPrefix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasPrefix
(
FieldMethod
,
v
))
}
// MethodHasSuffix applies the HasSuffix predicate on the "method" field.
func
MethodHasSuffix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasSuffix
(
FieldMethod
,
v
))
}
// MethodIsNil applies the IsNil predicate on the "method" field.
func
MethodIsNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIsNull
(
FieldMethod
))
}
// MethodNotNil applies the NotNil predicate on the "method" field.
func
MethodNotNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotNull
(
FieldMethod
))
}
// MethodEqualFold applies the EqualFold predicate on the "method" field.
func
MethodEqualFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEqualFold
(
FieldMethod
,
v
))
}
// MethodContainsFold applies the ContainsFold predicate on the "method" field.
func
MethodContainsFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContainsFold
(
FieldMethod
,
v
))
}
// IPAddressEQ applies the EQ predicate on the "ip_address" field.
func
IPAddressEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldIPAddress
,
v
))
}
// IPAddressNEQ applies the NEQ predicate on the "ip_address" field.
func
IPAddressNEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldIPAddress
,
v
))
}
// IPAddressIn applies the In predicate on the "ip_address" field.
func
IPAddressIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldIPAddress
,
vs
...
))
}
// IPAddressNotIn applies the NotIn predicate on the "ip_address" field.
func
IPAddressNotIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldIPAddress
,
vs
...
))
}
// IPAddressGT applies the GT predicate on the "ip_address" field.
func
IPAddressGT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldIPAddress
,
v
))
}
// IPAddressGTE applies the GTE predicate on the "ip_address" field.
func
IPAddressGTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldIPAddress
,
v
))
}
// IPAddressLT applies the LT predicate on the "ip_address" field.
func
IPAddressLT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldIPAddress
,
v
))
}
// IPAddressLTE applies the LTE predicate on the "ip_address" field.
func
IPAddressLTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldIPAddress
,
v
))
}
// IPAddressContains applies the Contains predicate on the "ip_address" field.
func
IPAddressContains
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContains
(
FieldIPAddress
,
v
))
}
// IPAddressHasPrefix applies the HasPrefix predicate on the "ip_address" field.
func
IPAddressHasPrefix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasPrefix
(
FieldIPAddress
,
v
))
}
// IPAddressHasSuffix applies the HasSuffix predicate on the "ip_address" field.
func
IPAddressHasSuffix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasSuffix
(
FieldIPAddress
,
v
))
}
// IPAddressIsNil applies the IsNil predicate on the "ip_address" field.
func
IPAddressIsNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIsNull
(
FieldIPAddress
))
}
// IPAddressNotNil applies the NotNil predicate on the "ip_address" field.
func
IPAddressNotNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotNull
(
FieldIPAddress
))
}
// IPAddressEqualFold applies the EqualFold predicate on the "ip_address" field.
func
IPAddressEqualFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEqualFold
(
FieldIPAddress
,
v
))
}
// IPAddressContainsFold applies the ContainsFold predicate on the "ip_address" field.
func
IPAddressContainsFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContainsFold
(
FieldIPAddress
,
v
))
}
// RequestBodyEQ applies the EQ predicate on the "request_body" field.
func
RequestBodyEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldRequestBody
,
v
))
}
// RequestBodyNEQ applies the NEQ predicate on the "request_body" field.
func
RequestBodyNEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldRequestBody
,
v
))
}
// RequestBodyIn applies the In predicate on the "request_body" field.
func
RequestBodyIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldRequestBody
,
vs
...
))
}
// RequestBodyNotIn applies the NotIn predicate on the "request_body" field.
func
RequestBodyNotIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldRequestBody
,
vs
...
))
}
// RequestBodyGT applies the GT predicate on the "request_body" field.
func
RequestBodyGT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldRequestBody
,
v
))
}
// RequestBodyGTE applies the GTE predicate on the "request_body" field.
func
RequestBodyGTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldRequestBody
,
v
))
}
// RequestBodyLT applies the LT predicate on the "request_body" field.
func
RequestBodyLT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldRequestBody
,
v
))
}
// RequestBodyLTE applies the LTE predicate on the "request_body" field.
func
RequestBodyLTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldRequestBody
,
v
))
}
// RequestBodyContains applies the Contains predicate on the "request_body" field.
func
RequestBodyContains
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContains
(
FieldRequestBody
,
v
))
}
// RequestBodyHasPrefix applies the HasPrefix predicate on the "request_body" field.
func
RequestBodyHasPrefix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasPrefix
(
FieldRequestBody
,
v
))
}
// RequestBodyHasSuffix applies the HasSuffix predicate on the "request_body" field.
func
RequestBodyHasSuffix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasSuffix
(
FieldRequestBody
,
v
))
}
// RequestBodyIsNil applies the IsNil predicate on the "request_body" field.
func
RequestBodyIsNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIsNull
(
FieldRequestBody
))
}
// RequestBodyNotNil applies the NotNil predicate on the "request_body" field.
func
RequestBodyNotNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotNull
(
FieldRequestBody
))
}
// RequestBodyEqualFold applies the EqualFold predicate on the "request_body" field.
func
RequestBodyEqualFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEqualFold
(
FieldRequestBody
,
v
))
}
// RequestBodyContainsFold applies the ContainsFold predicate on the "request_body" field.
func
RequestBodyContainsFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContainsFold
(
FieldRequestBody
,
v
))
}
// ResponseBodyEQ applies the EQ predicate on the "response_body" field.
func
ResponseBodyEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldResponseBody
,
v
))
}
// ResponseBodyNEQ applies the NEQ predicate on the "response_body" field.
func
ResponseBodyNEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldResponseBody
,
v
))
}
// ResponseBodyIn applies the In predicate on the "response_body" field.
func
ResponseBodyIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldResponseBody
,
vs
...
))
}
// ResponseBodyNotIn applies the NotIn predicate on the "response_body" field.
func
ResponseBodyNotIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldResponseBody
,
vs
...
))
}
// ResponseBodyGT applies the GT predicate on the "response_body" field.
func
ResponseBodyGT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldResponseBody
,
v
))
}
// ResponseBodyGTE applies the GTE predicate on the "response_body" field.
func
ResponseBodyGTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldResponseBody
,
v
))
}
// ResponseBodyLT applies the LT predicate on the "response_body" field.
func
ResponseBodyLT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldResponseBody
,
v
))
}
// ResponseBodyLTE applies the LTE predicate on the "response_body" field.
func
ResponseBodyLTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldResponseBody
,
v
))
}
// ResponseBodyContains applies the Contains predicate on the "response_body" field.
func
ResponseBodyContains
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContains
(
FieldResponseBody
,
v
))
}
// ResponseBodyHasPrefix applies the HasPrefix predicate on the "response_body" field.
func
ResponseBodyHasPrefix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasPrefix
(
FieldResponseBody
,
v
))
}
// ResponseBodyHasSuffix applies the HasSuffix predicate on the "response_body" field.
func
ResponseBodyHasSuffix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasSuffix
(
FieldResponseBody
,
v
))
}
// ResponseBodyIsNil applies the IsNil predicate on the "response_body" field.
func
ResponseBodyIsNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIsNull
(
FieldResponseBody
))
}
// ResponseBodyNotNil applies the NotNil predicate on the "response_body" field.
func
ResponseBodyNotNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotNull
(
FieldResponseBody
))
}
// ResponseBodyEqualFold applies the EqualFold predicate on the "response_body" field.
func
ResponseBodyEqualFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEqualFold
(
FieldResponseBody
,
v
))
}
// ResponseBodyContainsFold applies the ContainsFold predicate on the "response_body" field.
func
ResponseBodyContainsFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContainsFold
(
FieldResponseBody
,
v
))
}
// NfsFilePathEQ applies the EQ predicate on the "nfs_file_path" field.
func
NfsFilePathEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathNEQ applies the NEQ predicate on the "nfs_file_path" field.
func
NfsFilePathNEQ
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathIn applies the In predicate on the "nfs_file_path" field.
func
NfsFilePathIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldNfsFilePath
,
vs
...
))
}
// NfsFilePathNotIn applies the NotIn predicate on the "nfs_file_path" field.
func
NfsFilePathNotIn
(
vs
...
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldNfsFilePath
,
vs
...
))
}
// NfsFilePathGT applies the GT predicate on the "nfs_file_path" field.
func
NfsFilePathGT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathGTE applies the GTE predicate on the "nfs_file_path" field.
func
NfsFilePathGTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathLT applies the LT predicate on the "nfs_file_path" field.
func
NfsFilePathLT
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathLTE applies the LTE predicate on the "nfs_file_path" field.
func
NfsFilePathLTE
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathContains applies the Contains predicate on the "nfs_file_path" field.
func
NfsFilePathContains
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContains
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathHasPrefix applies the HasPrefix predicate on the "nfs_file_path" field.
func
NfsFilePathHasPrefix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasPrefix
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathHasSuffix applies the HasSuffix predicate on the "nfs_file_path" field.
func
NfsFilePathHasSuffix
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldHasSuffix
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathIsNil applies the IsNil predicate on the "nfs_file_path" field.
func
NfsFilePathIsNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIsNull
(
FieldNfsFilePath
))
}
// NfsFilePathNotNil applies the NotNil predicate on the "nfs_file_path" field.
func
NfsFilePathNotNil
()
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotNull
(
FieldNfsFilePath
))
}
// NfsFilePathEqualFold applies the EqualFold predicate on the "nfs_file_path" field.
func
NfsFilePathEqualFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEqualFold
(
FieldNfsFilePath
,
v
))
}
// NfsFilePathContainsFold applies the ContainsFold predicate on the "nfs_file_path" field.
func
NfsFilePathContainsFold
(
v
string
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldContainsFold
(
FieldNfsFilePath
,
v
))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func
CreatedAtEQ
(
v
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldEQ
(
FieldCreatedAt
,
v
))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func
CreatedAtNEQ
(
v
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNEQ
(
FieldCreatedAt
,
v
))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func
CreatedAtIn
(
vs
...
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldIn
(
FieldCreatedAt
,
vs
...
))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func
CreatedAtNotIn
(
vs
...
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldNotIn
(
FieldCreatedAt
,
vs
...
))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func
CreatedAtGT
(
v
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGT
(
FieldCreatedAt
,
v
))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func
CreatedAtGTE
(
v
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldGTE
(
FieldCreatedAt
,
v
))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func
CreatedAtLT
(
v
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLT
(
FieldCreatedAt
,
v
))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func
CreatedAtLTE
(
v
time
.
Time
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
FieldLTE
(
FieldCreatedAt
,
v
))
}
// And groups predicates with the AND operator between them.
func
And
(
predicates
...
predicate
.
RequestCaptureLog
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
AndPredicates
(
predicates
...
))
}
// Or groups predicates with the OR operator between them.
func
Or
(
predicates
...
predicate
.
RequestCaptureLog
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
OrPredicates
(
predicates
...
))
}
// Not applies the not operator on the given predicate.
func
Not
(
p
predicate
.
RequestCaptureLog
)
predicate
.
RequestCaptureLog
{
return
predicate
.
RequestCaptureLog
(
sql
.
NotPredicates
(
p
))
}
backend/ent/requestcapturelog_create.go
0 → 100644
View file @
994da655
// 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/requestcapturelog"
)
// RequestCaptureLogCreate is the builder for creating a RequestCaptureLog entity.
type
RequestCaptureLogCreate
struct
{
config
mutation
*
RequestCaptureLogMutation
hooks
[]
Hook
conflict
[]
sql
.
ConflictOption
}
// SetAPIKeyID sets the "api_key_id" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetAPIKeyID
(
v
int64
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetAPIKeyID
(
v
)
return
_c
}
// SetUserID sets the "user_id" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetUserID
(
v
int64
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetUserID
(
v
)
return
_c
}
// SetRequestID sets the "request_id" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetRequestID
(
v
string
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetRequestID
(
v
)
return
_c
}
// SetNillableRequestID sets the "request_id" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillableRequestID
(
v
*
string
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetRequestID
(
*
v
)
}
return
_c
}
// SetPath sets the "path" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetPath
(
v
string
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetPath
(
v
)
return
_c
}
// SetNillablePath sets the "path" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillablePath
(
v
*
string
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetPath
(
*
v
)
}
return
_c
}
// SetMethod sets the "method" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetMethod
(
v
string
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetMethod
(
v
)
return
_c
}
// SetNillableMethod sets the "method" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillableMethod
(
v
*
string
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetMethod
(
*
v
)
}
return
_c
}
// SetIPAddress sets the "ip_address" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetIPAddress
(
v
string
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetIPAddress
(
v
)
return
_c
}
// SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillableIPAddress
(
v
*
string
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetIPAddress
(
*
v
)
}
return
_c
}
// SetRequestBody sets the "request_body" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetRequestBody
(
v
string
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetRequestBody
(
v
)
return
_c
}
// SetNillableRequestBody sets the "request_body" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillableRequestBody
(
v
*
string
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetRequestBody
(
*
v
)
}
return
_c
}
// SetResponseBody sets the "response_body" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetResponseBody
(
v
string
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetResponseBody
(
v
)
return
_c
}
// SetNillableResponseBody sets the "response_body" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillableResponseBody
(
v
*
string
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetResponseBody
(
*
v
)
}
return
_c
}
// SetNfsFilePath sets the "nfs_file_path" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetNfsFilePath
(
v
string
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetNfsFilePath
(
v
)
return
_c
}
// SetNillableNfsFilePath sets the "nfs_file_path" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillableNfsFilePath
(
v
*
string
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetNfsFilePath
(
*
v
)
}
return
_c
}
// SetCreatedAt sets the "created_at" field.
func
(
_c
*
RequestCaptureLogCreate
)
SetCreatedAt
(
v
time
.
Time
)
*
RequestCaptureLogCreate
{
_c
.
mutation
.
SetCreatedAt
(
v
)
return
_c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func
(
_c
*
RequestCaptureLogCreate
)
SetNillableCreatedAt
(
v
*
time
.
Time
)
*
RequestCaptureLogCreate
{
if
v
!=
nil
{
_c
.
SetCreatedAt
(
*
v
)
}
return
_c
}
// Mutation returns the RequestCaptureLogMutation object of the builder.
func
(
_c
*
RequestCaptureLogCreate
)
Mutation
()
*
RequestCaptureLogMutation
{
return
_c
.
mutation
}
// Save creates the RequestCaptureLog in the database.
func
(
_c
*
RequestCaptureLogCreate
)
Save
(
ctx
context
.
Context
)
(
*
RequestCaptureLog
,
error
)
{
_c
.
defaults
()
return
withHooks
(
ctx
,
_c
.
sqlSave
,
_c
.
mutation
,
_c
.
hooks
)
}
// SaveX calls Save and panics if Save returns an error.
func
(
_c
*
RequestCaptureLogCreate
)
SaveX
(
ctx
context
.
Context
)
*
RequestCaptureLog
{
v
,
err
:=
_c
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
v
}
// Exec executes the query.
func
(
_c
*
RequestCaptureLogCreate
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_c
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_c
*
RequestCaptureLogCreate
)
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
*
RequestCaptureLogCreate
)
defaults
()
{
if
_
,
ok
:=
_c
.
mutation
.
CreatedAt
();
!
ok
{
v
:=
requestcapturelog
.
DefaultCreatedAt
()
_c
.
mutation
.
SetCreatedAt
(
v
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_c
*
RequestCaptureLogCreate
)
check
()
error
{
if
_
,
ok
:=
_c
.
mutation
.
APIKeyID
();
!
ok
{
return
&
ValidationError
{
Name
:
"api_key_id"
,
err
:
errors
.
New
(
`ent: missing required field "RequestCaptureLog.api_key_id"`
)}
}
if
_
,
ok
:=
_c
.
mutation
.
UserID
();
!
ok
{
return
&
ValidationError
{
Name
:
"user_id"
,
err
:
errors
.
New
(
`ent: missing required field "RequestCaptureLog.user_id"`
)}
}
if
v
,
ok
:=
_c
.
mutation
.
RequestID
();
ok
{
if
err
:=
requestcapturelog
.
RequestIDValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"request_id"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.request_id": %w`
,
err
)}
}
}
if
v
,
ok
:=
_c
.
mutation
.
Path
();
ok
{
if
err
:=
requestcapturelog
.
PathValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"path"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.path": %w`
,
err
)}
}
}
if
v
,
ok
:=
_c
.
mutation
.
Method
();
ok
{
if
err
:=
requestcapturelog
.
MethodValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"method"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.method": %w`
,
err
)}
}
}
if
v
,
ok
:=
_c
.
mutation
.
IPAddress
();
ok
{
if
err
:=
requestcapturelog
.
IPAddressValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"ip_address"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.ip_address": %w`
,
err
)}
}
}
if
v
,
ok
:=
_c
.
mutation
.
NfsFilePath
();
ok
{
if
err
:=
requestcapturelog
.
NfsFilePathValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"nfs_file_path"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.nfs_file_path": %w`
,
err
)}
}
}
if
_
,
ok
:=
_c
.
mutation
.
CreatedAt
();
!
ok
{
return
&
ValidationError
{
Name
:
"created_at"
,
err
:
errors
.
New
(
`ent: missing required field "RequestCaptureLog.created_at"`
)}
}
return
nil
}
func
(
_c
*
RequestCaptureLogCreate
)
sqlSave
(
ctx
context
.
Context
)
(
*
RequestCaptureLog
,
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
*
RequestCaptureLogCreate
)
createSpec
()
(
*
RequestCaptureLog
,
*
sqlgraph
.
CreateSpec
)
{
var
(
_node
=
&
RequestCaptureLog
{
config
:
_c
.
config
}
_spec
=
sqlgraph
.
NewCreateSpec
(
requestcapturelog
.
Table
,
sqlgraph
.
NewFieldSpec
(
requestcapturelog
.
FieldID
,
field
.
TypeInt64
))
)
_spec
.
OnConflict
=
_c
.
conflict
if
value
,
ok
:=
_c
.
mutation
.
APIKeyID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldAPIKeyID
,
field
.
TypeInt64
,
value
)
_node
.
APIKeyID
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
UserID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldUserID
,
field
.
TypeInt64
,
value
)
_node
.
UserID
=
value
}
if
value
,
ok
:=
_c
.
mutation
.
RequestID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldRequestID
,
field
.
TypeString
,
value
)
_node
.
RequestID
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
Path
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldPath
,
field
.
TypeString
,
value
)
_node
.
Path
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
Method
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldMethod
,
field
.
TypeString
,
value
)
_node
.
Method
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
IPAddress
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldIPAddress
,
field
.
TypeString
,
value
)
_node
.
IPAddress
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
RequestBody
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldRequestBody
,
field
.
TypeString
,
value
)
_node
.
RequestBody
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
ResponseBody
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldResponseBody
,
field
.
TypeString
,
value
)
_node
.
ResponseBody
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
NfsFilePath
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldNfsFilePath
,
field
.
TypeString
,
value
)
_node
.
NfsFilePath
=
&
value
}
if
value
,
ok
:=
_c
.
mutation
.
CreatedAt
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldCreatedAt
,
field
.
TypeTime
,
value
)
_node
.
CreatedAt
=
value
}
return
_node
,
_spec
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.RequestCaptureLog.Create().
// SetAPIKeyID(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.RequestCaptureLogUpsert) {
// SetAPIKeyID(v+v).
// }).
// Exec(ctx)
func
(
_c
*
RequestCaptureLogCreate
)
OnConflict
(
opts
...
sql
.
ConflictOption
)
*
RequestCaptureLogUpsertOne
{
_c
.
conflict
=
opts
return
&
RequestCaptureLogUpsertOne
{
create
:
_c
,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.RequestCaptureLog.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func
(
_c
*
RequestCaptureLogCreate
)
OnConflictColumns
(
columns
...
string
)
*
RequestCaptureLogUpsertOne
{
_c
.
conflict
=
append
(
_c
.
conflict
,
sql
.
ConflictColumns
(
columns
...
))
return
&
RequestCaptureLogUpsertOne
{
create
:
_c
,
}
}
type
(
// RequestCaptureLogUpsertOne is the builder for "upsert"-ing
// one RequestCaptureLog node.
RequestCaptureLogUpsertOne
struct
{
create
*
RequestCaptureLogCreate
}
// RequestCaptureLogUpsert is the "OnConflict" setter.
RequestCaptureLogUpsert
struct
{
*
sql
.
UpdateSet
}
)
// SetAPIKeyID sets the "api_key_id" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldAPIKeyID
,
v
)
return
u
}
// UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateAPIKeyID
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldAPIKeyID
)
return
u
}
// AddAPIKeyID adds v to the "api_key_id" field.
func
(
u
*
RequestCaptureLogUpsert
)
AddAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpsert
{
u
.
Add
(
requestcapturelog
.
FieldAPIKeyID
,
v
)
return
u
}
// SetUserID sets the "user_id" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetUserID
(
v
int64
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldUserID
,
v
)
return
u
}
// UpdateUserID sets the "user_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateUserID
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldUserID
)
return
u
}
// AddUserID adds v to the "user_id" field.
func
(
u
*
RequestCaptureLogUpsert
)
AddUserID
(
v
int64
)
*
RequestCaptureLogUpsert
{
u
.
Add
(
requestcapturelog
.
FieldUserID
,
v
)
return
u
}
// SetRequestID sets the "request_id" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetRequestID
(
v
string
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldRequestID
,
v
)
return
u
}
// UpdateRequestID sets the "request_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateRequestID
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldRequestID
)
return
u
}
// ClearRequestID clears the value of the "request_id" field.
func
(
u
*
RequestCaptureLogUpsert
)
ClearRequestID
()
*
RequestCaptureLogUpsert
{
u
.
SetNull
(
requestcapturelog
.
FieldRequestID
)
return
u
}
// SetPath sets the "path" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetPath
(
v
string
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldPath
,
v
)
return
u
}
// UpdatePath sets the "path" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdatePath
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldPath
)
return
u
}
// ClearPath clears the value of the "path" field.
func
(
u
*
RequestCaptureLogUpsert
)
ClearPath
()
*
RequestCaptureLogUpsert
{
u
.
SetNull
(
requestcapturelog
.
FieldPath
)
return
u
}
// SetMethod sets the "method" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetMethod
(
v
string
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldMethod
,
v
)
return
u
}
// UpdateMethod sets the "method" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateMethod
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldMethod
)
return
u
}
// ClearMethod clears the value of the "method" field.
func
(
u
*
RequestCaptureLogUpsert
)
ClearMethod
()
*
RequestCaptureLogUpsert
{
u
.
SetNull
(
requestcapturelog
.
FieldMethod
)
return
u
}
// SetIPAddress sets the "ip_address" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetIPAddress
(
v
string
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldIPAddress
,
v
)
return
u
}
// UpdateIPAddress sets the "ip_address" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateIPAddress
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldIPAddress
)
return
u
}
// ClearIPAddress clears the value of the "ip_address" field.
func
(
u
*
RequestCaptureLogUpsert
)
ClearIPAddress
()
*
RequestCaptureLogUpsert
{
u
.
SetNull
(
requestcapturelog
.
FieldIPAddress
)
return
u
}
// SetRequestBody sets the "request_body" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetRequestBody
(
v
string
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldRequestBody
,
v
)
return
u
}
// UpdateRequestBody sets the "request_body" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateRequestBody
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldRequestBody
)
return
u
}
// ClearRequestBody clears the value of the "request_body" field.
func
(
u
*
RequestCaptureLogUpsert
)
ClearRequestBody
()
*
RequestCaptureLogUpsert
{
u
.
SetNull
(
requestcapturelog
.
FieldRequestBody
)
return
u
}
// SetResponseBody sets the "response_body" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetResponseBody
(
v
string
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldResponseBody
,
v
)
return
u
}
// UpdateResponseBody sets the "response_body" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateResponseBody
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldResponseBody
)
return
u
}
// ClearResponseBody clears the value of the "response_body" field.
func
(
u
*
RequestCaptureLogUpsert
)
ClearResponseBody
()
*
RequestCaptureLogUpsert
{
u
.
SetNull
(
requestcapturelog
.
FieldResponseBody
)
return
u
}
// SetNfsFilePath sets the "nfs_file_path" field.
func
(
u
*
RequestCaptureLogUpsert
)
SetNfsFilePath
(
v
string
)
*
RequestCaptureLogUpsert
{
u
.
Set
(
requestcapturelog
.
FieldNfsFilePath
,
v
)
return
u
}
// UpdateNfsFilePath sets the "nfs_file_path" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsert
)
UpdateNfsFilePath
()
*
RequestCaptureLogUpsert
{
u
.
SetExcluded
(
requestcapturelog
.
FieldNfsFilePath
)
return
u
}
// ClearNfsFilePath clears the value of the "nfs_file_path" field.
func
(
u
*
RequestCaptureLogUpsert
)
ClearNfsFilePath
()
*
RequestCaptureLogUpsert
{
u
.
SetNull
(
requestcapturelog
.
FieldNfsFilePath
)
return
u
}
// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
// client.RequestCaptureLog.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateNewValues
()
*
RequestCaptureLogUpsertOne
{
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
(
requestcapturelog
.
FieldCreatedAt
)
}
}))
return
u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.RequestCaptureLog.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func
(
u
*
RequestCaptureLogUpsertOne
)
Ignore
()
*
RequestCaptureLogUpsertOne
{
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
*
RequestCaptureLogUpsertOne
)
DoNothing
()
*
RequestCaptureLogUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
DoNothing
())
return
u
}
// Update allows overriding fields `UPDATE` values. See the RequestCaptureLogCreate.OnConflict
// documentation for more info.
func
(
u
*
RequestCaptureLogUpsertOne
)
Update
(
set
func
(
*
RequestCaptureLogUpsert
))
*
RequestCaptureLogUpsertOne
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
update
*
sql
.
UpdateSet
)
{
set
(
&
RequestCaptureLogUpsert
{
UpdateSet
:
update
})
}))
return
u
}
// SetAPIKeyID sets the "api_key_id" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetAPIKeyID
(
v
)
})
}
// AddAPIKeyID adds v to the "api_key_id" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
AddAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
AddAPIKeyID
(
v
)
})
}
// UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateAPIKeyID
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateAPIKeyID
()
})
}
// SetUserID sets the "user_id" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetUserID
(
v
int64
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetUserID
(
v
)
})
}
// AddUserID adds v to the "user_id" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
AddUserID
(
v
int64
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
AddUserID
(
v
)
})
}
// UpdateUserID sets the "user_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateUserID
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateUserID
()
})
}
// SetRequestID sets the "request_id" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetRequestID
(
v
string
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetRequestID
(
v
)
})
}
// UpdateRequestID sets the "request_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateRequestID
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateRequestID
()
})
}
// ClearRequestID clears the value of the "request_id" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
ClearRequestID
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearRequestID
()
})
}
// SetPath sets the "path" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetPath
(
v
string
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetPath
(
v
)
})
}
// UpdatePath sets the "path" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdatePath
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdatePath
()
})
}
// ClearPath clears the value of the "path" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
ClearPath
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearPath
()
})
}
// SetMethod sets the "method" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetMethod
(
v
string
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetMethod
(
v
)
})
}
// UpdateMethod sets the "method" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateMethod
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateMethod
()
})
}
// ClearMethod clears the value of the "method" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
ClearMethod
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearMethod
()
})
}
// SetIPAddress sets the "ip_address" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetIPAddress
(
v
string
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetIPAddress
(
v
)
})
}
// UpdateIPAddress sets the "ip_address" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateIPAddress
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateIPAddress
()
})
}
// ClearIPAddress clears the value of the "ip_address" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
ClearIPAddress
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearIPAddress
()
})
}
// SetRequestBody sets the "request_body" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetRequestBody
(
v
string
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetRequestBody
(
v
)
})
}
// UpdateRequestBody sets the "request_body" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateRequestBody
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateRequestBody
()
})
}
// ClearRequestBody clears the value of the "request_body" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
ClearRequestBody
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearRequestBody
()
})
}
// SetResponseBody sets the "response_body" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetResponseBody
(
v
string
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetResponseBody
(
v
)
})
}
// UpdateResponseBody sets the "response_body" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateResponseBody
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateResponseBody
()
})
}
// ClearResponseBody clears the value of the "response_body" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
ClearResponseBody
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearResponseBody
()
})
}
// SetNfsFilePath sets the "nfs_file_path" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
SetNfsFilePath
(
v
string
)
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetNfsFilePath
(
v
)
})
}
// UpdateNfsFilePath sets the "nfs_file_path" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertOne
)
UpdateNfsFilePath
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateNfsFilePath
()
})
}
// ClearNfsFilePath clears the value of the "nfs_file_path" field.
func
(
u
*
RequestCaptureLogUpsertOne
)
ClearNfsFilePath
()
*
RequestCaptureLogUpsertOne
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearNfsFilePath
()
})
}
// Exec executes the query.
func
(
u
*
RequestCaptureLogUpsertOne
)
Exec
(
ctx
context
.
Context
)
error
{
if
len
(
u
.
create
.
conflict
)
==
0
{
return
errors
.
New
(
"ent: missing options for RequestCaptureLogCreate.OnConflict"
)
}
return
u
.
create
.
Exec
(
ctx
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
u
*
RequestCaptureLogUpsertOne
)
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
*
RequestCaptureLogUpsertOne
)
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
*
RequestCaptureLogUpsertOne
)
IDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
u
.
ID
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
id
}
// RequestCaptureLogCreateBulk is the builder for creating many RequestCaptureLog entities in bulk.
type
RequestCaptureLogCreateBulk
struct
{
config
err
error
builders
[]
*
RequestCaptureLogCreate
conflict
[]
sql
.
ConflictOption
}
// Save creates the RequestCaptureLog entities in the database.
func
(
_c
*
RequestCaptureLogCreateBulk
)
Save
(
ctx
context
.
Context
)
([]
*
RequestCaptureLog
,
error
)
{
if
_c
.
err
!=
nil
{
return
nil
,
_c
.
err
}
specs
:=
make
([]
*
sqlgraph
.
CreateSpec
,
len
(
_c
.
builders
))
nodes
:=
make
([]
*
RequestCaptureLog
,
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
.
(
*
RequestCaptureLogMutation
)
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
*
RequestCaptureLogCreateBulk
)
SaveX
(
ctx
context
.
Context
)
[]
*
RequestCaptureLog
{
v
,
err
:=
_c
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
v
}
// Exec executes the query.
func
(
_c
*
RequestCaptureLogCreateBulk
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_c
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_c
*
RequestCaptureLogCreateBulk
)
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.RequestCaptureLog.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.RequestCaptureLogUpsert) {
// SetAPIKeyID(v+v).
// }).
// Exec(ctx)
func
(
_c
*
RequestCaptureLogCreateBulk
)
OnConflict
(
opts
...
sql
.
ConflictOption
)
*
RequestCaptureLogUpsertBulk
{
_c
.
conflict
=
opts
return
&
RequestCaptureLogUpsertBulk
{
create
:
_c
,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.RequestCaptureLog.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func
(
_c
*
RequestCaptureLogCreateBulk
)
OnConflictColumns
(
columns
...
string
)
*
RequestCaptureLogUpsertBulk
{
_c
.
conflict
=
append
(
_c
.
conflict
,
sql
.
ConflictColumns
(
columns
...
))
return
&
RequestCaptureLogUpsertBulk
{
create
:
_c
,
}
}
// RequestCaptureLogUpsertBulk is the builder for "upsert"-ing
// a bulk of RequestCaptureLog nodes.
type
RequestCaptureLogUpsertBulk
struct
{
create
*
RequestCaptureLogCreateBulk
}
// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
// client.RequestCaptureLog.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateNewValues
()
*
RequestCaptureLogUpsertBulk
{
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
(
requestcapturelog
.
FieldCreatedAt
)
}
}
}))
return
u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.RequestCaptureLog.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func
(
u
*
RequestCaptureLogUpsertBulk
)
Ignore
()
*
RequestCaptureLogUpsertBulk
{
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
*
RequestCaptureLogUpsertBulk
)
DoNothing
()
*
RequestCaptureLogUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
DoNothing
())
return
u
}
// Update allows overriding fields `UPDATE` values. See the RequestCaptureLogCreateBulk.OnConflict
// documentation for more info.
func
(
u
*
RequestCaptureLogUpsertBulk
)
Update
(
set
func
(
*
RequestCaptureLogUpsert
))
*
RequestCaptureLogUpsertBulk
{
u
.
create
.
conflict
=
append
(
u
.
create
.
conflict
,
sql
.
ResolveWith
(
func
(
update
*
sql
.
UpdateSet
)
{
set
(
&
RequestCaptureLogUpsert
{
UpdateSet
:
update
})
}))
return
u
}
// SetAPIKeyID sets the "api_key_id" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetAPIKeyID
(
v
)
})
}
// AddAPIKeyID adds v to the "api_key_id" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
AddAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
AddAPIKeyID
(
v
)
})
}
// UpdateAPIKeyID sets the "api_key_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateAPIKeyID
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateAPIKeyID
()
})
}
// SetUserID sets the "user_id" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetUserID
(
v
int64
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetUserID
(
v
)
})
}
// AddUserID adds v to the "user_id" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
AddUserID
(
v
int64
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
AddUserID
(
v
)
})
}
// UpdateUserID sets the "user_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateUserID
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateUserID
()
})
}
// SetRequestID sets the "request_id" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetRequestID
(
v
string
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetRequestID
(
v
)
})
}
// UpdateRequestID sets the "request_id" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateRequestID
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateRequestID
()
})
}
// ClearRequestID clears the value of the "request_id" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ClearRequestID
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearRequestID
()
})
}
// SetPath sets the "path" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetPath
(
v
string
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetPath
(
v
)
})
}
// UpdatePath sets the "path" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdatePath
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdatePath
()
})
}
// ClearPath clears the value of the "path" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ClearPath
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearPath
()
})
}
// SetMethod sets the "method" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetMethod
(
v
string
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetMethod
(
v
)
})
}
// UpdateMethod sets the "method" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateMethod
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateMethod
()
})
}
// ClearMethod clears the value of the "method" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ClearMethod
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearMethod
()
})
}
// SetIPAddress sets the "ip_address" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetIPAddress
(
v
string
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetIPAddress
(
v
)
})
}
// UpdateIPAddress sets the "ip_address" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateIPAddress
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateIPAddress
()
})
}
// ClearIPAddress clears the value of the "ip_address" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ClearIPAddress
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearIPAddress
()
})
}
// SetRequestBody sets the "request_body" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetRequestBody
(
v
string
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetRequestBody
(
v
)
})
}
// UpdateRequestBody sets the "request_body" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateRequestBody
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateRequestBody
()
})
}
// ClearRequestBody clears the value of the "request_body" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ClearRequestBody
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearRequestBody
()
})
}
// SetResponseBody sets the "response_body" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetResponseBody
(
v
string
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetResponseBody
(
v
)
})
}
// UpdateResponseBody sets the "response_body" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateResponseBody
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateResponseBody
()
})
}
// ClearResponseBody clears the value of the "response_body" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ClearResponseBody
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearResponseBody
()
})
}
// SetNfsFilePath sets the "nfs_file_path" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
SetNfsFilePath
(
v
string
)
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
SetNfsFilePath
(
v
)
})
}
// UpdateNfsFilePath sets the "nfs_file_path" field to the value that was provided on create.
func
(
u
*
RequestCaptureLogUpsertBulk
)
UpdateNfsFilePath
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
UpdateNfsFilePath
()
})
}
// ClearNfsFilePath clears the value of the "nfs_file_path" field.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ClearNfsFilePath
()
*
RequestCaptureLogUpsertBulk
{
return
u
.
Update
(
func
(
s
*
RequestCaptureLogUpsert
)
{
s
.
ClearNfsFilePath
()
})
}
// Exec executes the query.
func
(
u
*
RequestCaptureLogUpsertBulk
)
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 RequestCaptureLogCreateBulk instead"
,
i
)
}
}
if
len
(
u
.
create
.
conflict
)
==
0
{
return
errors
.
New
(
"ent: missing options for RequestCaptureLogCreateBulk.OnConflict"
)
}
return
u
.
create
.
Exec
(
ctx
)
}
// ExecX is like Exec, but panics if an error occurs.
func
(
u
*
RequestCaptureLogUpsertBulk
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
u
.
create
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
backend/ent/requestcapturelog_delete.go
0 → 100644
View file @
994da655
// 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/predicate"
"github.com/Wei-Shaw/sub2api/ent/requestcapturelog"
)
// RequestCaptureLogDelete is the builder for deleting a RequestCaptureLog entity.
type
RequestCaptureLogDelete
struct
{
config
hooks
[]
Hook
mutation
*
RequestCaptureLogMutation
}
// Where appends a list predicates to the RequestCaptureLogDelete builder.
func
(
_d
*
RequestCaptureLogDelete
)
Where
(
ps
...
predicate
.
RequestCaptureLog
)
*
RequestCaptureLogDelete
{
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func
(
_d
*
RequestCaptureLogDelete
)
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
*
RequestCaptureLogDelete
)
ExecX
(
ctx
context
.
Context
)
int
{
n
,
err
:=
_d
.
Exec
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
n
}
func
(
_d
*
RequestCaptureLogDelete
)
sqlExec
(
ctx
context
.
Context
)
(
int
,
error
)
{
_spec
:=
sqlgraph
.
NewDeleteSpec
(
requestcapturelog
.
Table
,
sqlgraph
.
NewFieldSpec
(
requestcapturelog
.
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
}
// RequestCaptureLogDeleteOne is the builder for deleting a single RequestCaptureLog entity.
type
RequestCaptureLogDeleteOne
struct
{
_d
*
RequestCaptureLogDelete
}
// Where appends a list predicates to the RequestCaptureLogDelete builder.
func
(
_d
*
RequestCaptureLogDeleteOne
)
Where
(
ps
...
predicate
.
RequestCaptureLog
)
*
RequestCaptureLogDeleteOne
{
_d
.
_d
.
mutation
.
Where
(
ps
...
)
return
_d
}
// Exec executes the deletion query.
func
(
_d
*
RequestCaptureLogDeleteOne
)
Exec
(
ctx
context
.
Context
)
error
{
n
,
err
:=
_d
.
_d
.
Exec
(
ctx
)
switch
{
case
err
!=
nil
:
return
err
case
n
==
0
:
return
&
NotFoundError
{
requestcapturelog
.
Label
}
default
:
return
nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_d
*
RequestCaptureLogDeleteOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_d
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
backend/ent/requestcapturelog_query.go
0 → 100644
View file @
994da655
// 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/predicate"
"github.com/Wei-Shaw/sub2api/ent/requestcapturelog"
)
// RequestCaptureLogQuery is the builder for querying RequestCaptureLog entities.
type
RequestCaptureLogQuery
struct
{
config
ctx
*
QueryContext
order
[]
requestcapturelog
.
OrderOption
inters
[]
Interceptor
predicates
[]
predicate
.
RequestCaptureLog
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 RequestCaptureLogQuery builder.
func
(
_q
*
RequestCaptureLogQuery
)
Where
(
ps
...
predicate
.
RequestCaptureLog
)
*
RequestCaptureLogQuery
{
_q
.
predicates
=
append
(
_q
.
predicates
,
ps
...
)
return
_q
}
// Limit the number of records to be returned by this query.
func
(
_q
*
RequestCaptureLogQuery
)
Limit
(
limit
int
)
*
RequestCaptureLogQuery
{
_q
.
ctx
.
Limit
=
&
limit
return
_q
}
// Offset to start from.
func
(
_q
*
RequestCaptureLogQuery
)
Offset
(
offset
int
)
*
RequestCaptureLogQuery
{
_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
*
RequestCaptureLogQuery
)
Unique
(
unique
bool
)
*
RequestCaptureLogQuery
{
_q
.
ctx
.
Unique
=
&
unique
return
_q
}
// Order specifies how the records should be ordered.
func
(
_q
*
RequestCaptureLogQuery
)
Order
(
o
...
requestcapturelog
.
OrderOption
)
*
RequestCaptureLogQuery
{
_q
.
order
=
append
(
_q
.
order
,
o
...
)
return
_q
}
// First returns the first RequestCaptureLog entity from the query.
// Returns a *NotFoundError when no RequestCaptureLog was found.
func
(
_q
*
RequestCaptureLogQuery
)
First
(
ctx
context
.
Context
)
(
*
RequestCaptureLog
,
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
{
requestcapturelog
.
Label
}
}
return
nodes
[
0
],
nil
}
// FirstX is like First, but panics if an error occurs.
func
(
_q
*
RequestCaptureLogQuery
)
FirstX
(
ctx
context
.
Context
)
*
RequestCaptureLog
{
node
,
err
:=
_q
.
First
(
ctx
)
if
err
!=
nil
&&
!
IsNotFound
(
err
)
{
panic
(
err
)
}
return
node
}
// FirstID returns the first RequestCaptureLog ID from the query.
// Returns a *NotFoundError when no RequestCaptureLog ID was found.
func
(
_q
*
RequestCaptureLogQuery
)
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
{
requestcapturelog
.
Label
}
return
}
return
ids
[
0
],
nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func
(
_q
*
RequestCaptureLogQuery
)
FirstIDX
(
ctx
context
.
Context
)
int64
{
id
,
err
:=
_q
.
FirstID
(
ctx
)
if
err
!=
nil
&&
!
IsNotFound
(
err
)
{
panic
(
err
)
}
return
id
}
// Only returns a single RequestCaptureLog entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one RequestCaptureLog entity is found.
// Returns a *NotFoundError when no RequestCaptureLog entities are found.
func
(
_q
*
RequestCaptureLogQuery
)
Only
(
ctx
context
.
Context
)
(
*
RequestCaptureLog
,
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
{
requestcapturelog
.
Label
}
default
:
return
nil
,
&
NotSingularError
{
requestcapturelog
.
Label
}
}
}
// OnlyX is like Only, but panics if an error occurs.
func
(
_q
*
RequestCaptureLogQuery
)
OnlyX
(
ctx
context
.
Context
)
*
RequestCaptureLog
{
node
,
err
:=
_q
.
Only
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
node
}
// OnlyID is like Only, but returns the only RequestCaptureLog ID in the query.
// Returns a *NotSingularError when more than one RequestCaptureLog ID is found.
// Returns a *NotFoundError when no entities are found.
func
(
_q
*
RequestCaptureLogQuery
)
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
{
requestcapturelog
.
Label
}
default
:
err
=
&
NotSingularError
{
requestcapturelog
.
Label
}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func
(
_q
*
RequestCaptureLogQuery
)
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 RequestCaptureLogs.
func
(
_q
*
RequestCaptureLogQuery
)
All
(
ctx
context
.
Context
)
([]
*
RequestCaptureLog
,
error
)
{
ctx
=
setContextOp
(
ctx
,
_q
.
ctx
,
ent
.
OpQueryAll
)
if
err
:=
_q
.
prepareQuery
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
qr
:=
querierAll
[[]
*
RequestCaptureLog
,
*
RequestCaptureLogQuery
]()
return
withInterceptors
[[]
*
RequestCaptureLog
](
ctx
,
_q
,
qr
,
_q
.
inters
)
}
// AllX is like All, but panics if an error occurs.
func
(
_q
*
RequestCaptureLogQuery
)
AllX
(
ctx
context
.
Context
)
[]
*
RequestCaptureLog
{
nodes
,
err
:=
_q
.
All
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
nodes
}
// IDs executes the query and returns a list of RequestCaptureLog IDs.
func
(
_q
*
RequestCaptureLogQuery
)
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
(
requestcapturelog
.
FieldID
)
.
Scan
(
ctx
,
&
ids
);
err
!=
nil
{
return
nil
,
err
}
return
ids
,
nil
}
// IDsX is like IDs, but panics if an error occurs.
func
(
_q
*
RequestCaptureLogQuery
)
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
*
RequestCaptureLogQuery
)
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
[
*
RequestCaptureLogQuery
](),
_q
.
inters
)
}
// CountX is like Count, but panics if an error occurs.
func
(
_q
*
RequestCaptureLogQuery
)
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
*
RequestCaptureLogQuery
)
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
*
RequestCaptureLogQuery
)
ExistX
(
ctx
context
.
Context
)
bool
{
exist
,
err
:=
_q
.
Exist
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
exist
}
// Clone returns a duplicate of the RequestCaptureLogQuery 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
*
RequestCaptureLogQuery
)
Clone
()
*
RequestCaptureLogQuery
{
if
_q
==
nil
{
return
nil
}
return
&
RequestCaptureLogQuery
{
config
:
_q
.
config
,
ctx
:
_q
.
ctx
.
Clone
(),
order
:
append
([]
requestcapturelog
.
OrderOption
{},
_q
.
order
...
),
inters
:
append
([]
Interceptor
{},
_q
.
inters
...
),
predicates
:
append
([]
predicate
.
RequestCaptureLog
{},
_q
.
predicates
...
),
// clone intermediate query.
sql
:
_q
.
sql
.
Clone
(),
path
:
_q
.
path
,
}
}
// 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 {
// APIKeyID int64 `json:"api_key_id,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.RequestCaptureLog.Query().
// GroupBy(requestcapturelog.FieldAPIKeyID).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func
(
_q
*
RequestCaptureLogQuery
)
GroupBy
(
field
string
,
fields
...
string
)
*
RequestCaptureLogGroupBy
{
_q
.
ctx
.
Fields
=
append
([]
string
{
field
},
fields
...
)
grbuild
:=
&
RequestCaptureLogGroupBy
{
build
:
_q
}
grbuild
.
flds
=
&
_q
.
ctx
.
Fields
grbuild
.
label
=
requestcapturelog
.
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 {
// APIKeyID int64 `json:"api_key_id,omitempty"`
// }
//
// client.RequestCaptureLog.Query().
// Select(requestcapturelog.FieldAPIKeyID).
// Scan(ctx, &v)
func
(
_q
*
RequestCaptureLogQuery
)
Select
(
fields
...
string
)
*
RequestCaptureLogSelect
{
_q
.
ctx
.
Fields
=
append
(
_q
.
ctx
.
Fields
,
fields
...
)
sbuild
:=
&
RequestCaptureLogSelect
{
RequestCaptureLogQuery
:
_q
}
sbuild
.
label
=
requestcapturelog
.
Label
sbuild
.
flds
,
sbuild
.
scan
=
&
_q
.
ctx
.
Fields
,
sbuild
.
Scan
return
sbuild
}
// Aggregate returns a RequestCaptureLogSelect configured with the given aggregations.
func
(
_q
*
RequestCaptureLogQuery
)
Aggregate
(
fns
...
AggregateFunc
)
*
RequestCaptureLogSelect
{
return
_q
.
Select
()
.
Aggregate
(
fns
...
)
}
func
(
_q
*
RequestCaptureLogQuery
)
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
!
requestcapturelog
.
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
*
RequestCaptureLogQuery
)
sqlAll
(
ctx
context
.
Context
,
hooks
...
queryHook
)
([]
*
RequestCaptureLog
,
error
)
{
var
(
nodes
=
[]
*
RequestCaptureLog
{}
_spec
=
_q
.
querySpec
()
)
_spec
.
ScanValues
=
func
(
columns
[]
string
)
([]
any
,
error
)
{
return
(
*
RequestCaptureLog
)
.
scanValues
(
nil
,
columns
)
}
_spec
.
Assign
=
func
(
columns
[]
string
,
values
[]
any
)
error
{
node
:=
&
RequestCaptureLog
{
config
:
_q
.
config
}
nodes
=
append
(
nodes
,
node
)
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
}
return
nodes
,
nil
}
func
(
_q
*
RequestCaptureLogQuery
)
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
*
RequestCaptureLogQuery
)
querySpec
()
*
sqlgraph
.
QuerySpec
{
_spec
:=
sqlgraph
.
NewQuerySpec
(
requestcapturelog
.
Table
,
requestcapturelog
.
Columns
,
sqlgraph
.
NewFieldSpec
(
requestcapturelog
.
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
,
requestcapturelog
.
FieldID
)
for
i
:=
range
fields
{
if
fields
[
i
]
!=
requestcapturelog
.
FieldID
{
_spec
.
Node
.
Columns
=
append
(
_spec
.
Node
.
Columns
,
fields
[
i
])
}
}
}
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
*
RequestCaptureLogQuery
)
sqlQuery
(
ctx
context
.
Context
)
*
sql
.
Selector
{
builder
:=
sql
.
Dialect
(
_q
.
driver
.
Dialect
())
t1
:=
builder
.
Table
(
requestcapturelog
.
Table
)
columns
:=
_q
.
ctx
.
Fields
if
len
(
columns
)
==
0
{
columns
=
requestcapturelog
.
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
*
RequestCaptureLogQuery
)
ForUpdate
(
opts
...
sql
.
LockOption
)
*
RequestCaptureLogQuery
{
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
*
RequestCaptureLogQuery
)
ForShare
(
opts
...
sql
.
LockOption
)
*
RequestCaptureLogQuery
{
if
_q
.
driver
.
Dialect
()
==
dialect
.
Postgres
{
_q
.
Unique
(
false
)
}
_q
.
modifiers
=
append
(
_q
.
modifiers
,
func
(
s
*
sql
.
Selector
)
{
s
.
ForShare
(
opts
...
)
})
return
_q
}
// RequestCaptureLogGroupBy is the group-by builder for RequestCaptureLog entities.
type
RequestCaptureLogGroupBy
struct
{
selector
build
*
RequestCaptureLogQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func
(
_g
*
RequestCaptureLogGroupBy
)
Aggregate
(
fns
...
AggregateFunc
)
*
RequestCaptureLogGroupBy
{
_g
.
fns
=
append
(
_g
.
fns
,
fns
...
)
return
_g
}
// Scan applies the selector query and scans the result into the given value.
func
(
_g
*
RequestCaptureLogGroupBy
)
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
[
*
RequestCaptureLogQuery
,
*
RequestCaptureLogGroupBy
](
ctx
,
_g
.
build
,
_g
,
_g
.
build
.
inters
,
v
)
}
func
(
_g
*
RequestCaptureLogGroupBy
)
sqlScan
(
ctx
context
.
Context
,
root
*
RequestCaptureLogQuery
,
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
)
}
// RequestCaptureLogSelect is the builder for selecting fields of RequestCaptureLog entities.
type
RequestCaptureLogSelect
struct
{
*
RequestCaptureLogQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func
(
_s
*
RequestCaptureLogSelect
)
Aggregate
(
fns
...
AggregateFunc
)
*
RequestCaptureLogSelect
{
_s
.
fns
=
append
(
_s
.
fns
,
fns
...
)
return
_s
}
// Scan applies the selector query and scans the result into the given value.
func
(
_s
*
RequestCaptureLogSelect
)
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
[
*
RequestCaptureLogQuery
,
*
RequestCaptureLogSelect
](
ctx
,
_s
.
RequestCaptureLogQuery
,
_s
,
_s
.
inters
,
v
)
}
func
(
_s
*
RequestCaptureLogSelect
)
sqlScan
(
ctx
context
.
Context
,
root
*
RequestCaptureLogQuery
,
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/requestcapturelog_update.go
0 → 100644
View file @
994da655
// Code generated by ent, DO NOT EDIT.
package
ent
import
(
"context"
"errors"
"fmt"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/predicate"
"github.com/Wei-Shaw/sub2api/ent/requestcapturelog"
)
// RequestCaptureLogUpdate is the builder for updating RequestCaptureLog entities.
type
RequestCaptureLogUpdate
struct
{
config
hooks
[]
Hook
mutation
*
RequestCaptureLogMutation
}
// Where appends a list predicates to the RequestCaptureLogUpdate builder.
func
(
_u
*
RequestCaptureLogUpdate
)
Where
(
ps
...
predicate
.
RequestCaptureLog
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
Where
(
ps
...
)
return
_u
}
// SetAPIKeyID sets the "api_key_id" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ResetAPIKeyID
()
_u
.
mutation
.
SetAPIKeyID
(
v
)
return
_u
}
// SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableAPIKeyID
(
v
*
int64
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetAPIKeyID
(
*
v
)
}
return
_u
}
// AddAPIKeyID adds value to the "api_key_id" field.
func
(
_u
*
RequestCaptureLogUpdate
)
AddAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
AddAPIKeyID
(
v
)
return
_u
}
// SetUserID sets the "user_id" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetUserID
(
v
int64
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ResetUserID
()
_u
.
mutation
.
SetUserID
(
v
)
return
_u
}
// SetNillableUserID sets the "user_id" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableUserID
(
v
*
int64
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetUserID
(
*
v
)
}
return
_u
}
// AddUserID adds value to the "user_id" field.
func
(
_u
*
RequestCaptureLogUpdate
)
AddUserID
(
v
int64
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
AddUserID
(
v
)
return
_u
}
// SetRequestID sets the "request_id" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetRequestID
(
v
string
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
SetRequestID
(
v
)
return
_u
}
// SetNillableRequestID sets the "request_id" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableRequestID
(
v
*
string
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetRequestID
(
*
v
)
}
return
_u
}
// ClearRequestID clears the value of the "request_id" field.
func
(
_u
*
RequestCaptureLogUpdate
)
ClearRequestID
()
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ClearRequestID
()
return
_u
}
// SetPath sets the "path" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetPath
(
v
string
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
SetPath
(
v
)
return
_u
}
// SetNillablePath sets the "path" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillablePath
(
v
*
string
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetPath
(
*
v
)
}
return
_u
}
// ClearPath clears the value of the "path" field.
func
(
_u
*
RequestCaptureLogUpdate
)
ClearPath
()
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ClearPath
()
return
_u
}
// SetMethod sets the "method" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetMethod
(
v
string
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
SetMethod
(
v
)
return
_u
}
// SetNillableMethod sets the "method" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableMethod
(
v
*
string
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetMethod
(
*
v
)
}
return
_u
}
// ClearMethod clears the value of the "method" field.
func
(
_u
*
RequestCaptureLogUpdate
)
ClearMethod
()
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ClearMethod
()
return
_u
}
// SetIPAddress sets the "ip_address" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetIPAddress
(
v
string
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
SetIPAddress
(
v
)
return
_u
}
// SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableIPAddress
(
v
*
string
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetIPAddress
(
*
v
)
}
return
_u
}
// ClearIPAddress clears the value of the "ip_address" field.
func
(
_u
*
RequestCaptureLogUpdate
)
ClearIPAddress
()
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ClearIPAddress
()
return
_u
}
// SetRequestBody sets the "request_body" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetRequestBody
(
v
string
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
SetRequestBody
(
v
)
return
_u
}
// SetNillableRequestBody sets the "request_body" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableRequestBody
(
v
*
string
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetRequestBody
(
*
v
)
}
return
_u
}
// ClearRequestBody clears the value of the "request_body" field.
func
(
_u
*
RequestCaptureLogUpdate
)
ClearRequestBody
()
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ClearRequestBody
()
return
_u
}
// SetResponseBody sets the "response_body" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetResponseBody
(
v
string
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
SetResponseBody
(
v
)
return
_u
}
// SetNillableResponseBody sets the "response_body" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableResponseBody
(
v
*
string
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetResponseBody
(
*
v
)
}
return
_u
}
// ClearResponseBody clears the value of the "response_body" field.
func
(
_u
*
RequestCaptureLogUpdate
)
ClearResponseBody
()
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ClearResponseBody
()
return
_u
}
// SetNfsFilePath sets the "nfs_file_path" field.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNfsFilePath
(
v
string
)
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
SetNfsFilePath
(
v
)
return
_u
}
// SetNillableNfsFilePath sets the "nfs_file_path" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdate
)
SetNillableNfsFilePath
(
v
*
string
)
*
RequestCaptureLogUpdate
{
if
v
!=
nil
{
_u
.
SetNfsFilePath
(
*
v
)
}
return
_u
}
// ClearNfsFilePath clears the value of the "nfs_file_path" field.
func
(
_u
*
RequestCaptureLogUpdate
)
ClearNfsFilePath
()
*
RequestCaptureLogUpdate
{
_u
.
mutation
.
ClearNfsFilePath
()
return
_u
}
// Mutation returns the RequestCaptureLogMutation object of the builder.
func
(
_u
*
RequestCaptureLogUpdate
)
Mutation
()
*
RequestCaptureLogMutation
{
return
_u
.
mutation
}
// Save executes the query and returns the number of nodes affected by the update operation.
func
(
_u
*
RequestCaptureLogUpdate
)
Save
(
ctx
context
.
Context
)
(
int
,
error
)
{
return
withHooks
(
ctx
,
_u
.
sqlSave
,
_u
.
mutation
,
_u
.
hooks
)
}
// SaveX is like Save, but panics if an error occurs.
func
(
_u
*
RequestCaptureLogUpdate
)
SaveX
(
ctx
context
.
Context
)
int
{
affected
,
err
:=
_u
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
affected
}
// Exec executes the query.
func
(
_u
*
RequestCaptureLogUpdate
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_u
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_u
*
RequestCaptureLogUpdate
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_u
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_u
*
RequestCaptureLogUpdate
)
check
()
error
{
if
v
,
ok
:=
_u
.
mutation
.
RequestID
();
ok
{
if
err
:=
requestcapturelog
.
RequestIDValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"request_id"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.request_id": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Path
();
ok
{
if
err
:=
requestcapturelog
.
PathValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"path"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.path": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Method
();
ok
{
if
err
:=
requestcapturelog
.
MethodValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"method"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.method": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
IPAddress
();
ok
{
if
err
:=
requestcapturelog
.
IPAddressValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"ip_address"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.ip_address": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
NfsFilePath
();
ok
{
if
err
:=
requestcapturelog
.
NfsFilePathValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"nfs_file_path"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.nfs_file_path": %w`
,
err
)}
}
}
return
nil
}
func
(
_u
*
RequestCaptureLogUpdate
)
sqlSave
(
ctx
context
.
Context
)
(
_node
int
,
err
error
)
{
if
err
:=
_u
.
check
();
err
!=
nil
{
return
_node
,
err
}
_spec
:=
sqlgraph
.
NewUpdateSpec
(
requestcapturelog
.
Table
,
requestcapturelog
.
Columns
,
sqlgraph
.
NewFieldSpec
(
requestcapturelog
.
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
.
APIKeyID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldAPIKeyID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedAPIKeyID
();
ok
{
_spec
.
AddField
(
requestcapturelog
.
FieldAPIKeyID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
UserID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldUserID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedUserID
();
ok
{
_spec
.
AddField
(
requestcapturelog
.
FieldUserID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
RequestID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldRequestID
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
RequestIDCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldRequestID
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
Path
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldPath
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
PathCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldPath
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
Method
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldMethod
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
MethodCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldMethod
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
IPAddress
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldIPAddress
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
IPAddressCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldIPAddress
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
RequestBody
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldRequestBody
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
RequestBodyCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldRequestBody
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
ResponseBody
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldResponseBody
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
ResponseBodyCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldResponseBody
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
NfsFilePath
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldNfsFilePath
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
NfsFilePathCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldNfsFilePath
,
field
.
TypeString
)
}
if
_node
,
err
=
sqlgraph
.
UpdateNodes
(
ctx
,
_u
.
driver
,
_spec
);
err
!=
nil
{
if
_
,
ok
:=
err
.
(
*
sqlgraph
.
NotFoundError
);
ok
{
err
=
&
NotFoundError
{
requestcapturelog
.
Label
}
}
else
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
0
,
err
}
_u
.
mutation
.
done
=
true
return
_node
,
nil
}
// RequestCaptureLogUpdateOne is the builder for updating a single RequestCaptureLog entity.
type
RequestCaptureLogUpdateOne
struct
{
config
fields
[]
string
hooks
[]
Hook
mutation
*
RequestCaptureLogMutation
}
// SetAPIKeyID sets the "api_key_id" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ResetAPIKeyID
()
_u
.
mutation
.
SetAPIKeyID
(
v
)
return
_u
}
// SetNillableAPIKeyID sets the "api_key_id" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableAPIKeyID
(
v
*
int64
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetAPIKeyID
(
*
v
)
}
return
_u
}
// AddAPIKeyID adds value to the "api_key_id" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
AddAPIKeyID
(
v
int64
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
AddAPIKeyID
(
v
)
return
_u
}
// SetUserID sets the "user_id" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetUserID
(
v
int64
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ResetUserID
()
_u
.
mutation
.
SetUserID
(
v
)
return
_u
}
// SetNillableUserID sets the "user_id" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableUserID
(
v
*
int64
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetUserID
(
*
v
)
}
return
_u
}
// AddUserID adds value to the "user_id" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
AddUserID
(
v
int64
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
AddUserID
(
v
)
return
_u
}
// SetRequestID sets the "request_id" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetRequestID
(
v
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
SetRequestID
(
v
)
return
_u
}
// SetNillableRequestID sets the "request_id" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableRequestID
(
v
*
string
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetRequestID
(
*
v
)
}
return
_u
}
// ClearRequestID clears the value of the "request_id" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ClearRequestID
()
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ClearRequestID
()
return
_u
}
// SetPath sets the "path" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetPath
(
v
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
SetPath
(
v
)
return
_u
}
// SetNillablePath sets the "path" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillablePath
(
v
*
string
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetPath
(
*
v
)
}
return
_u
}
// ClearPath clears the value of the "path" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ClearPath
()
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ClearPath
()
return
_u
}
// SetMethod sets the "method" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetMethod
(
v
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
SetMethod
(
v
)
return
_u
}
// SetNillableMethod sets the "method" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableMethod
(
v
*
string
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetMethod
(
*
v
)
}
return
_u
}
// ClearMethod clears the value of the "method" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ClearMethod
()
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ClearMethod
()
return
_u
}
// SetIPAddress sets the "ip_address" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetIPAddress
(
v
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
SetIPAddress
(
v
)
return
_u
}
// SetNillableIPAddress sets the "ip_address" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableIPAddress
(
v
*
string
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetIPAddress
(
*
v
)
}
return
_u
}
// ClearIPAddress clears the value of the "ip_address" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ClearIPAddress
()
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ClearIPAddress
()
return
_u
}
// SetRequestBody sets the "request_body" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetRequestBody
(
v
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
SetRequestBody
(
v
)
return
_u
}
// SetNillableRequestBody sets the "request_body" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableRequestBody
(
v
*
string
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetRequestBody
(
*
v
)
}
return
_u
}
// ClearRequestBody clears the value of the "request_body" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ClearRequestBody
()
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ClearRequestBody
()
return
_u
}
// SetResponseBody sets the "response_body" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetResponseBody
(
v
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
SetResponseBody
(
v
)
return
_u
}
// SetNillableResponseBody sets the "response_body" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableResponseBody
(
v
*
string
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetResponseBody
(
*
v
)
}
return
_u
}
// ClearResponseBody clears the value of the "response_body" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ClearResponseBody
()
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ClearResponseBody
()
return
_u
}
// SetNfsFilePath sets the "nfs_file_path" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNfsFilePath
(
v
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
SetNfsFilePath
(
v
)
return
_u
}
// SetNillableNfsFilePath sets the "nfs_file_path" field if the given value is not nil.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SetNillableNfsFilePath
(
v
*
string
)
*
RequestCaptureLogUpdateOne
{
if
v
!=
nil
{
_u
.
SetNfsFilePath
(
*
v
)
}
return
_u
}
// ClearNfsFilePath clears the value of the "nfs_file_path" field.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ClearNfsFilePath
()
*
RequestCaptureLogUpdateOne
{
_u
.
mutation
.
ClearNfsFilePath
()
return
_u
}
// Mutation returns the RequestCaptureLogMutation object of the builder.
func
(
_u
*
RequestCaptureLogUpdateOne
)
Mutation
()
*
RequestCaptureLogMutation
{
return
_u
.
mutation
}
// Where appends a list predicates to the RequestCaptureLogUpdate builder.
func
(
_u
*
RequestCaptureLogUpdateOne
)
Where
(
ps
...
predicate
.
RequestCaptureLog
)
*
RequestCaptureLogUpdateOne
{
_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
*
RequestCaptureLogUpdateOne
)
Select
(
field
string
,
fields
...
string
)
*
RequestCaptureLogUpdateOne
{
_u
.
fields
=
append
([]
string
{
field
},
fields
...
)
return
_u
}
// Save executes the query and returns the updated RequestCaptureLog entity.
func
(
_u
*
RequestCaptureLogUpdateOne
)
Save
(
ctx
context
.
Context
)
(
*
RequestCaptureLog
,
error
)
{
return
withHooks
(
ctx
,
_u
.
sqlSave
,
_u
.
mutation
,
_u
.
hooks
)
}
// SaveX is like Save, but panics if an error occurs.
func
(
_u
*
RequestCaptureLogUpdateOne
)
SaveX
(
ctx
context
.
Context
)
*
RequestCaptureLog
{
node
,
err
:=
_u
.
Save
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
}
return
node
}
// Exec executes the query on the entity.
func
(
_u
*
RequestCaptureLogUpdateOne
)
Exec
(
ctx
context
.
Context
)
error
{
_
,
err
:=
_u
.
Save
(
ctx
)
return
err
}
// ExecX is like Exec, but panics if an error occurs.
func
(
_u
*
RequestCaptureLogUpdateOne
)
ExecX
(
ctx
context
.
Context
)
{
if
err
:=
_u
.
Exec
(
ctx
);
err
!=
nil
{
panic
(
err
)
}
}
// check runs all checks and user-defined validators on the builder.
func
(
_u
*
RequestCaptureLogUpdateOne
)
check
()
error
{
if
v
,
ok
:=
_u
.
mutation
.
RequestID
();
ok
{
if
err
:=
requestcapturelog
.
RequestIDValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"request_id"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.request_id": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Path
();
ok
{
if
err
:=
requestcapturelog
.
PathValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"path"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.path": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
Method
();
ok
{
if
err
:=
requestcapturelog
.
MethodValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"method"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.method": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
IPAddress
();
ok
{
if
err
:=
requestcapturelog
.
IPAddressValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"ip_address"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.ip_address": %w`
,
err
)}
}
}
if
v
,
ok
:=
_u
.
mutation
.
NfsFilePath
();
ok
{
if
err
:=
requestcapturelog
.
NfsFilePathValidator
(
v
);
err
!=
nil
{
return
&
ValidationError
{
Name
:
"nfs_file_path"
,
err
:
fmt
.
Errorf
(
`ent: validator failed for field "RequestCaptureLog.nfs_file_path": %w`
,
err
)}
}
}
return
nil
}
func
(
_u
*
RequestCaptureLogUpdateOne
)
sqlSave
(
ctx
context
.
Context
)
(
_node
*
RequestCaptureLog
,
err
error
)
{
if
err
:=
_u
.
check
();
err
!=
nil
{
return
_node
,
err
}
_spec
:=
sqlgraph
.
NewUpdateSpec
(
requestcapturelog
.
Table
,
requestcapturelog
.
Columns
,
sqlgraph
.
NewFieldSpec
(
requestcapturelog
.
FieldID
,
field
.
TypeInt64
))
id
,
ok
:=
_u
.
mutation
.
ID
()
if
!
ok
{
return
nil
,
&
ValidationError
{
Name
:
"id"
,
err
:
errors
.
New
(
`ent: missing "RequestCaptureLog.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
,
requestcapturelog
.
FieldID
)
for
_
,
f
:=
range
fields
{
if
!
requestcapturelog
.
ValidColumn
(
f
)
{
return
nil
,
&
ValidationError
{
Name
:
f
,
err
:
fmt
.
Errorf
(
"ent: invalid field %q for query"
,
f
)}
}
if
f
!=
requestcapturelog
.
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
.
APIKeyID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldAPIKeyID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedAPIKeyID
();
ok
{
_spec
.
AddField
(
requestcapturelog
.
FieldAPIKeyID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
UserID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldUserID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
AddedUserID
();
ok
{
_spec
.
AddField
(
requestcapturelog
.
FieldUserID
,
field
.
TypeInt64
,
value
)
}
if
value
,
ok
:=
_u
.
mutation
.
RequestID
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldRequestID
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
RequestIDCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldRequestID
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
Path
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldPath
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
PathCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldPath
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
Method
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldMethod
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
MethodCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldMethod
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
IPAddress
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldIPAddress
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
IPAddressCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldIPAddress
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
RequestBody
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldRequestBody
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
RequestBodyCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldRequestBody
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
ResponseBody
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldResponseBody
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
ResponseBodyCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldResponseBody
,
field
.
TypeString
)
}
if
value
,
ok
:=
_u
.
mutation
.
NfsFilePath
();
ok
{
_spec
.
SetField
(
requestcapturelog
.
FieldNfsFilePath
,
field
.
TypeString
,
value
)
}
if
_u
.
mutation
.
NfsFilePathCleared
()
{
_spec
.
ClearField
(
requestcapturelog
.
FieldNfsFilePath
,
field
.
TypeString
)
}
_node
=
&
RequestCaptureLog
{
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
{
requestcapturelog
.
Label
}
}
else
if
sqlgraph
.
IsConstraintError
(
err
)
{
err
=
&
ConstraintError
{
msg
:
err
.
Error
(),
wrap
:
err
}
}
return
nil
,
err
}
_u
.
mutation
.
done
=
true
return
_node
,
nil
}
Prev
1
2
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