Commit 8519a8eb authored by 陈曦's avatar 陈曦
Browse files

merge feature/follow_upstream

parents 994da655 c61a9d4b
......@@ -225,6 +225,26 @@ func (_c *PaymentOrderCreate) SetNillableProviderInstanceID(v *string) *PaymentO
return _c
}
// SetProviderKey sets the "provider_key" field.
func (_c *PaymentOrderCreate) SetProviderKey(v string) *PaymentOrderCreate {
_c.mutation.SetProviderKey(v)
return _c
}
// SetNillableProviderKey sets the "provider_key" field if the given value is not nil.
func (_c *PaymentOrderCreate) SetNillableProviderKey(v *string) *PaymentOrderCreate {
if v != nil {
_c.SetProviderKey(*v)
}
return _c
}
// SetProviderSnapshot sets the "provider_snapshot" field.
func (_c *PaymentOrderCreate) SetProviderSnapshot(v map[string]interface{}) *PaymentOrderCreate {
_c.mutation.SetProviderSnapshot(v)
return _c
}
// SetStatus sets the "status" field.
func (_c *PaymentOrderCreate) SetStatus(v string) *PaymentOrderCreate {
_c.mutation.SetStatus(v)
......@@ -602,6 +622,11 @@ func (_c *PaymentOrderCreate) check() error {
return &ValidationError{Name: "provider_instance_id", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.provider_instance_id": %w`, err)}
}
}
if v, ok := _c.mutation.ProviderKey(); ok {
if err := paymentorder.ProviderKeyValidator(v); err != nil {
return &ValidationError{Name: "provider_key", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.provider_key": %w`, err)}
}
}
if _, ok := _c.mutation.Status(); !ok {
return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "PaymentOrder.status"`)}
}
......@@ -748,6 +773,14 @@ func (_c *PaymentOrderCreate) createSpec() (*PaymentOrder, *sqlgraph.CreateSpec)
_spec.SetField(paymentorder.FieldProviderInstanceID, field.TypeString, value)
_node.ProviderInstanceID = &value
}
if value, ok := _c.mutation.ProviderKey(); ok {
_spec.SetField(paymentorder.FieldProviderKey, field.TypeString, value)
_node.ProviderKey = &value
}
if value, ok := _c.mutation.ProviderSnapshot(); ok {
_spec.SetField(paymentorder.FieldProviderSnapshot, field.TypeJSON, value)
_node.ProviderSnapshot = value
}
if value, ok := _c.mutation.Status(); ok {
_spec.SetField(paymentorder.FieldStatus, field.TypeString, value)
_node.Status = value
......@@ -1201,6 +1234,42 @@ func (u *PaymentOrderUpsert) ClearProviderInstanceID() *PaymentOrderUpsert {
return u
}
// SetProviderKey sets the "provider_key" field.
func (u *PaymentOrderUpsert) SetProviderKey(v string) *PaymentOrderUpsert {
u.Set(paymentorder.FieldProviderKey, v)
return u
}
// UpdateProviderKey sets the "provider_key" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateProviderKey() *PaymentOrderUpsert {
u.SetExcluded(paymentorder.FieldProviderKey)
return u
}
// ClearProviderKey clears the value of the "provider_key" field.
func (u *PaymentOrderUpsert) ClearProviderKey() *PaymentOrderUpsert {
u.SetNull(paymentorder.FieldProviderKey)
return u
}
// SetProviderSnapshot sets the "provider_snapshot" field.
func (u *PaymentOrderUpsert) SetProviderSnapshot(v map[string]interface{}) *PaymentOrderUpsert {
u.Set(paymentorder.FieldProviderSnapshot, v)
return u
}
// UpdateProviderSnapshot sets the "provider_snapshot" field to the value that was provided on create.
func (u *PaymentOrderUpsert) UpdateProviderSnapshot() *PaymentOrderUpsert {
u.SetExcluded(paymentorder.FieldProviderSnapshot)
return u
}
// ClearProviderSnapshot clears the value of the "provider_snapshot" field.
func (u *PaymentOrderUpsert) ClearProviderSnapshot() *PaymentOrderUpsert {
u.SetNull(paymentorder.FieldProviderSnapshot)
return u
}
// SetStatus sets the "status" field.
func (u *PaymentOrderUpsert) SetStatus(v string) *PaymentOrderUpsert {
u.Set(paymentorder.FieldStatus, v)
......@@ -1880,6 +1949,48 @@ func (u *PaymentOrderUpsertOne) ClearProviderInstanceID() *PaymentOrderUpsertOne
})
}
// SetProviderKey sets the "provider_key" field.
func (u *PaymentOrderUpsertOne) SetProviderKey(v string) *PaymentOrderUpsertOne {
return u.Update(func(s *PaymentOrderUpsert) {
s.SetProviderKey(v)
})
}
// UpdateProviderKey sets the "provider_key" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateProviderKey() *PaymentOrderUpsertOne {
return u.Update(func(s *PaymentOrderUpsert) {
s.UpdateProviderKey()
})
}
// ClearProviderKey clears the value of the "provider_key" field.
func (u *PaymentOrderUpsertOne) ClearProviderKey() *PaymentOrderUpsertOne {
return u.Update(func(s *PaymentOrderUpsert) {
s.ClearProviderKey()
})
}
// SetProviderSnapshot sets the "provider_snapshot" field.
func (u *PaymentOrderUpsertOne) SetProviderSnapshot(v map[string]interface{}) *PaymentOrderUpsertOne {
return u.Update(func(s *PaymentOrderUpsert) {
s.SetProviderSnapshot(v)
})
}
// UpdateProviderSnapshot sets the "provider_snapshot" field to the value that was provided on create.
func (u *PaymentOrderUpsertOne) UpdateProviderSnapshot() *PaymentOrderUpsertOne {
return u.Update(func(s *PaymentOrderUpsert) {
s.UpdateProviderSnapshot()
})
}
// ClearProviderSnapshot clears the value of the "provider_snapshot" field.
func (u *PaymentOrderUpsertOne) ClearProviderSnapshot() *PaymentOrderUpsertOne {
return u.Update(func(s *PaymentOrderUpsert) {
s.ClearProviderSnapshot()
})
}
// SetStatus sets the "status" field.
func (u *PaymentOrderUpsertOne) SetStatus(v string) *PaymentOrderUpsertOne {
return u.Update(func(s *PaymentOrderUpsert) {
......@@ -2770,6 +2881,48 @@ func (u *PaymentOrderUpsertBulk) ClearProviderInstanceID() *PaymentOrderUpsertBu
})
}
// SetProviderKey sets the "provider_key" field.
func (u *PaymentOrderUpsertBulk) SetProviderKey(v string) *PaymentOrderUpsertBulk {
return u.Update(func(s *PaymentOrderUpsert) {
s.SetProviderKey(v)
})
}
// UpdateProviderKey sets the "provider_key" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateProviderKey() *PaymentOrderUpsertBulk {
return u.Update(func(s *PaymentOrderUpsert) {
s.UpdateProviderKey()
})
}
// ClearProviderKey clears the value of the "provider_key" field.
func (u *PaymentOrderUpsertBulk) ClearProviderKey() *PaymentOrderUpsertBulk {
return u.Update(func(s *PaymentOrderUpsert) {
s.ClearProviderKey()
})
}
// SetProviderSnapshot sets the "provider_snapshot" field.
func (u *PaymentOrderUpsertBulk) SetProviderSnapshot(v map[string]interface{}) *PaymentOrderUpsertBulk {
return u.Update(func(s *PaymentOrderUpsert) {
s.SetProviderSnapshot(v)
})
}
// UpdateProviderSnapshot sets the "provider_snapshot" field to the value that was provided on create.
func (u *PaymentOrderUpsertBulk) UpdateProviderSnapshot() *PaymentOrderUpsertBulk {
return u.Update(func(s *PaymentOrderUpsert) {
s.UpdateProviderSnapshot()
})
}
// ClearProviderSnapshot clears the value of the "provider_snapshot" field.
func (u *PaymentOrderUpsertBulk) ClearProviderSnapshot() *PaymentOrderUpsertBulk {
return u.Update(func(s *PaymentOrderUpsert) {
s.ClearProviderSnapshot()
})
}
// SetStatus sets the "status" field.
func (u *PaymentOrderUpsertBulk) SetStatus(v string) *PaymentOrderUpsertBulk {
return u.Update(func(s *PaymentOrderUpsert) {
......
......@@ -385,6 +385,38 @@ func (_u *PaymentOrderUpdate) ClearProviderInstanceID() *PaymentOrderUpdate {
return _u
}
// SetProviderKey sets the "provider_key" field.
func (_u *PaymentOrderUpdate) SetProviderKey(v string) *PaymentOrderUpdate {
_u.mutation.SetProviderKey(v)
return _u
}
// SetNillableProviderKey sets the "provider_key" field if the given value is not nil.
func (_u *PaymentOrderUpdate) SetNillableProviderKey(v *string) *PaymentOrderUpdate {
if v != nil {
_u.SetProviderKey(*v)
}
return _u
}
// ClearProviderKey clears the value of the "provider_key" field.
func (_u *PaymentOrderUpdate) ClearProviderKey() *PaymentOrderUpdate {
_u.mutation.ClearProviderKey()
return _u
}
// SetProviderSnapshot sets the "provider_snapshot" field.
func (_u *PaymentOrderUpdate) SetProviderSnapshot(v map[string]interface{}) *PaymentOrderUpdate {
_u.mutation.SetProviderSnapshot(v)
return _u
}
// ClearProviderSnapshot clears the value of the "provider_snapshot" field.
func (_u *PaymentOrderUpdate) ClearProviderSnapshot() *PaymentOrderUpdate {
_u.mutation.ClearProviderSnapshot()
return _u
}
// SetStatus sets the "status" field.
func (_u *PaymentOrderUpdate) SetStatus(v string) *PaymentOrderUpdate {
_u.mutation.SetStatus(v)
......@@ -776,6 +808,11 @@ func (_u *PaymentOrderUpdate) check() error {
return &ValidationError{Name: "provider_instance_id", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.provider_instance_id": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderKey(); ok {
if err := paymentorder.ProviderKeyValidator(v); err != nil {
return &ValidationError{Name: "provider_key", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.provider_key": %w`, err)}
}
}
if v, ok := _u.mutation.Status(); ok {
if err := paymentorder.StatusValidator(v); err != nil {
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.status": %w`, err)}
......@@ -910,6 +947,18 @@ func (_u *PaymentOrderUpdate) sqlSave(ctx context.Context) (_node int, err error
if _u.mutation.ProviderInstanceIDCleared() {
_spec.ClearField(paymentorder.FieldProviderInstanceID, field.TypeString)
}
if value, ok := _u.mutation.ProviderKey(); ok {
_spec.SetField(paymentorder.FieldProviderKey, field.TypeString, value)
}
if _u.mutation.ProviderKeyCleared() {
_spec.ClearField(paymentorder.FieldProviderKey, field.TypeString)
}
if value, ok := _u.mutation.ProviderSnapshot(); ok {
_spec.SetField(paymentorder.FieldProviderSnapshot, field.TypeJSON, value)
}
if _u.mutation.ProviderSnapshotCleared() {
_spec.ClearField(paymentorder.FieldProviderSnapshot, field.TypeJSON)
}
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(paymentorder.FieldStatus, field.TypeString, value)
}
......@@ -1399,6 +1448,38 @@ func (_u *PaymentOrderUpdateOne) ClearProviderInstanceID() *PaymentOrderUpdateOn
return _u
}
// SetProviderKey sets the "provider_key" field.
func (_u *PaymentOrderUpdateOne) SetProviderKey(v string) *PaymentOrderUpdateOne {
_u.mutation.SetProviderKey(v)
return _u
}
// SetNillableProviderKey sets the "provider_key" field if the given value is not nil.
func (_u *PaymentOrderUpdateOne) SetNillableProviderKey(v *string) *PaymentOrderUpdateOne {
if v != nil {
_u.SetProviderKey(*v)
}
return _u
}
// ClearProviderKey clears the value of the "provider_key" field.
func (_u *PaymentOrderUpdateOne) ClearProviderKey() *PaymentOrderUpdateOne {
_u.mutation.ClearProviderKey()
return _u
}
// SetProviderSnapshot sets the "provider_snapshot" field.
func (_u *PaymentOrderUpdateOne) SetProviderSnapshot(v map[string]interface{}) *PaymentOrderUpdateOne {
_u.mutation.SetProviderSnapshot(v)
return _u
}
// ClearProviderSnapshot clears the value of the "provider_snapshot" field.
func (_u *PaymentOrderUpdateOne) ClearProviderSnapshot() *PaymentOrderUpdateOne {
_u.mutation.ClearProviderSnapshot()
return _u
}
// SetStatus sets the "status" field.
func (_u *PaymentOrderUpdateOne) SetStatus(v string) *PaymentOrderUpdateOne {
_u.mutation.SetStatus(v)
......@@ -1803,6 +1884,11 @@ func (_u *PaymentOrderUpdateOne) check() error {
return &ValidationError{Name: "provider_instance_id", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.provider_instance_id": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderKey(); ok {
if err := paymentorder.ProviderKeyValidator(v); err != nil {
return &ValidationError{Name: "provider_key", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.provider_key": %w`, err)}
}
}
if v, ok := _u.mutation.Status(); ok {
if err := paymentorder.StatusValidator(v); err != nil {
return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "PaymentOrder.status": %w`, err)}
......@@ -1954,6 +2040,18 @@ func (_u *PaymentOrderUpdateOne) sqlSave(ctx context.Context) (_node *PaymentOrd
if _u.mutation.ProviderInstanceIDCleared() {
_spec.ClearField(paymentorder.FieldProviderInstanceID, field.TypeString)
}
if value, ok := _u.mutation.ProviderKey(); ok {
_spec.SetField(paymentorder.FieldProviderKey, field.TypeString, value)
}
if _u.mutation.ProviderKeyCleared() {
_spec.ClearField(paymentorder.FieldProviderKey, field.TypeString)
}
if value, ok := _u.mutation.ProviderSnapshot(); ok {
_spec.SetField(paymentorder.FieldProviderSnapshot, field.TypeJSON, value)
}
if _u.mutation.ProviderSnapshotCleared() {
_spec.ClearField(paymentorder.FieldProviderSnapshot, field.TypeJSON)
}
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(paymentorder.FieldStatus, field.TypeString, value)
}
......
// Code generated by ent, DO NOT EDIT.
package ent
import (
"encoding/json"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/Wei-Shaw/sub2api/ent/identityadoptiondecision"
"github.com/Wei-Shaw/sub2api/ent/pendingauthsession"
"github.com/Wei-Shaw/sub2api/ent/user"
)
// PendingAuthSession is the model entity for the PendingAuthSession schema.
type PendingAuthSession struct {
config `json:"-"`
// ID of the ent.
ID int64 `json:"id,omitempty"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at,omitempty"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt time.Time `json:"updated_at,omitempty"`
// SessionToken holds the value of the "session_token" field.
SessionToken string `json:"session_token,omitempty"`
// Intent holds the value of the "intent" field.
Intent string `json:"intent,omitempty"`
// ProviderType holds the value of the "provider_type" field.
ProviderType string `json:"provider_type,omitempty"`
// ProviderKey holds the value of the "provider_key" field.
ProviderKey string `json:"provider_key,omitempty"`
// ProviderSubject holds the value of the "provider_subject" field.
ProviderSubject string `json:"provider_subject,omitempty"`
// TargetUserID holds the value of the "target_user_id" field.
TargetUserID *int64 `json:"target_user_id,omitempty"`
// RedirectTo holds the value of the "redirect_to" field.
RedirectTo string `json:"redirect_to,omitempty"`
// ResolvedEmail holds the value of the "resolved_email" field.
ResolvedEmail string `json:"resolved_email,omitempty"`
// RegistrationPasswordHash holds the value of the "registration_password_hash" field.
RegistrationPasswordHash string `json:"registration_password_hash,omitempty"`
// UpstreamIdentityClaims holds the value of the "upstream_identity_claims" field.
UpstreamIdentityClaims map[string]interface{} `json:"upstream_identity_claims,omitempty"`
// LocalFlowState holds the value of the "local_flow_state" field.
LocalFlowState map[string]interface{} `json:"local_flow_state,omitempty"`
// BrowserSessionKey holds the value of the "browser_session_key" field.
BrowserSessionKey string `json:"browser_session_key,omitempty"`
// CompletionCodeHash holds the value of the "completion_code_hash" field.
CompletionCodeHash string `json:"completion_code_hash,omitempty"`
// CompletionCodeExpiresAt holds the value of the "completion_code_expires_at" field.
CompletionCodeExpiresAt *time.Time `json:"completion_code_expires_at,omitempty"`
// EmailVerifiedAt holds the value of the "email_verified_at" field.
EmailVerifiedAt *time.Time `json:"email_verified_at,omitempty"`
// PasswordVerifiedAt holds the value of the "password_verified_at" field.
PasswordVerifiedAt *time.Time `json:"password_verified_at,omitempty"`
// TotpVerifiedAt holds the value of the "totp_verified_at" field.
TotpVerifiedAt *time.Time `json:"totp_verified_at,omitempty"`
// ExpiresAt holds the value of the "expires_at" field.
ExpiresAt time.Time `json:"expires_at,omitempty"`
// ConsumedAt holds the value of the "consumed_at" field.
ConsumedAt *time.Time `json:"consumed_at,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the PendingAuthSessionQuery when eager-loading is set.
Edges PendingAuthSessionEdges `json:"edges"`
selectValues sql.SelectValues
}
// PendingAuthSessionEdges holds the relations/edges for other nodes in the graph.
type PendingAuthSessionEdges struct {
// TargetUser holds the value of the target_user edge.
TargetUser *User `json:"target_user,omitempty"`
// AdoptionDecision holds the value of the adoption_decision edge.
AdoptionDecision *IdentityAdoptionDecision `json:"adoption_decision,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [2]bool
}
// TargetUserOrErr returns the TargetUser value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e PendingAuthSessionEdges) TargetUserOrErr() (*User, error) {
if e.TargetUser != nil {
return e.TargetUser, nil
} else if e.loadedTypes[0] {
return nil, &NotFoundError{label: user.Label}
}
return nil, &NotLoadedError{edge: "target_user"}
}
// AdoptionDecisionOrErr returns the AdoptionDecision value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e PendingAuthSessionEdges) AdoptionDecisionOrErr() (*IdentityAdoptionDecision, error) {
if e.AdoptionDecision != nil {
return e.AdoptionDecision, nil
} else if e.loadedTypes[1] {
return nil, &NotFoundError{label: identityadoptiondecision.Label}
}
return nil, &NotLoadedError{edge: "adoption_decision"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*PendingAuthSession) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case pendingauthsession.FieldUpstreamIdentityClaims, pendingauthsession.FieldLocalFlowState:
values[i] = new([]byte)
case pendingauthsession.FieldID, pendingauthsession.FieldTargetUserID:
values[i] = new(sql.NullInt64)
case pendingauthsession.FieldSessionToken, pendingauthsession.FieldIntent, pendingauthsession.FieldProviderType, pendingauthsession.FieldProviderKey, pendingauthsession.FieldProviderSubject, pendingauthsession.FieldRedirectTo, pendingauthsession.FieldResolvedEmail, pendingauthsession.FieldRegistrationPasswordHash, pendingauthsession.FieldBrowserSessionKey, pendingauthsession.FieldCompletionCodeHash:
values[i] = new(sql.NullString)
case pendingauthsession.FieldCreatedAt, pendingauthsession.FieldUpdatedAt, pendingauthsession.FieldCompletionCodeExpiresAt, pendingauthsession.FieldEmailVerifiedAt, pendingauthsession.FieldPasswordVerifiedAt, pendingauthsession.FieldTotpVerifiedAt, pendingauthsession.FieldExpiresAt, pendingauthsession.FieldConsumedAt:
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 PendingAuthSession fields.
func (_m *PendingAuthSession) 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 pendingauthsession.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 pendingauthsession.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
case pendingauthsession.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
_m.UpdatedAt = value.Time
}
case pendingauthsession.FieldSessionToken:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field session_token", values[i])
} else if value.Valid {
_m.SessionToken = value.String
}
case pendingauthsession.FieldIntent:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field intent", values[i])
} else if value.Valid {
_m.Intent = value.String
}
case pendingauthsession.FieldProviderType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field provider_type", values[i])
} else if value.Valid {
_m.ProviderType = value.String
}
case pendingauthsession.FieldProviderKey:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field provider_key", values[i])
} else if value.Valid {
_m.ProviderKey = value.String
}
case pendingauthsession.FieldProviderSubject:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field provider_subject", values[i])
} else if value.Valid {
_m.ProviderSubject = value.String
}
case pendingauthsession.FieldTargetUserID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field target_user_id", values[i])
} else if value.Valid {
_m.TargetUserID = new(int64)
*_m.TargetUserID = value.Int64
}
case pendingauthsession.FieldRedirectTo:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field redirect_to", values[i])
} else if value.Valid {
_m.RedirectTo = value.String
}
case pendingauthsession.FieldResolvedEmail:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field resolved_email", values[i])
} else if value.Valid {
_m.ResolvedEmail = value.String
}
case pendingauthsession.FieldRegistrationPasswordHash:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field registration_password_hash", values[i])
} else if value.Valid {
_m.RegistrationPasswordHash = value.String
}
case pendingauthsession.FieldUpstreamIdentityClaims:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field upstream_identity_claims", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &_m.UpstreamIdentityClaims); err != nil {
return fmt.Errorf("unmarshal field upstream_identity_claims: %w", err)
}
}
case pendingauthsession.FieldLocalFlowState:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field local_flow_state", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &_m.LocalFlowState); err != nil {
return fmt.Errorf("unmarshal field local_flow_state: %w", err)
}
}
case pendingauthsession.FieldBrowserSessionKey:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field browser_session_key", values[i])
} else if value.Valid {
_m.BrowserSessionKey = value.String
}
case pendingauthsession.FieldCompletionCodeHash:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field completion_code_hash", values[i])
} else if value.Valid {
_m.CompletionCodeHash = value.String
}
case pendingauthsession.FieldCompletionCodeExpiresAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field completion_code_expires_at", values[i])
} else if value.Valid {
_m.CompletionCodeExpiresAt = new(time.Time)
*_m.CompletionCodeExpiresAt = value.Time
}
case pendingauthsession.FieldEmailVerifiedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field email_verified_at", values[i])
} else if value.Valid {
_m.EmailVerifiedAt = new(time.Time)
*_m.EmailVerifiedAt = value.Time
}
case pendingauthsession.FieldPasswordVerifiedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field password_verified_at", values[i])
} else if value.Valid {
_m.PasswordVerifiedAt = new(time.Time)
*_m.PasswordVerifiedAt = value.Time
}
case pendingauthsession.FieldTotpVerifiedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field totp_verified_at", values[i])
} else if value.Valid {
_m.TotpVerifiedAt = new(time.Time)
*_m.TotpVerifiedAt = value.Time
}
case pendingauthsession.FieldExpiresAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field expires_at", values[i])
} else if value.Valid {
_m.ExpiresAt = value.Time
}
case pendingauthsession.FieldConsumedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field consumed_at", values[i])
} else if value.Valid {
_m.ConsumedAt = new(time.Time)
*_m.ConsumedAt = 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 PendingAuthSession.
// This includes values selected through modifiers, order, etc.
func (_m *PendingAuthSession) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// QueryTargetUser queries the "target_user" edge of the PendingAuthSession entity.
func (_m *PendingAuthSession) QueryTargetUser() *UserQuery {
return NewPendingAuthSessionClient(_m.config).QueryTargetUser(_m)
}
// QueryAdoptionDecision queries the "adoption_decision" edge of the PendingAuthSession entity.
func (_m *PendingAuthSession) QueryAdoptionDecision() *IdentityAdoptionDecisionQuery {
return NewPendingAuthSessionClient(_m.config).QueryAdoptionDecision(_m)
}
// Update returns a builder for updating this PendingAuthSession.
// Note that you need to call PendingAuthSession.Unwrap() before calling this method if this PendingAuthSession
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *PendingAuthSession) Update() *PendingAuthSessionUpdateOne {
return NewPendingAuthSessionClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the PendingAuthSession 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 *PendingAuthSession) Unwrap() *PendingAuthSession {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: PendingAuthSession is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *PendingAuthSession) String() string {
var builder strings.Builder
builder.WriteString("PendingAuthSession(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("created_at=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("session_token=")
builder.WriteString(_m.SessionToken)
builder.WriteString(", ")
builder.WriteString("intent=")
builder.WriteString(_m.Intent)
builder.WriteString(", ")
builder.WriteString("provider_type=")
builder.WriteString(_m.ProviderType)
builder.WriteString(", ")
builder.WriteString("provider_key=")
builder.WriteString(_m.ProviderKey)
builder.WriteString(", ")
builder.WriteString("provider_subject=")
builder.WriteString(_m.ProviderSubject)
builder.WriteString(", ")
if v := _m.TargetUserID; v != nil {
builder.WriteString("target_user_id=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteString(", ")
builder.WriteString("redirect_to=")
builder.WriteString(_m.RedirectTo)
builder.WriteString(", ")
builder.WriteString("resolved_email=")
builder.WriteString(_m.ResolvedEmail)
builder.WriteString(", ")
builder.WriteString("registration_password_hash=")
builder.WriteString(_m.RegistrationPasswordHash)
builder.WriteString(", ")
builder.WriteString("upstream_identity_claims=")
builder.WriteString(fmt.Sprintf("%v", _m.UpstreamIdentityClaims))
builder.WriteString(", ")
builder.WriteString("local_flow_state=")
builder.WriteString(fmt.Sprintf("%v", _m.LocalFlowState))
builder.WriteString(", ")
builder.WriteString("browser_session_key=")
builder.WriteString(_m.BrowserSessionKey)
builder.WriteString(", ")
builder.WriteString("completion_code_hash=")
builder.WriteString(_m.CompletionCodeHash)
builder.WriteString(", ")
if v := _m.CompletionCodeExpiresAt; v != nil {
builder.WriteString("completion_code_expires_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
if v := _m.EmailVerifiedAt; v != nil {
builder.WriteString("email_verified_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
if v := _m.PasswordVerifiedAt; v != nil {
builder.WriteString("password_verified_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
if v := _m.TotpVerifiedAt; v != nil {
builder.WriteString("totp_verified_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteString(", ")
builder.WriteString("expires_at=")
builder.WriteString(_m.ExpiresAt.Format(time.ANSIC))
builder.WriteString(", ")
if v := _m.ConsumedAt; v != nil {
builder.WriteString("consumed_at=")
builder.WriteString(v.Format(time.ANSIC))
}
builder.WriteByte(')')
return builder.String()
}
// PendingAuthSessions is a parsable slice of PendingAuthSession.
type PendingAuthSessions []*PendingAuthSession
// Code generated by ent, DO NOT EDIT.
package pendingauthsession
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
const (
// Label holds the string label denoting the pendingauthsession type in the database.
Label = "pending_auth_session"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// FieldSessionToken holds the string denoting the session_token field in the database.
FieldSessionToken = "session_token"
// FieldIntent holds the string denoting the intent field in the database.
FieldIntent = "intent"
// FieldProviderType holds the string denoting the provider_type field in the database.
FieldProviderType = "provider_type"
// FieldProviderKey holds the string denoting the provider_key field in the database.
FieldProviderKey = "provider_key"
// FieldProviderSubject holds the string denoting the provider_subject field in the database.
FieldProviderSubject = "provider_subject"
// FieldTargetUserID holds the string denoting the target_user_id field in the database.
FieldTargetUserID = "target_user_id"
// FieldRedirectTo holds the string denoting the redirect_to field in the database.
FieldRedirectTo = "redirect_to"
// FieldResolvedEmail holds the string denoting the resolved_email field in the database.
FieldResolvedEmail = "resolved_email"
// FieldRegistrationPasswordHash holds the string denoting the registration_password_hash field in the database.
FieldRegistrationPasswordHash = "registration_password_hash"
// FieldUpstreamIdentityClaims holds the string denoting the upstream_identity_claims field in the database.
FieldUpstreamIdentityClaims = "upstream_identity_claims"
// FieldLocalFlowState holds the string denoting the local_flow_state field in the database.
FieldLocalFlowState = "local_flow_state"
// FieldBrowserSessionKey holds the string denoting the browser_session_key field in the database.
FieldBrowserSessionKey = "browser_session_key"
// FieldCompletionCodeHash holds the string denoting the completion_code_hash field in the database.
FieldCompletionCodeHash = "completion_code_hash"
// FieldCompletionCodeExpiresAt holds the string denoting the completion_code_expires_at field in the database.
FieldCompletionCodeExpiresAt = "completion_code_expires_at"
// FieldEmailVerifiedAt holds the string denoting the email_verified_at field in the database.
FieldEmailVerifiedAt = "email_verified_at"
// FieldPasswordVerifiedAt holds the string denoting the password_verified_at field in the database.
FieldPasswordVerifiedAt = "password_verified_at"
// FieldTotpVerifiedAt holds the string denoting the totp_verified_at field in the database.
FieldTotpVerifiedAt = "totp_verified_at"
// FieldExpiresAt holds the string denoting the expires_at field in the database.
FieldExpiresAt = "expires_at"
// FieldConsumedAt holds the string denoting the consumed_at field in the database.
FieldConsumedAt = "consumed_at"
// EdgeTargetUser holds the string denoting the target_user edge name in mutations.
EdgeTargetUser = "target_user"
// EdgeAdoptionDecision holds the string denoting the adoption_decision edge name in mutations.
EdgeAdoptionDecision = "adoption_decision"
// Table holds the table name of the pendingauthsession in the database.
Table = "pending_auth_sessions"
// TargetUserTable is the table that holds the target_user relation/edge.
TargetUserTable = "pending_auth_sessions"
// TargetUserInverseTable is the table name for the User entity.
// It exists in this package in order to avoid circular dependency with the "user" package.
TargetUserInverseTable = "users"
// TargetUserColumn is the table column denoting the target_user relation/edge.
TargetUserColumn = "target_user_id"
// AdoptionDecisionTable is the table that holds the adoption_decision relation/edge.
AdoptionDecisionTable = "identity_adoption_decisions"
// AdoptionDecisionInverseTable is the table name for the IdentityAdoptionDecision entity.
// It exists in this package in order to avoid circular dependency with the "identityadoptiondecision" package.
AdoptionDecisionInverseTable = "identity_adoption_decisions"
// AdoptionDecisionColumn is the table column denoting the adoption_decision relation/edge.
AdoptionDecisionColumn = "pending_auth_session_id"
)
// Columns holds all SQL columns for pendingauthsession fields.
var Columns = []string{
FieldID,
FieldCreatedAt,
FieldUpdatedAt,
FieldSessionToken,
FieldIntent,
FieldProviderType,
FieldProviderKey,
FieldProviderSubject,
FieldTargetUserID,
FieldRedirectTo,
FieldResolvedEmail,
FieldRegistrationPasswordHash,
FieldUpstreamIdentityClaims,
FieldLocalFlowState,
FieldBrowserSessionKey,
FieldCompletionCodeHash,
FieldCompletionCodeExpiresAt,
FieldEmailVerifiedAt,
FieldPasswordVerifiedAt,
FieldTotpVerifiedAt,
FieldExpiresAt,
FieldConsumedAt,
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
return false
}
var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// SessionTokenValidator is a validator for the "session_token" field. It is called by the builders before save.
SessionTokenValidator func(string) error
// IntentValidator is a validator for the "intent" field. It is called by the builders before save.
IntentValidator func(string) error
// ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
ProviderTypeValidator func(string) error
// ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
ProviderKeyValidator func(string) error
// ProviderSubjectValidator is a validator for the "provider_subject" field. It is called by the builders before save.
ProviderSubjectValidator func(string) error
// DefaultRedirectTo holds the default value on creation for the "redirect_to" field.
DefaultRedirectTo string
// DefaultResolvedEmail holds the default value on creation for the "resolved_email" field.
DefaultResolvedEmail string
// DefaultRegistrationPasswordHash holds the default value on creation for the "registration_password_hash" field.
DefaultRegistrationPasswordHash string
// DefaultUpstreamIdentityClaims holds the default value on creation for the "upstream_identity_claims" field.
DefaultUpstreamIdentityClaims func() map[string]interface{}
// DefaultLocalFlowState holds the default value on creation for the "local_flow_state" field.
DefaultLocalFlowState func() map[string]interface{}
// DefaultBrowserSessionKey holds the default value on creation for the "browser_session_key" field.
DefaultBrowserSessionKey string
// DefaultCompletionCodeHash holds the default value on creation for the "completion_code_hash" field.
DefaultCompletionCodeHash string
)
// OrderOption defines the ordering options for the PendingAuthSession queries.
type OrderOption func(*sql.Selector)
// ByID orders the results by the id field.
func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
// ByCreatedAt orders the results by the created_at field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
// ByUpdatedAt orders the results by the updated_at field.
func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
}
// BySessionToken orders the results by the session_token field.
func BySessionToken(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldSessionToken, opts...).ToFunc()
}
// ByIntent orders the results by the intent field.
func ByIntent(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldIntent, opts...).ToFunc()
}
// ByProviderType orders the results by the provider_type field.
func ByProviderType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldProviderType, opts...).ToFunc()
}
// ByProviderKey orders the results by the provider_key field.
func ByProviderKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldProviderKey, opts...).ToFunc()
}
// ByProviderSubject orders the results by the provider_subject field.
func ByProviderSubject(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldProviderSubject, opts...).ToFunc()
}
// ByTargetUserID orders the results by the target_user_id field.
func ByTargetUserID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTargetUserID, opts...).ToFunc()
}
// ByRedirectTo orders the results by the redirect_to field.
func ByRedirectTo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRedirectTo, opts...).ToFunc()
}
// ByResolvedEmail orders the results by the resolved_email field.
func ByResolvedEmail(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldResolvedEmail, opts...).ToFunc()
}
// ByRegistrationPasswordHash orders the results by the registration_password_hash field.
func ByRegistrationPasswordHash(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldRegistrationPasswordHash, opts...).ToFunc()
}
// ByBrowserSessionKey orders the results by the browser_session_key field.
func ByBrowserSessionKey(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldBrowserSessionKey, opts...).ToFunc()
}
// ByCompletionCodeHash orders the results by the completion_code_hash field.
func ByCompletionCodeHash(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCompletionCodeHash, opts...).ToFunc()
}
// ByCompletionCodeExpiresAt orders the results by the completion_code_expires_at field.
func ByCompletionCodeExpiresAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCompletionCodeExpiresAt, opts...).ToFunc()
}
// ByEmailVerifiedAt orders the results by the email_verified_at field.
func ByEmailVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldEmailVerifiedAt, opts...).ToFunc()
}
// ByPasswordVerifiedAt orders the results by the password_verified_at field.
func ByPasswordVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPasswordVerifiedAt, opts...).ToFunc()
}
// ByTotpVerifiedAt orders the results by the totp_verified_at field.
func ByTotpVerifiedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldTotpVerifiedAt, opts...).ToFunc()
}
// ByExpiresAt orders the results by the expires_at field.
func ByExpiresAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldExpiresAt, opts...).ToFunc()
}
// ByConsumedAt orders the results by the consumed_at field.
func ByConsumedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldConsumedAt, opts...).ToFunc()
}
// ByTargetUserField orders the results by target_user field.
func ByTargetUserField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newTargetUserStep(), sql.OrderByField(field, opts...))
}
}
// ByAdoptionDecisionField orders the results by adoption_decision field.
func ByAdoptionDecisionField(field string, opts ...sql.OrderTermOption) OrderOption {
return func(s *sql.Selector) {
sqlgraph.OrderByNeighborTerms(s, newAdoptionDecisionStep(), sql.OrderByField(field, opts...))
}
}
func newTargetUserStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(TargetUserInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, TargetUserTable, TargetUserColumn),
)
}
func newAdoptionDecisionStep() *sqlgraph.Step {
return sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(AdoptionDecisionInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, AdoptionDecisionTable, AdoptionDecisionColumn),
)
}
// Code generated by ent, DO NOT EDIT.
package pendingauthsession
import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// ID filters vertices based on their ID field.
func ID(id int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldID, id))
}
// IDEQ applies the EQ predicate on the ID field.
func IDEQ(id int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldID, id))
}
// IDNEQ applies the NEQ predicate on the ID field.
func IDNEQ(id int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldID, id))
}
// IDIn applies the In predicate on the ID field.
func IDIn(ids ...int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldID, ids...))
}
// IDNotIn applies the NotIn predicate on the ID field.
func IDNotIn(ids ...int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldID, ids...))
}
// IDGT applies the GT predicate on the ID field.
func IDGT(id int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldID, id))
}
// IDGTE applies the GTE predicate on the ID field.
func IDGTE(id int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldID, id))
}
// IDLT applies the LT predicate on the ID field.
func IDLT(id int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldID, id))
}
// IDLTE applies the LTE predicate on the ID field.
func IDLTE(id int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldID, id))
}
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
func CreatedAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldCreatedAt, v))
}
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
func UpdatedAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldUpdatedAt, v))
}
// SessionToken applies equality check predicate on the "session_token" field. It's identical to SessionTokenEQ.
func SessionToken(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldSessionToken, v))
}
// Intent applies equality check predicate on the "intent" field. It's identical to IntentEQ.
func Intent(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldIntent, v))
}
// ProviderType applies equality check predicate on the "provider_type" field. It's identical to ProviderTypeEQ.
func ProviderType(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldProviderType, v))
}
// ProviderKey applies equality check predicate on the "provider_key" field. It's identical to ProviderKeyEQ.
func ProviderKey(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldProviderKey, v))
}
// ProviderSubject applies equality check predicate on the "provider_subject" field. It's identical to ProviderSubjectEQ.
func ProviderSubject(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldProviderSubject, v))
}
// TargetUserID applies equality check predicate on the "target_user_id" field. It's identical to TargetUserIDEQ.
func TargetUserID(v int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldTargetUserID, v))
}
// RedirectTo applies equality check predicate on the "redirect_to" field. It's identical to RedirectToEQ.
func RedirectTo(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldRedirectTo, v))
}
// ResolvedEmail applies equality check predicate on the "resolved_email" field. It's identical to ResolvedEmailEQ.
func ResolvedEmail(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldResolvedEmail, v))
}
// RegistrationPasswordHash applies equality check predicate on the "registration_password_hash" field. It's identical to RegistrationPasswordHashEQ.
func RegistrationPasswordHash(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldRegistrationPasswordHash, v))
}
// BrowserSessionKey applies equality check predicate on the "browser_session_key" field. It's identical to BrowserSessionKeyEQ.
func BrowserSessionKey(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldBrowserSessionKey, v))
}
// CompletionCodeHash applies equality check predicate on the "completion_code_hash" field. It's identical to CompletionCodeHashEQ.
func CompletionCodeHash(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldCompletionCodeHash, v))
}
// CompletionCodeExpiresAt applies equality check predicate on the "completion_code_expires_at" field. It's identical to CompletionCodeExpiresAtEQ.
func CompletionCodeExpiresAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldCompletionCodeExpiresAt, v))
}
// EmailVerifiedAt applies equality check predicate on the "email_verified_at" field. It's identical to EmailVerifiedAtEQ.
func EmailVerifiedAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldEmailVerifiedAt, v))
}
// PasswordVerifiedAt applies equality check predicate on the "password_verified_at" field. It's identical to PasswordVerifiedAtEQ.
func PasswordVerifiedAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldPasswordVerifiedAt, v))
}
// TotpVerifiedAt applies equality check predicate on the "totp_verified_at" field. It's identical to TotpVerifiedAtEQ.
func TotpVerifiedAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldTotpVerifiedAt, v))
}
// ExpiresAt applies equality check predicate on the "expires_at" field. It's identical to ExpiresAtEQ.
func ExpiresAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldExpiresAt, v))
}
// ConsumedAt applies equality check predicate on the "consumed_at" field. It's identical to ConsumedAtEQ.
func ConsumedAt(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldConsumedAt, v))
}
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
func CreatedAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldCreatedAt, v))
}
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
func CreatedAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldCreatedAt, v))
}
// CreatedAtIn applies the In predicate on the "created_at" field.
func CreatedAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldCreatedAt, vs...))
}
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
func CreatedAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldCreatedAt, vs...))
}
// CreatedAtGT applies the GT predicate on the "created_at" field.
func CreatedAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldCreatedAt, v))
}
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
func CreatedAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldCreatedAt, v))
}
// CreatedAtLT applies the LT predicate on the "created_at" field.
func CreatedAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldCreatedAt, v))
}
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
func CreatedAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldCreatedAt, v))
}
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
func UpdatedAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldUpdatedAt, v))
}
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
func UpdatedAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldUpdatedAt, v))
}
// UpdatedAtIn applies the In predicate on the "updated_at" field.
func UpdatedAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldUpdatedAt, vs...))
}
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
func UpdatedAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldUpdatedAt, vs...))
}
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
func UpdatedAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldUpdatedAt, v))
}
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
func UpdatedAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldUpdatedAt, v))
}
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
func UpdatedAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldUpdatedAt, v))
}
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
func UpdatedAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldUpdatedAt, v))
}
// SessionTokenEQ applies the EQ predicate on the "session_token" field.
func SessionTokenEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldSessionToken, v))
}
// SessionTokenNEQ applies the NEQ predicate on the "session_token" field.
func SessionTokenNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldSessionToken, v))
}
// SessionTokenIn applies the In predicate on the "session_token" field.
func SessionTokenIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldSessionToken, vs...))
}
// SessionTokenNotIn applies the NotIn predicate on the "session_token" field.
func SessionTokenNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldSessionToken, vs...))
}
// SessionTokenGT applies the GT predicate on the "session_token" field.
func SessionTokenGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldSessionToken, v))
}
// SessionTokenGTE applies the GTE predicate on the "session_token" field.
func SessionTokenGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldSessionToken, v))
}
// SessionTokenLT applies the LT predicate on the "session_token" field.
func SessionTokenLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldSessionToken, v))
}
// SessionTokenLTE applies the LTE predicate on the "session_token" field.
func SessionTokenLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldSessionToken, v))
}
// SessionTokenContains applies the Contains predicate on the "session_token" field.
func SessionTokenContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldSessionToken, v))
}
// SessionTokenHasPrefix applies the HasPrefix predicate on the "session_token" field.
func SessionTokenHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldSessionToken, v))
}
// SessionTokenHasSuffix applies the HasSuffix predicate on the "session_token" field.
func SessionTokenHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldSessionToken, v))
}
// SessionTokenEqualFold applies the EqualFold predicate on the "session_token" field.
func SessionTokenEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldSessionToken, v))
}
// SessionTokenContainsFold applies the ContainsFold predicate on the "session_token" field.
func SessionTokenContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldSessionToken, v))
}
// IntentEQ applies the EQ predicate on the "intent" field.
func IntentEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldIntent, v))
}
// IntentNEQ applies the NEQ predicate on the "intent" field.
func IntentNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldIntent, v))
}
// IntentIn applies the In predicate on the "intent" field.
func IntentIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldIntent, vs...))
}
// IntentNotIn applies the NotIn predicate on the "intent" field.
func IntentNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldIntent, vs...))
}
// IntentGT applies the GT predicate on the "intent" field.
func IntentGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldIntent, v))
}
// IntentGTE applies the GTE predicate on the "intent" field.
func IntentGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldIntent, v))
}
// IntentLT applies the LT predicate on the "intent" field.
func IntentLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldIntent, v))
}
// IntentLTE applies the LTE predicate on the "intent" field.
func IntentLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldIntent, v))
}
// IntentContains applies the Contains predicate on the "intent" field.
func IntentContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldIntent, v))
}
// IntentHasPrefix applies the HasPrefix predicate on the "intent" field.
func IntentHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldIntent, v))
}
// IntentHasSuffix applies the HasSuffix predicate on the "intent" field.
func IntentHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldIntent, v))
}
// IntentEqualFold applies the EqualFold predicate on the "intent" field.
func IntentEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldIntent, v))
}
// IntentContainsFold applies the ContainsFold predicate on the "intent" field.
func IntentContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldIntent, v))
}
// ProviderTypeEQ applies the EQ predicate on the "provider_type" field.
func ProviderTypeEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldProviderType, v))
}
// ProviderTypeNEQ applies the NEQ predicate on the "provider_type" field.
func ProviderTypeNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldProviderType, v))
}
// ProviderTypeIn applies the In predicate on the "provider_type" field.
func ProviderTypeIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldProviderType, vs...))
}
// ProviderTypeNotIn applies the NotIn predicate on the "provider_type" field.
func ProviderTypeNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldProviderType, vs...))
}
// ProviderTypeGT applies the GT predicate on the "provider_type" field.
func ProviderTypeGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldProviderType, v))
}
// ProviderTypeGTE applies the GTE predicate on the "provider_type" field.
func ProviderTypeGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldProviderType, v))
}
// ProviderTypeLT applies the LT predicate on the "provider_type" field.
func ProviderTypeLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldProviderType, v))
}
// ProviderTypeLTE applies the LTE predicate on the "provider_type" field.
func ProviderTypeLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldProviderType, v))
}
// ProviderTypeContains applies the Contains predicate on the "provider_type" field.
func ProviderTypeContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldProviderType, v))
}
// ProviderTypeHasPrefix applies the HasPrefix predicate on the "provider_type" field.
func ProviderTypeHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldProviderType, v))
}
// ProviderTypeHasSuffix applies the HasSuffix predicate on the "provider_type" field.
func ProviderTypeHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldProviderType, v))
}
// ProviderTypeEqualFold applies the EqualFold predicate on the "provider_type" field.
func ProviderTypeEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldProviderType, v))
}
// ProviderTypeContainsFold applies the ContainsFold predicate on the "provider_type" field.
func ProviderTypeContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldProviderType, v))
}
// ProviderKeyEQ applies the EQ predicate on the "provider_key" field.
func ProviderKeyEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldProviderKey, v))
}
// ProviderKeyNEQ applies the NEQ predicate on the "provider_key" field.
func ProviderKeyNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldProviderKey, v))
}
// ProviderKeyIn applies the In predicate on the "provider_key" field.
func ProviderKeyIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldProviderKey, vs...))
}
// ProviderKeyNotIn applies the NotIn predicate on the "provider_key" field.
func ProviderKeyNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldProviderKey, vs...))
}
// ProviderKeyGT applies the GT predicate on the "provider_key" field.
func ProviderKeyGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldProviderKey, v))
}
// ProviderKeyGTE applies the GTE predicate on the "provider_key" field.
func ProviderKeyGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldProviderKey, v))
}
// ProviderKeyLT applies the LT predicate on the "provider_key" field.
func ProviderKeyLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldProviderKey, v))
}
// ProviderKeyLTE applies the LTE predicate on the "provider_key" field.
func ProviderKeyLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldProviderKey, v))
}
// ProviderKeyContains applies the Contains predicate on the "provider_key" field.
func ProviderKeyContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldProviderKey, v))
}
// ProviderKeyHasPrefix applies the HasPrefix predicate on the "provider_key" field.
func ProviderKeyHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldProviderKey, v))
}
// ProviderKeyHasSuffix applies the HasSuffix predicate on the "provider_key" field.
func ProviderKeyHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldProviderKey, v))
}
// ProviderKeyEqualFold applies the EqualFold predicate on the "provider_key" field.
func ProviderKeyEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldProviderKey, v))
}
// ProviderKeyContainsFold applies the ContainsFold predicate on the "provider_key" field.
func ProviderKeyContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldProviderKey, v))
}
// ProviderSubjectEQ applies the EQ predicate on the "provider_subject" field.
func ProviderSubjectEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldProviderSubject, v))
}
// ProviderSubjectNEQ applies the NEQ predicate on the "provider_subject" field.
func ProviderSubjectNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldProviderSubject, v))
}
// ProviderSubjectIn applies the In predicate on the "provider_subject" field.
func ProviderSubjectIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldProviderSubject, vs...))
}
// ProviderSubjectNotIn applies the NotIn predicate on the "provider_subject" field.
func ProviderSubjectNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldProviderSubject, vs...))
}
// ProviderSubjectGT applies the GT predicate on the "provider_subject" field.
func ProviderSubjectGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldProviderSubject, v))
}
// ProviderSubjectGTE applies the GTE predicate on the "provider_subject" field.
func ProviderSubjectGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldProviderSubject, v))
}
// ProviderSubjectLT applies the LT predicate on the "provider_subject" field.
func ProviderSubjectLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldProviderSubject, v))
}
// ProviderSubjectLTE applies the LTE predicate on the "provider_subject" field.
func ProviderSubjectLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldProviderSubject, v))
}
// ProviderSubjectContains applies the Contains predicate on the "provider_subject" field.
func ProviderSubjectContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldProviderSubject, v))
}
// ProviderSubjectHasPrefix applies the HasPrefix predicate on the "provider_subject" field.
func ProviderSubjectHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldProviderSubject, v))
}
// ProviderSubjectHasSuffix applies the HasSuffix predicate on the "provider_subject" field.
func ProviderSubjectHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldProviderSubject, v))
}
// ProviderSubjectEqualFold applies the EqualFold predicate on the "provider_subject" field.
func ProviderSubjectEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldProviderSubject, v))
}
// ProviderSubjectContainsFold applies the ContainsFold predicate on the "provider_subject" field.
func ProviderSubjectContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldProviderSubject, v))
}
// TargetUserIDEQ applies the EQ predicate on the "target_user_id" field.
func TargetUserIDEQ(v int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldTargetUserID, v))
}
// TargetUserIDNEQ applies the NEQ predicate on the "target_user_id" field.
func TargetUserIDNEQ(v int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldTargetUserID, v))
}
// TargetUserIDIn applies the In predicate on the "target_user_id" field.
func TargetUserIDIn(vs ...int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldTargetUserID, vs...))
}
// TargetUserIDNotIn applies the NotIn predicate on the "target_user_id" field.
func TargetUserIDNotIn(vs ...int64) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldTargetUserID, vs...))
}
// TargetUserIDIsNil applies the IsNil predicate on the "target_user_id" field.
func TargetUserIDIsNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIsNull(FieldTargetUserID))
}
// TargetUserIDNotNil applies the NotNil predicate on the "target_user_id" field.
func TargetUserIDNotNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotNull(FieldTargetUserID))
}
// RedirectToEQ applies the EQ predicate on the "redirect_to" field.
func RedirectToEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldRedirectTo, v))
}
// RedirectToNEQ applies the NEQ predicate on the "redirect_to" field.
func RedirectToNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldRedirectTo, v))
}
// RedirectToIn applies the In predicate on the "redirect_to" field.
func RedirectToIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldRedirectTo, vs...))
}
// RedirectToNotIn applies the NotIn predicate on the "redirect_to" field.
func RedirectToNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldRedirectTo, vs...))
}
// RedirectToGT applies the GT predicate on the "redirect_to" field.
func RedirectToGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldRedirectTo, v))
}
// RedirectToGTE applies the GTE predicate on the "redirect_to" field.
func RedirectToGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldRedirectTo, v))
}
// RedirectToLT applies the LT predicate on the "redirect_to" field.
func RedirectToLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldRedirectTo, v))
}
// RedirectToLTE applies the LTE predicate on the "redirect_to" field.
func RedirectToLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldRedirectTo, v))
}
// RedirectToContains applies the Contains predicate on the "redirect_to" field.
func RedirectToContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldRedirectTo, v))
}
// RedirectToHasPrefix applies the HasPrefix predicate on the "redirect_to" field.
func RedirectToHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldRedirectTo, v))
}
// RedirectToHasSuffix applies the HasSuffix predicate on the "redirect_to" field.
func RedirectToHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldRedirectTo, v))
}
// RedirectToEqualFold applies the EqualFold predicate on the "redirect_to" field.
func RedirectToEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldRedirectTo, v))
}
// RedirectToContainsFold applies the ContainsFold predicate on the "redirect_to" field.
func RedirectToContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldRedirectTo, v))
}
// ResolvedEmailEQ applies the EQ predicate on the "resolved_email" field.
func ResolvedEmailEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldResolvedEmail, v))
}
// ResolvedEmailNEQ applies the NEQ predicate on the "resolved_email" field.
func ResolvedEmailNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldResolvedEmail, v))
}
// ResolvedEmailIn applies the In predicate on the "resolved_email" field.
func ResolvedEmailIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldResolvedEmail, vs...))
}
// ResolvedEmailNotIn applies the NotIn predicate on the "resolved_email" field.
func ResolvedEmailNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldResolvedEmail, vs...))
}
// ResolvedEmailGT applies the GT predicate on the "resolved_email" field.
func ResolvedEmailGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldResolvedEmail, v))
}
// ResolvedEmailGTE applies the GTE predicate on the "resolved_email" field.
func ResolvedEmailGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldResolvedEmail, v))
}
// ResolvedEmailLT applies the LT predicate on the "resolved_email" field.
func ResolvedEmailLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldResolvedEmail, v))
}
// ResolvedEmailLTE applies the LTE predicate on the "resolved_email" field.
func ResolvedEmailLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldResolvedEmail, v))
}
// ResolvedEmailContains applies the Contains predicate on the "resolved_email" field.
func ResolvedEmailContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldResolvedEmail, v))
}
// ResolvedEmailHasPrefix applies the HasPrefix predicate on the "resolved_email" field.
func ResolvedEmailHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldResolvedEmail, v))
}
// ResolvedEmailHasSuffix applies the HasSuffix predicate on the "resolved_email" field.
func ResolvedEmailHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldResolvedEmail, v))
}
// ResolvedEmailEqualFold applies the EqualFold predicate on the "resolved_email" field.
func ResolvedEmailEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldResolvedEmail, v))
}
// ResolvedEmailContainsFold applies the ContainsFold predicate on the "resolved_email" field.
func ResolvedEmailContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldResolvedEmail, v))
}
// RegistrationPasswordHashEQ applies the EQ predicate on the "registration_password_hash" field.
func RegistrationPasswordHashEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashNEQ applies the NEQ predicate on the "registration_password_hash" field.
func RegistrationPasswordHashNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashIn applies the In predicate on the "registration_password_hash" field.
func RegistrationPasswordHashIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldRegistrationPasswordHash, vs...))
}
// RegistrationPasswordHashNotIn applies the NotIn predicate on the "registration_password_hash" field.
func RegistrationPasswordHashNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldRegistrationPasswordHash, vs...))
}
// RegistrationPasswordHashGT applies the GT predicate on the "registration_password_hash" field.
func RegistrationPasswordHashGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashGTE applies the GTE predicate on the "registration_password_hash" field.
func RegistrationPasswordHashGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashLT applies the LT predicate on the "registration_password_hash" field.
func RegistrationPasswordHashLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashLTE applies the LTE predicate on the "registration_password_hash" field.
func RegistrationPasswordHashLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashContains applies the Contains predicate on the "registration_password_hash" field.
func RegistrationPasswordHashContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashHasPrefix applies the HasPrefix predicate on the "registration_password_hash" field.
func RegistrationPasswordHashHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashHasSuffix applies the HasSuffix predicate on the "registration_password_hash" field.
func RegistrationPasswordHashHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashEqualFold applies the EqualFold predicate on the "registration_password_hash" field.
func RegistrationPasswordHashEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldRegistrationPasswordHash, v))
}
// RegistrationPasswordHashContainsFold applies the ContainsFold predicate on the "registration_password_hash" field.
func RegistrationPasswordHashContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldRegistrationPasswordHash, v))
}
// BrowserSessionKeyEQ applies the EQ predicate on the "browser_session_key" field.
func BrowserSessionKeyEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyNEQ applies the NEQ predicate on the "browser_session_key" field.
func BrowserSessionKeyNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyIn applies the In predicate on the "browser_session_key" field.
func BrowserSessionKeyIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldBrowserSessionKey, vs...))
}
// BrowserSessionKeyNotIn applies the NotIn predicate on the "browser_session_key" field.
func BrowserSessionKeyNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldBrowserSessionKey, vs...))
}
// BrowserSessionKeyGT applies the GT predicate on the "browser_session_key" field.
func BrowserSessionKeyGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyGTE applies the GTE predicate on the "browser_session_key" field.
func BrowserSessionKeyGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyLT applies the LT predicate on the "browser_session_key" field.
func BrowserSessionKeyLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyLTE applies the LTE predicate on the "browser_session_key" field.
func BrowserSessionKeyLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyContains applies the Contains predicate on the "browser_session_key" field.
func BrowserSessionKeyContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyHasPrefix applies the HasPrefix predicate on the "browser_session_key" field.
func BrowserSessionKeyHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyHasSuffix applies the HasSuffix predicate on the "browser_session_key" field.
func BrowserSessionKeyHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyEqualFold applies the EqualFold predicate on the "browser_session_key" field.
func BrowserSessionKeyEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldBrowserSessionKey, v))
}
// BrowserSessionKeyContainsFold applies the ContainsFold predicate on the "browser_session_key" field.
func BrowserSessionKeyContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldBrowserSessionKey, v))
}
// CompletionCodeHashEQ applies the EQ predicate on the "completion_code_hash" field.
func CompletionCodeHashEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldCompletionCodeHash, v))
}
// CompletionCodeHashNEQ applies the NEQ predicate on the "completion_code_hash" field.
func CompletionCodeHashNEQ(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldCompletionCodeHash, v))
}
// CompletionCodeHashIn applies the In predicate on the "completion_code_hash" field.
func CompletionCodeHashIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldCompletionCodeHash, vs...))
}
// CompletionCodeHashNotIn applies the NotIn predicate on the "completion_code_hash" field.
func CompletionCodeHashNotIn(vs ...string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldCompletionCodeHash, vs...))
}
// CompletionCodeHashGT applies the GT predicate on the "completion_code_hash" field.
func CompletionCodeHashGT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldCompletionCodeHash, v))
}
// CompletionCodeHashGTE applies the GTE predicate on the "completion_code_hash" field.
func CompletionCodeHashGTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldCompletionCodeHash, v))
}
// CompletionCodeHashLT applies the LT predicate on the "completion_code_hash" field.
func CompletionCodeHashLT(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldCompletionCodeHash, v))
}
// CompletionCodeHashLTE applies the LTE predicate on the "completion_code_hash" field.
func CompletionCodeHashLTE(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldCompletionCodeHash, v))
}
// CompletionCodeHashContains applies the Contains predicate on the "completion_code_hash" field.
func CompletionCodeHashContains(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContains(FieldCompletionCodeHash, v))
}
// CompletionCodeHashHasPrefix applies the HasPrefix predicate on the "completion_code_hash" field.
func CompletionCodeHashHasPrefix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasPrefix(FieldCompletionCodeHash, v))
}
// CompletionCodeHashHasSuffix applies the HasSuffix predicate on the "completion_code_hash" field.
func CompletionCodeHashHasSuffix(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldHasSuffix(FieldCompletionCodeHash, v))
}
// CompletionCodeHashEqualFold applies the EqualFold predicate on the "completion_code_hash" field.
func CompletionCodeHashEqualFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEqualFold(FieldCompletionCodeHash, v))
}
// CompletionCodeHashContainsFold applies the ContainsFold predicate on the "completion_code_hash" field.
func CompletionCodeHashContainsFold(v string) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldContainsFold(FieldCompletionCodeHash, v))
}
// CompletionCodeExpiresAtEQ applies the EQ predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldCompletionCodeExpiresAt, v))
}
// CompletionCodeExpiresAtNEQ applies the NEQ predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldCompletionCodeExpiresAt, v))
}
// CompletionCodeExpiresAtIn applies the In predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldCompletionCodeExpiresAt, vs...))
}
// CompletionCodeExpiresAtNotIn applies the NotIn predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldCompletionCodeExpiresAt, vs...))
}
// CompletionCodeExpiresAtGT applies the GT predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldCompletionCodeExpiresAt, v))
}
// CompletionCodeExpiresAtGTE applies the GTE predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldCompletionCodeExpiresAt, v))
}
// CompletionCodeExpiresAtLT applies the LT predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldCompletionCodeExpiresAt, v))
}
// CompletionCodeExpiresAtLTE applies the LTE predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldCompletionCodeExpiresAt, v))
}
// CompletionCodeExpiresAtIsNil applies the IsNil predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtIsNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIsNull(FieldCompletionCodeExpiresAt))
}
// CompletionCodeExpiresAtNotNil applies the NotNil predicate on the "completion_code_expires_at" field.
func CompletionCodeExpiresAtNotNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotNull(FieldCompletionCodeExpiresAt))
}
// EmailVerifiedAtEQ applies the EQ predicate on the "email_verified_at" field.
func EmailVerifiedAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldEmailVerifiedAt, v))
}
// EmailVerifiedAtNEQ applies the NEQ predicate on the "email_verified_at" field.
func EmailVerifiedAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldEmailVerifiedAt, v))
}
// EmailVerifiedAtIn applies the In predicate on the "email_verified_at" field.
func EmailVerifiedAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldEmailVerifiedAt, vs...))
}
// EmailVerifiedAtNotIn applies the NotIn predicate on the "email_verified_at" field.
func EmailVerifiedAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldEmailVerifiedAt, vs...))
}
// EmailVerifiedAtGT applies the GT predicate on the "email_verified_at" field.
func EmailVerifiedAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldEmailVerifiedAt, v))
}
// EmailVerifiedAtGTE applies the GTE predicate on the "email_verified_at" field.
func EmailVerifiedAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldEmailVerifiedAt, v))
}
// EmailVerifiedAtLT applies the LT predicate on the "email_verified_at" field.
func EmailVerifiedAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldEmailVerifiedAt, v))
}
// EmailVerifiedAtLTE applies the LTE predicate on the "email_verified_at" field.
func EmailVerifiedAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldEmailVerifiedAt, v))
}
// EmailVerifiedAtIsNil applies the IsNil predicate on the "email_verified_at" field.
func EmailVerifiedAtIsNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIsNull(FieldEmailVerifiedAt))
}
// EmailVerifiedAtNotNil applies the NotNil predicate on the "email_verified_at" field.
func EmailVerifiedAtNotNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotNull(FieldEmailVerifiedAt))
}
// PasswordVerifiedAtEQ applies the EQ predicate on the "password_verified_at" field.
func PasswordVerifiedAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldPasswordVerifiedAt, v))
}
// PasswordVerifiedAtNEQ applies the NEQ predicate on the "password_verified_at" field.
func PasswordVerifiedAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldPasswordVerifiedAt, v))
}
// PasswordVerifiedAtIn applies the In predicate on the "password_verified_at" field.
func PasswordVerifiedAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldPasswordVerifiedAt, vs...))
}
// PasswordVerifiedAtNotIn applies the NotIn predicate on the "password_verified_at" field.
func PasswordVerifiedAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldPasswordVerifiedAt, vs...))
}
// PasswordVerifiedAtGT applies the GT predicate on the "password_verified_at" field.
func PasswordVerifiedAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldPasswordVerifiedAt, v))
}
// PasswordVerifiedAtGTE applies the GTE predicate on the "password_verified_at" field.
func PasswordVerifiedAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldPasswordVerifiedAt, v))
}
// PasswordVerifiedAtLT applies the LT predicate on the "password_verified_at" field.
func PasswordVerifiedAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldPasswordVerifiedAt, v))
}
// PasswordVerifiedAtLTE applies the LTE predicate on the "password_verified_at" field.
func PasswordVerifiedAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldPasswordVerifiedAt, v))
}
// PasswordVerifiedAtIsNil applies the IsNil predicate on the "password_verified_at" field.
func PasswordVerifiedAtIsNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIsNull(FieldPasswordVerifiedAt))
}
// PasswordVerifiedAtNotNil applies the NotNil predicate on the "password_verified_at" field.
func PasswordVerifiedAtNotNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotNull(FieldPasswordVerifiedAt))
}
// TotpVerifiedAtEQ applies the EQ predicate on the "totp_verified_at" field.
func TotpVerifiedAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldTotpVerifiedAt, v))
}
// TotpVerifiedAtNEQ applies the NEQ predicate on the "totp_verified_at" field.
func TotpVerifiedAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldTotpVerifiedAt, v))
}
// TotpVerifiedAtIn applies the In predicate on the "totp_verified_at" field.
func TotpVerifiedAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldTotpVerifiedAt, vs...))
}
// TotpVerifiedAtNotIn applies the NotIn predicate on the "totp_verified_at" field.
func TotpVerifiedAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldTotpVerifiedAt, vs...))
}
// TotpVerifiedAtGT applies the GT predicate on the "totp_verified_at" field.
func TotpVerifiedAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldTotpVerifiedAt, v))
}
// TotpVerifiedAtGTE applies the GTE predicate on the "totp_verified_at" field.
func TotpVerifiedAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldTotpVerifiedAt, v))
}
// TotpVerifiedAtLT applies the LT predicate on the "totp_verified_at" field.
func TotpVerifiedAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldTotpVerifiedAt, v))
}
// TotpVerifiedAtLTE applies the LTE predicate on the "totp_verified_at" field.
func TotpVerifiedAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldTotpVerifiedAt, v))
}
// TotpVerifiedAtIsNil applies the IsNil predicate on the "totp_verified_at" field.
func TotpVerifiedAtIsNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIsNull(FieldTotpVerifiedAt))
}
// TotpVerifiedAtNotNil applies the NotNil predicate on the "totp_verified_at" field.
func TotpVerifiedAtNotNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotNull(FieldTotpVerifiedAt))
}
// ExpiresAtEQ applies the EQ predicate on the "expires_at" field.
func ExpiresAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldExpiresAt, v))
}
// ExpiresAtNEQ applies the NEQ predicate on the "expires_at" field.
func ExpiresAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldExpiresAt, v))
}
// ExpiresAtIn applies the In predicate on the "expires_at" field.
func ExpiresAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldExpiresAt, vs...))
}
// ExpiresAtNotIn applies the NotIn predicate on the "expires_at" field.
func ExpiresAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldExpiresAt, vs...))
}
// ExpiresAtGT applies the GT predicate on the "expires_at" field.
func ExpiresAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldExpiresAt, v))
}
// ExpiresAtGTE applies the GTE predicate on the "expires_at" field.
func ExpiresAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldExpiresAt, v))
}
// ExpiresAtLT applies the LT predicate on the "expires_at" field.
func ExpiresAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldExpiresAt, v))
}
// ExpiresAtLTE applies the LTE predicate on the "expires_at" field.
func ExpiresAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldExpiresAt, v))
}
// ConsumedAtEQ applies the EQ predicate on the "consumed_at" field.
func ConsumedAtEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldEQ(FieldConsumedAt, v))
}
// ConsumedAtNEQ applies the NEQ predicate on the "consumed_at" field.
func ConsumedAtNEQ(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNEQ(FieldConsumedAt, v))
}
// ConsumedAtIn applies the In predicate on the "consumed_at" field.
func ConsumedAtIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIn(FieldConsumedAt, vs...))
}
// ConsumedAtNotIn applies the NotIn predicate on the "consumed_at" field.
func ConsumedAtNotIn(vs ...time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotIn(FieldConsumedAt, vs...))
}
// ConsumedAtGT applies the GT predicate on the "consumed_at" field.
func ConsumedAtGT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGT(FieldConsumedAt, v))
}
// ConsumedAtGTE applies the GTE predicate on the "consumed_at" field.
func ConsumedAtGTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldGTE(FieldConsumedAt, v))
}
// ConsumedAtLT applies the LT predicate on the "consumed_at" field.
func ConsumedAtLT(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLT(FieldConsumedAt, v))
}
// ConsumedAtLTE applies the LTE predicate on the "consumed_at" field.
func ConsumedAtLTE(v time.Time) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldLTE(FieldConsumedAt, v))
}
// ConsumedAtIsNil applies the IsNil predicate on the "consumed_at" field.
func ConsumedAtIsNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldIsNull(FieldConsumedAt))
}
// ConsumedAtNotNil applies the NotNil predicate on the "consumed_at" field.
func ConsumedAtNotNil() predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.FieldNotNull(FieldConsumedAt))
}
// HasTargetUser applies the HasEdge predicate on the "target_user" edge.
func HasTargetUser() predicate.PendingAuthSession {
return predicate.PendingAuthSession(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, TargetUserTable, TargetUserColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasTargetUserWith applies the HasEdge predicate on the "target_user" edge with a given conditions (other predicates).
func HasTargetUserWith(preds ...predicate.User) predicate.PendingAuthSession {
return predicate.PendingAuthSession(func(s *sql.Selector) {
step := newTargetUserStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// HasAdoptionDecision applies the HasEdge predicate on the "adoption_decision" edge.
func HasAdoptionDecision() predicate.PendingAuthSession {
return predicate.PendingAuthSession(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, AdoptionDecisionTable, AdoptionDecisionColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasAdoptionDecisionWith applies the HasEdge predicate on the "adoption_decision" edge with a given conditions (other predicates).
func HasAdoptionDecisionWith(preds ...predicate.IdentityAdoptionDecision) predicate.PendingAuthSession {
return predicate.PendingAuthSession(func(s *sql.Selector) {
step := newAdoptionDecisionStep()
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
for _, p := range preds {
p(s)
}
})
})
}
// And groups predicates with the AND operator between them.
func And(predicates ...predicate.PendingAuthSession) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.AndPredicates(predicates...))
}
// Or groups predicates with the OR operator between them.
func Or(predicates ...predicate.PendingAuthSession) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.OrPredicates(predicates...))
}
// Not applies the not operator on the given predicate.
func Not(p predicate.PendingAuthSession) predicate.PendingAuthSession {
return predicate.PendingAuthSession(sql.NotPredicates(p))
}
// 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/identityadoptiondecision"
"github.com/Wei-Shaw/sub2api/ent/pendingauthsession"
"github.com/Wei-Shaw/sub2api/ent/user"
)
// PendingAuthSessionCreate is the builder for creating a PendingAuthSession entity.
type PendingAuthSessionCreate struct {
config
mutation *PendingAuthSessionMutation
hooks []Hook
conflict []sql.ConflictOption
}
// SetCreatedAt sets the "created_at" field.
func (_c *PendingAuthSessionCreate) SetCreatedAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetCreatedAt(v)
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableCreatedAt(v *time.Time) *PendingAuthSessionCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// SetUpdatedAt sets the "updated_at" field.
func (_c *PendingAuthSessionCreate) SetUpdatedAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetUpdatedAt(v)
return _c
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableUpdatedAt(v *time.Time) *PendingAuthSessionCreate {
if v != nil {
_c.SetUpdatedAt(*v)
}
return _c
}
// SetSessionToken sets the "session_token" field.
func (_c *PendingAuthSessionCreate) SetSessionToken(v string) *PendingAuthSessionCreate {
_c.mutation.SetSessionToken(v)
return _c
}
// SetIntent sets the "intent" field.
func (_c *PendingAuthSessionCreate) SetIntent(v string) *PendingAuthSessionCreate {
_c.mutation.SetIntent(v)
return _c
}
// SetProviderType sets the "provider_type" field.
func (_c *PendingAuthSessionCreate) SetProviderType(v string) *PendingAuthSessionCreate {
_c.mutation.SetProviderType(v)
return _c
}
// SetProviderKey sets the "provider_key" field.
func (_c *PendingAuthSessionCreate) SetProviderKey(v string) *PendingAuthSessionCreate {
_c.mutation.SetProviderKey(v)
return _c
}
// SetProviderSubject sets the "provider_subject" field.
func (_c *PendingAuthSessionCreate) SetProviderSubject(v string) *PendingAuthSessionCreate {
_c.mutation.SetProviderSubject(v)
return _c
}
// SetTargetUserID sets the "target_user_id" field.
func (_c *PendingAuthSessionCreate) SetTargetUserID(v int64) *PendingAuthSessionCreate {
_c.mutation.SetTargetUserID(v)
return _c
}
// SetNillableTargetUserID sets the "target_user_id" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableTargetUserID(v *int64) *PendingAuthSessionCreate {
if v != nil {
_c.SetTargetUserID(*v)
}
return _c
}
// SetRedirectTo sets the "redirect_to" field.
func (_c *PendingAuthSessionCreate) SetRedirectTo(v string) *PendingAuthSessionCreate {
_c.mutation.SetRedirectTo(v)
return _c
}
// SetNillableRedirectTo sets the "redirect_to" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableRedirectTo(v *string) *PendingAuthSessionCreate {
if v != nil {
_c.SetRedirectTo(*v)
}
return _c
}
// SetResolvedEmail sets the "resolved_email" field.
func (_c *PendingAuthSessionCreate) SetResolvedEmail(v string) *PendingAuthSessionCreate {
_c.mutation.SetResolvedEmail(v)
return _c
}
// SetNillableResolvedEmail sets the "resolved_email" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableResolvedEmail(v *string) *PendingAuthSessionCreate {
if v != nil {
_c.SetResolvedEmail(*v)
}
return _c
}
// SetRegistrationPasswordHash sets the "registration_password_hash" field.
func (_c *PendingAuthSessionCreate) SetRegistrationPasswordHash(v string) *PendingAuthSessionCreate {
_c.mutation.SetRegistrationPasswordHash(v)
return _c
}
// SetNillableRegistrationPasswordHash sets the "registration_password_hash" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableRegistrationPasswordHash(v *string) *PendingAuthSessionCreate {
if v != nil {
_c.SetRegistrationPasswordHash(*v)
}
return _c
}
// SetUpstreamIdentityClaims sets the "upstream_identity_claims" field.
func (_c *PendingAuthSessionCreate) SetUpstreamIdentityClaims(v map[string]interface{}) *PendingAuthSessionCreate {
_c.mutation.SetUpstreamIdentityClaims(v)
return _c
}
// SetLocalFlowState sets the "local_flow_state" field.
func (_c *PendingAuthSessionCreate) SetLocalFlowState(v map[string]interface{}) *PendingAuthSessionCreate {
_c.mutation.SetLocalFlowState(v)
return _c
}
// SetBrowserSessionKey sets the "browser_session_key" field.
func (_c *PendingAuthSessionCreate) SetBrowserSessionKey(v string) *PendingAuthSessionCreate {
_c.mutation.SetBrowserSessionKey(v)
return _c
}
// SetNillableBrowserSessionKey sets the "browser_session_key" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableBrowserSessionKey(v *string) *PendingAuthSessionCreate {
if v != nil {
_c.SetBrowserSessionKey(*v)
}
return _c
}
// SetCompletionCodeHash sets the "completion_code_hash" field.
func (_c *PendingAuthSessionCreate) SetCompletionCodeHash(v string) *PendingAuthSessionCreate {
_c.mutation.SetCompletionCodeHash(v)
return _c
}
// SetNillableCompletionCodeHash sets the "completion_code_hash" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableCompletionCodeHash(v *string) *PendingAuthSessionCreate {
if v != nil {
_c.SetCompletionCodeHash(*v)
}
return _c
}
// SetCompletionCodeExpiresAt sets the "completion_code_expires_at" field.
func (_c *PendingAuthSessionCreate) SetCompletionCodeExpiresAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetCompletionCodeExpiresAt(v)
return _c
}
// SetNillableCompletionCodeExpiresAt sets the "completion_code_expires_at" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableCompletionCodeExpiresAt(v *time.Time) *PendingAuthSessionCreate {
if v != nil {
_c.SetCompletionCodeExpiresAt(*v)
}
return _c
}
// SetEmailVerifiedAt sets the "email_verified_at" field.
func (_c *PendingAuthSessionCreate) SetEmailVerifiedAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetEmailVerifiedAt(v)
return _c
}
// SetNillableEmailVerifiedAt sets the "email_verified_at" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableEmailVerifiedAt(v *time.Time) *PendingAuthSessionCreate {
if v != nil {
_c.SetEmailVerifiedAt(*v)
}
return _c
}
// SetPasswordVerifiedAt sets the "password_verified_at" field.
func (_c *PendingAuthSessionCreate) SetPasswordVerifiedAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetPasswordVerifiedAt(v)
return _c
}
// SetNillablePasswordVerifiedAt sets the "password_verified_at" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillablePasswordVerifiedAt(v *time.Time) *PendingAuthSessionCreate {
if v != nil {
_c.SetPasswordVerifiedAt(*v)
}
return _c
}
// SetTotpVerifiedAt sets the "totp_verified_at" field.
func (_c *PendingAuthSessionCreate) SetTotpVerifiedAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetTotpVerifiedAt(v)
return _c
}
// SetNillableTotpVerifiedAt sets the "totp_verified_at" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableTotpVerifiedAt(v *time.Time) *PendingAuthSessionCreate {
if v != nil {
_c.SetTotpVerifiedAt(*v)
}
return _c
}
// SetExpiresAt sets the "expires_at" field.
func (_c *PendingAuthSessionCreate) SetExpiresAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetExpiresAt(v)
return _c
}
// SetConsumedAt sets the "consumed_at" field.
func (_c *PendingAuthSessionCreate) SetConsumedAt(v time.Time) *PendingAuthSessionCreate {
_c.mutation.SetConsumedAt(v)
return _c
}
// SetNillableConsumedAt sets the "consumed_at" field if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableConsumedAt(v *time.Time) *PendingAuthSessionCreate {
if v != nil {
_c.SetConsumedAt(*v)
}
return _c
}
// SetTargetUser sets the "target_user" edge to the User entity.
func (_c *PendingAuthSessionCreate) SetTargetUser(v *User) *PendingAuthSessionCreate {
return _c.SetTargetUserID(v.ID)
}
// SetAdoptionDecisionID sets the "adoption_decision" edge to the IdentityAdoptionDecision entity by ID.
func (_c *PendingAuthSessionCreate) SetAdoptionDecisionID(id int64) *PendingAuthSessionCreate {
_c.mutation.SetAdoptionDecisionID(id)
return _c
}
// SetNillableAdoptionDecisionID sets the "adoption_decision" edge to the IdentityAdoptionDecision entity by ID if the given value is not nil.
func (_c *PendingAuthSessionCreate) SetNillableAdoptionDecisionID(id *int64) *PendingAuthSessionCreate {
if id != nil {
_c = _c.SetAdoptionDecisionID(*id)
}
return _c
}
// SetAdoptionDecision sets the "adoption_decision" edge to the IdentityAdoptionDecision entity.
func (_c *PendingAuthSessionCreate) SetAdoptionDecision(v *IdentityAdoptionDecision) *PendingAuthSessionCreate {
return _c.SetAdoptionDecisionID(v.ID)
}
// Mutation returns the PendingAuthSessionMutation object of the builder.
func (_c *PendingAuthSessionCreate) Mutation() *PendingAuthSessionMutation {
return _c.mutation
}
// Save creates the PendingAuthSession in the database.
func (_c *PendingAuthSessionCreate) Save(ctx context.Context) (*PendingAuthSession, error) {
_c.defaults()
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
}
// SaveX calls Save and panics if Save returns an error.
func (_c *PendingAuthSessionCreate) SaveX(ctx context.Context) *PendingAuthSession {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PendingAuthSessionCreate) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PendingAuthSessionCreate) 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 *PendingAuthSessionCreate) defaults() {
if _, ok := _c.mutation.CreatedAt(); !ok {
v := pendingauthsession.DefaultCreatedAt()
_c.mutation.SetCreatedAt(v)
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
v := pendingauthsession.DefaultUpdatedAt()
_c.mutation.SetUpdatedAt(v)
}
if _, ok := _c.mutation.RedirectTo(); !ok {
v := pendingauthsession.DefaultRedirectTo
_c.mutation.SetRedirectTo(v)
}
if _, ok := _c.mutation.ResolvedEmail(); !ok {
v := pendingauthsession.DefaultResolvedEmail
_c.mutation.SetResolvedEmail(v)
}
if _, ok := _c.mutation.RegistrationPasswordHash(); !ok {
v := pendingauthsession.DefaultRegistrationPasswordHash
_c.mutation.SetRegistrationPasswordHash(v)
}
if _, ok := _c.mutation.UpstreamIdentityClaims(); !ok {
v := pendingauthsession.DefaultUpstreamIdentityClaims()
_c.mutation.SetUpstreamIdentityClaims(v)
}
if _, ok := _c.mutation.LocalFlowState(); !ok {
v := pendingauthsession.DefaultLocalFlowState()
_c.mutation.SetLocalFlowState(v)
}
if _, ok := _c.mutation.BrowserSessionKey(); !ok {
v := pendingauthsession.DefaultBrowserSessionKey
_c.mutation.SetBrowserSessionKey(v)
}
if _, ok := _c.mutation.CompletionCodeHash(); !ok {
v := pendingauthsession.DefaultCompletionCodeHash
_c.mutation.SetCompletionCodeHash(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_c *PendingAuthSessionCreate) check() error {
if _, ok := _c.mutation.CreatedAt(); !ok {
return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "PendingAuthSession.created_at"`)}
}
if _, ok := _c.mutation.UpdatedAt(); !ok {
return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "PendingAuthSession.updated_at"`)}
}
if _, ok := _c.mutation.SessionToken(); !ok {
return &ValidationError{Name: "session_token", err: errors.New(`ent: missing required field "PendingAuthSession.session_token"`)}
}
if v, ok := _c.mutation.SessionToken(); ok {
if err := pendingauthsession.SessionTokenValidator(v); err != nil {
return &ValidationError{Name: "session_token", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.session_token": %w`, err)}
}
}
if _, ok := _c.mutation.Intent(); !ok {
return &ValidationError{Name: "intent", err: errors.New(`ent: missing required field "PendingAuthSession.intent"`)}
}
if v, ok := _c.mutation.Intent(); ok {
if err := pendingauthsession.IntentValidator(v); err != nil {
return &ValidationError{Name: "intent", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.intent": %w`, err)}
}
}
if _, ok := _c.mutation.ProviderType(); !ok {
return &ValidationError{Name: "provider_type", err: errors.New(`ent: missing required field "PendingAuthSession.provider_type"`)}
}
if v, ok := _c.mutation.ProviderType(); ok {
if err := pendingauthsession.ProviderTypeValidator(v); err != nil {
return &ValidationError{Name: "provider_type", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_type": %w`, err)}
}
}
if _, ok := _c.mutation.ProviderKey(); !ok {
return &ValidationError{Name: "provider_key", err: errors.New(`ent: missing required field "PendingAuthSession.provider_key"`)}
}
if v, ok := _c.mutation.ProviderKey(); ok {
if err := pendingauthsession.ProviderKeyValidator(v); err != nil {
return &ValidationError{Name: "provider_key", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_key": %w`, err)}
}
}
if _, ok := _c.mutation.ProviderSubject(); !ok {
return &ValidationError{Name: "provider_subject", err: errors.New(`ent: missing required field "PendingAuthSession.provider_subject"`)}
}
if v, ok := _c.mutation.ProviderSubject(); ok {
if err := pendingauthsession.ProviderSubjectValidator(v); err != nil {
return &ValidationError{Name: "provider_subject", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_subject": %w`, err)}
}
}
if _, ok := _c.mutation.RedirectTo(); !ok {
return &ValidationError{Name: "redirect_to", err: errors.New(`ent: missing required field "PendingAuthSession.redirect_to"`)}
}
if _, ok := _c.mutation.ResolvedEmail(); !ok {
return &ValidationError{Name: "resolved_email", err: errors.New(`ent: missing required field "PendingAuthSession.resolved_email"`)}
}
if _, ok := _c.mutation.RegistrationPasswordHash(); !ok {
return &ValidationError{Name: "registration_password_hash", err: errors.New(`ent: missing required field "PendingAuthSession.registration_password_hash"`)}
}
if _, ok := _c.mutation.UpstreamIdentityClaims(); !ok {
return &ValidationError{Name: "upstream_identity_claims", err: errors.New(`ent: missing required field "PendingAuthSession.upstream_identity_claims"`)}
}
if _, ok := _c.mutation.LocalFlowState(); !ok {
return &ValidationError{Name: "local_flow_state", err: errors.New(`ent: missing required field "PendingAuthSession.local_flow_state"`)}
}
if _, ok := _c.mutation.BrowserSessionKey(); !ok {
return &ValidationError{Name: "browser_session_key", err: errors.New(`ent: missing required field "PendingAuthSession.browser_session_key"`)}
}
if _, ok := _c.mutation.CompletionCodeHash(); !ok {
return &ValidationError{Name: "completion_code_hash", err: errors.New(`ent: missing required field "PendingAuthSession.completion_code_hash"`)}
}
if _, ok := _c.mutation.ExpiresAt(); !ok {
return &ValidationError{Name: "expires_at", err: errors.New(`ent: missing required field "PendingAuthSession.expires_at"`)}
}
return nil
}
func (_c *PendingAuthSessionCreate) sqlSave(ctx context.Context) (*PendingAuthSession, 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 *PendingAuthSessionCreate) createSpec() (*PendingAuthSession, *sqlgraph.CreateSpec) {
var (
_node = &PendingAuthSession{config: _c.config}
_spec = sqlgraph.NewCreateSpec(pendingauthsession.Table, sqlgraph.NewFieldSpec(pendingauthsession.FieldID, field.TypeInt64))
)
_spec.OnConflict = _c.conflict
if value, ok := _c.mutation.CreatedAt(); ok {
_spec.SetField(pendingauthsession.FieldCreatedAt, field.TypeTime, value)
_node.CreatedAt = value
}
if value, ok := _c.mutation.UpdatedAt(); ok {
_spec.SetField(pendingauthsession.FieldUpdatedAt, field.TypeTime, value)
_node.UpdatedAt = value
}
if value, ok := _c.mutation.SessionToken(); ok {
_spec.SetField(pendingauthsession.FieldSessionToken, field.TypeString, value)
_node.SessionToken = value
}
if value, ok := _c.mutation.Intent(); ok {
_spec.SetField(pendingauthsession.FieldIntent, field.TypeString, value)
_node.Intent = value
}
if value, ok := _c.mutation.ProviderType(); ok {
_spec.SetField(pendingauthsession.FieldProviderType, field.TypeString, value)
_node.ProviderType = value
}
if value, ok := _c.mutation.ProviderKey(); ok {
_spec.SetField(pendingauthsession.FieldProviderKey, field.TypeString, value)
_node.ProviderKey = value
}
if value, ok := _c.mutation.ProviderSubject(); ok {
_spec.SetField(pendingauthsession.FieldProviderSubject, field.TypeString, value)
_node.ProviderSubject = value
}
if value, ok := _c.mutation.RedirectTo(); ok {
_spec.SetField(pendingauthsession.FieldRedirectTo, field.TypeString, value)
_node.RedirectTo = value
}
if value, ok := _c.mutation.ResolvedEmail(); ok {
_spec.SetField(pendingauthsession.FieldResolvedEmail, field.TypeString, value)
_node.ResolvedEmail = value
}
if value, ok := _c.mutation.RegistrationPasswordHash(); ok {
_spec.SetField(pendingauthsession.FieldRegistrationPasswordHash, field.TypeString, value)
_node.RegistrationPasswordHash = value
}
if value, ok := _c.mutation.UpstreamIdentityClaims(); ok {
_spec.SetField(pendingauthsession.FieldUpstreamIdentityClaims, field.TypeJSON, value)
_node.UpstreamIdentityClaims = value
}
if value, ok := _c.mutation.LocalFlowState(); ok {
_spec.SetField(pendingauthsession.FieldLocalFlowState, field.TypeJSON, value)
_node.LocalFlowState = value
}
if value, ok := _c.mutation.BrowserSessionKey(); ok {
_spec.SetField(pendingauthsession.FieldBrowserSessionKey, field.TypeString, value)
_node.BrowserSessionKey = value
}
if value, ok := _c.mutation.CompletionCodeHash(); ok {
_spec.SetField(pendingauthsession.FieldCompletionCodeHash, field.TypeString, value)
_node.CompletionCodeHash = value
}
if value, ok := _c.mutation.CompletionCodeExpiresAt(); ok {
_spec.SetField(pendingauthsession.FieldCompletionCodeExpiresAt, field.TypeTime, value)
_node.CompletionCodeExpiresAt = &value
}
if value, ok := _c.mutation.EmailVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldEmailVerifiedAt, field.TypeTime, value)
_node.EmailVerifiedAt = &value
}
if value, ok := _c.mutation.PasswordVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldPasswordVerifiedAt, field.TypeTime, value)
_node.PasswordVerifiedAt = &value
}
if value, ok := _c.mutation.TotpVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldTotpVerifiedAt, field.TypeTime, value)
_node.TotpVerifiedAt = &value
}
if value, ok := _c.mutation.ExpiresAt(); ok {
_spec.SetField(pendingauthsession.FieldExpiresAt, field.TypeTime, value)
_node.ExpiresAt = value
}
if value, ok := _c.mutation.ConsumedAt(); ok {
_spec.SetField(pendingauthsession.FieldConsumedAt, field.TypeTime, value)
_node.ConsumedAt = &value
}
if nodes := _c.mutation.TargetUserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: pendingauthsession.TargetUserTable,
Columns: []string{pendingauthsession.TargetUserColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_node.TargetUserID = &nodes[0]
_spec.Edges = append(_spec.Edges, edge)
}
if nodes := _c.mutation.AdoptionDecisionIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
Table: pendingauthsession.AdoptionDecisionTable,
Columns: []string{pendingauthsession.AdoptionDecisionColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(identityadoptiondecision.FieldID, field.TypeInt64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges = append(_spec.Edges, edge)
}
return _node, _spec
}
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
// of the `INSERT` statement. For example:
//
// client.PendingAuthSession.Create().
// SetCreatedAt(v).
// OnConflict(
// // Update the row with the new values
// // the was proposed for insertion.
// sql.ResolveWithNewValues(),
// ).
// // Override some of the fields with custom
// // update values.
// Update(func(u *ent.PendingAuthSessionUpsert) {
// SetCreatedAt(v+v).
// }).
// Exec(ctx)
func (_c *PendingAuthSessionCreate) OnConflict(opts ...sql.ConflictOption) *PendingAuthSessionUpsertOne {
_c.conflict = opts
return &PendingAuthSessionUpsertOne{
create: _c,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.PendingAuthSession.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (_c *PendingAuthSessionCreate) OnConflictColumns(columns ...string) *PendingAuthSessionUpsertOne {
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
return &PendingAuthSessionUpsertOne{
create: _c,
}
}
type (
// PendingAuthSessionUpsertOne is the builder for "upsert"-ing
// one PendingAuthSession node.
PendingAuthSessionUpsertOne struct {
create *PendingAuthSessionCreate
}
// PendingAuthSessionUpsert is the "OnConflict" setter.
PendingAuthSessionUpsert struct {
*sql.UpdateSet
}
)
// SetUpdatedAt sets the "updated_at" field.
func (u *PendingAuthSessionUpsert) SetUpdatedAt(v time.Time) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldUpdatedAt, v)
return u
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateUpdatedAt() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldUpdatedAt)
return u
}
// SetSessionToken sets the "session_token" field.
func (u *PendingAuthSessionUpsert) SetSessionToken(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldSessionToken, v)
return u
}
// UpdateSessionToken sets the "session_token" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateSessionToken() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldSessionToken)
return u
}
// SetIntent sets the "intent" field.
func (u *PendingAuthSessionUpsert) SetIntent(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldIntent, v)
return u
}
// UpdateIntent sets the "intent" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateIntent() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldIntent)
return u
}
// SetProviderType sets the "provider_type" field.
func (u *PendingAuthSessionUpsert) SetProviderType(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldProviderType, v)
return u
}
// UpdateProviderType sets the "provider_type" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateProviderType() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldProviderType)
return u
}
// SetProviderKey sets the "provider_key" field.
func (u *PendingAuthSessionUpsert) SetProviderKey(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldProviderKey, v)
return u
}
// UpdateProviderKey sets the "provider_key" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateProviderKey() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldProviderKey)
return u
}
// SetProviderSubject sets the "provider_subject" field.
func (u *PendingAuthSessionUpsert) SetProviderSubject(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldProviderSubject, v)
return u
}
// UpdateProviderSubject sets the "provider_subject" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateProviderSubject() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldProviderSubject)
return u
}
// SetTargetUserID sets the "target_user_id" field.
func (u *PendingAuthSessionUpsert) SetTargetUserID(v int64) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldTargetUserID, v)
return u
}
// UpdateTargetUserID sets the "target_user_id" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateTargetUserID() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldTargetUserID)
return u
}
// ClearTargetUserID clears the value of the "target_user_id" field.
func (u *PendingAuthSessionUpsert) ClearTargetUserID() *PendingAuthSessionUpsert {
u.SetNull(pendingauthsession.FieldTargetUserID)
return u
}
// SetRedirectTo sets the "redirect_to" field.
func (u *PendingAuthSessionUpsert) SetRedirectTo(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldRedirectTo, v)
return u
}
// UpdateRedirectTo sets the "redirect_to" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateRedirectTo() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldRedirectTo)
return u
}
// SetResolvedEmail sets the "resolved_email" field.
func (u *PendingAuthSessionUpsert) SetResolvedEmail(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldResolvedEmail, v)
return u
}
// UpdateResolvedEmail sets the "resolved_email" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateResolvedEmail() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldResolvedEmail)
return u
}
// SetRegistrationPasswordHash sets the "registration_password_hash" field.
func (u *PendingAuthSessionUpsert) SetRegistrationPasswordHash(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldRegistrationPasswordHash, v)
return u
}
// UpdateRegistrationPasswordHash sets the "registration_password_hash" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateRegistrationPasswordHash() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldRegistrationPasswordHash)
return u
}
// SetUpstreamIdentityClaims sets the "upstream_identity_claims" field.
func (u *PendingAuthSessionUpsert) SetUpstreamIdentityClaims(v map[string]interface{}) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldUpstreamIdentityClaims, v)
return u
}
// UpdateUpstreamIdentityClaims sets the "upstream_identity_claims" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateUpstreamIdentityClaims() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldUpstreamIdentityClaims)
return u
}
// SetLocalFlowState sets the "local_flow_state" field.
func (u *PendingAuthSessionUpsert) SetLocalFlowState(v map[string]interface{}) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldLocalFlowState, v)
return u
}
// UpdateLocalFlowState sets the "local_flow_state" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateLocalFlowState() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldLocalFlowState)
return u
}
// SetBrowserSessionKey sets the "browser_session_key" field.
func (u *PendingAuthSessionUpsert) SetBrowserSessionKey(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldBrowserSessionKey, v)
return u
}
// UpdateBrowserSessionKey sets the "browser_session_key" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateBrowserSessionKey() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldBrowserSessionKey)
return u
}
// SetCompletionCodeHash sets the "completion_code_hash" field.
func (u *PendingAuthSessionUpsert) SetCompletionCodeHash(v string) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldCompletionCodeHash, v)
return u
}
// UpdateCompletionCodeHash sets the "completion_code_hash" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateCompletionCodeHash() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldCompletionCodeHash)
return u
}
// SetCompletionCodeExpiresAt sets the "completion_code_expires_at" field.
func (u *PendingAuthSessionUpsert) SetCompletionCodeExpiresAt(v time.Time) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldCompletionCodeExpiresAt, v)
return u
}
// UpdateCompletionCodeExpiresAt sets the "completion_code_expires_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateCompletionCodeExpiresAt() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldCompletionCodeExpiresAt)
return u
}
// ClearCompletionCodeExpiresAt clears the value of the "completion_code_expires_at" field.
func (u *PendingAuthSessionUpsert) ClearCompletionCodeExpiresAt() *PendingAuthSessionUpsert {
u.SetNull(pendingauthsession.FieldCompletionCodeExpiresAt)
return u
}
// SetEmailVerifiedAt sets the "email_verified_at" field.
func (u *PendingAuthSessionUpsert) SetEmailVerifiedAt(v time.Time) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldEmailVerifiedAt, v)
return u
}
// UpdateEmailVerifiedAt sets the "email_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateEmailVerifiedAt() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldEmailVerifiedAt)
return u
}
// ClearEmailVerifiedAt clears the value of the "email_verified_at" field.
func (u *PendingAuthSessionUpsert) ClearEmailVerifiedAt() *PendingAuthSessionUpsert {
u.SetNull(pendingauthsession.FieldEmailVerifiedAt)
return u
}
// SetPasswordVerifiedAt sets the "password_verified_at" field.
func (u *PendingAuthSessionUpsert) SetPasswordVerifiedAt(v time.Time) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldPasswordVerifiedAt, v)
return u
}
// UpdatePasswordVerifiedAt sets the "password_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdatePasswordVerifiedAt() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldPasswordVerifiedAt)
return u
}
// ClearPasswordVerifiedAt clears the value of the "password_verified_at" field.
func (u *PendingAuthSessionUpsert) ClearPasswordVerifiedAt() *PendingAuthSessionUpsert {
u.SetNull(pendingauthsession.FieldPasswordVerifiedAt)
return u
}
// SetTotpVerifiedAt sets the "totp_verified_at" field.
func (u *PendingAuthSessionUpsert) SetTotpVerifiedAt(v time.Time) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldTotpVerifiedAt, v)
return u
}
// UpdateTotpVerifiedAt sets the "totp_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateTotpVerifiedAt() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldTotpVerifiedAt)
return u
}
// ClearTotpVerifiedAt clears the value of the "totp_verified_at" field.
func (u *PendingAuthSessionUpsert) ClearTotpVerifiedAt() *PendingAuthSessionUpsert {
u.SetNull(pendingauthsession.FieldTotpVerifiedAt)
return u
}
// SetExpiresAt sets the "expires_at" field.
func (u *PendingAuthSessionUpsert) SetExpiresAt(v time.Time) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldExpiresAt, v)
return u
}
// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateExpiresAt() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldExpiresAt)
return u
}
// SetConsumedAt sets the "consumed_at" field.
func (u *PendingAuthSessionUpsert) SetConsumedAt(v time.Time) *PendingAuthSessionUpsert {
u.Set(pendingauthsession.FieldConsumedAt, v)
return u
}
// UpdateConsumedAt sets the "consumed_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsert) UpdateConsumedAt() *PendingAuthSessionUpsert {
u.SetExcluded(pendingauthsession.FieldConsumedAt)
return u
}
// ClearConsumedAt clears the value of the "consumed_at" field.
func (u *PendingAuthSessionUpsert) ClearConsumedAt() *PendingAuthSessionUpsert {
u.SetNull(pendingauthsession.FieldConsumedAt)
return u
}
// UpdateNewValues updates the mutable fields using the new values that were set on create.
// Using this option is equivalent to using:
//
// client.PendingAuthSession.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func (u *PendingAuthSessionUpsertOne) UpdateNewValues() *PendingAuthSessionUpsertOne {
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(pendingauthsession.FieldCreatedAt)
}
}))
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.PendingAuthSession.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *PendingAuthSessionUpsertOne) Ignore() *PendingAuthSessionUpsertOne {
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 *PendingAuthSessionUpsertOne) DoNothing() *PendingAuthSessionUpsertOne {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the PendingAuthSessionCreate.OnConflict
// documentation for more info.
func (u *PendingAuthSessionUpsertOne) Update(set func(*PendingAuthSessionUpsert)) *PendingAuthSessionUpsertOne {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&PendingAuthSessionUpsert{UpdateSet: update})
}))
return u
}
// SetUpdatedAt sets the "updated_at" field.
func (u *PendingAuthSessionUpsertOne) SetUpdatedAt(v time.Time) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetUpdatedAt(v)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateUpdatedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateUpdatedAt()
})
}
// SetSessionToken sets the "session_token" field.
func (u *PendingAuthSessionUpsertOne) SetSessionToken(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetSessionToken(v)
})
}
// UpdateSessionToken sets the "session_token" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateSessionToken() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateSessionToken()
})
}
// SetIntent sets the "intent" field.
func (u *PendingAuthSessionUpsertOne) SetIntent(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetIntent(v)
})
}
// UpdateIntent sets the "intent" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateIntent() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateIntent()
})
}
// SetProviderType sets the "provider_type" field.
func (u *PendingAuthSessionUpsertOne) SetProviderType(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetProviderType(v)
})
}
// UpdateProviderType sets the "provider_type" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateProviderType() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateProviderType()
})
}
// SetProviderKey sets the "provider_key" field.
func (u *PendingAuthSessionUpsertOne) SetProviderKey(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetProviderKey(v)
})
}
// UpdateProviderKey sets the "provider_key" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateProviderKey() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateProviderKey()
})
}
// SetProviderSubject sets the "provider_subject" field.
func (u *PendingAuthSessionUpsertOne) SetProviderSubject(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetProviderSubject(v)
})
}
// UpdateProviderSubject sets the "provider_subject" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateProviderSubject() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateProviderSubject()
})
}
// SetTargetUserID sets the "target_user_id" field.
func (u *PendingAuthSessionUpsertOne) SetTargetUserID(v int64) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetTargetUserID(v)
})
}
// UpdateTargetUserID sets the "target_user_id" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateTargetUserID() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateTargetUserID()
})
}
// ClearTargetUserID clears the value of the "target_user_id" field.
func (u *PendingAuthSessionUpsertOne) ClearTargetUserID() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearTargetUserID()
})
}
// SetRedirectTo sets the "redirect_to" field.
func (u *PendingAuthSessionUpsertOne) SetRedirectTo(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetRedirectTo(v)
})
}
// UpdateRedirectTo sets the "redirect_to" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateRedirectTo() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateRedirectTo()
})
}
// SetResolvedEmail sets the "resolved_email" field.
func (u *PendingAuthSessionUpsertOne) SetResolvedEmail(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetResolvedEmail(v)
})
}
// UpdateResolvedEmail sets the "resolved_email" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateResolvedEmail() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateResolvedEmail()
})
}
// SetRegistrationPasswordHash sets the "registration_password_hash" field.
func (u *PendingAuthSessionUpsertOne) SetRegistrationPasswordHash(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetRegistrationPasswordHash(v)
})
}
// UpdateRegistrationPasswordHash sets the "registration_password_hash" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateRegistrationPasswordHash() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateRegistrationPasswordHash()
})
}
// SetUpstreamIdentityClaims sets the "upstream_identity_claims" field.
func (u *PendingAuthSessionUpsertOne) SetUpstreamIdentityClaims(v map[string]interface{}) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetUpstreamIdentityClaims(v)
})
}
// UpdateUpstreamIdentityClaims sets the "upstream_identity_claims" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateUpstreamIdentityClaims() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateUpstreamIdentityClaims()
})
}
// SetLocalFlowState sets the "local_flow_state" field.
func (u *PendingAuthSessionUpsertOne) SetLocalFlowState(v map[string]interface{}) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetLocalFlowState(v)
})
}
// UpdateLocalFlowState sets the "local_flow_state" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateLocalFlowState() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateLocalFlowState()
})
}
// SetBrowserSessionKey sets the "browser_session_key" field.
func (u *PendingAuthSessionUpsertOne) SetBrowserSessionKey(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetBrowserSessionKey(v)
})
}
// UpdateBrowserSessionKey sets the "browser_session_key" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateBrowserSessionKey() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateBrowserSessionKey()
})
}
// SetCompletionCodeHash sets the "completion_code_hash" field.
func (u *PendingAuthSessionUpsertOne) SetCompletionCodeHash(v string) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetCompletionCodeHash(v)
})
}
// UpdateCompletionCodeHash sets the "completion_code_hash" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateCompletionCodeHash() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateCompletionCodeHash()
})
}
// SetCompletionCodeExpiresAt sets the "completion_code_expires_at" field.
func (u *PendingAuthSessionUpsertOne) SetCompletionCodeExpiresAt(v time.Time) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetCompletionCodeExpiresAt(v)
})
}
// UpdateCompletionCodeExpiresAt sets the "completion_code_expires_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateCompletionCodeExpiresAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateCompletionCodeExpiresAt()
})
}
// ClearCompletionCodeExpiresAt clears the value of the "completion_code_expires_at" field.
func (u *PendingAuthSessionUpsertOne) ClearCompletionCodeExpiresAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearCompletionCodeExpiresAt()
})
}
// SetEmailVerifiedAt sets the "email_verified_at" field.
func (u *PendingAuthSessionUpsertOne) SetEmailVerifiedAt(v time.Time) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetEmailVerifiedAt(v)
})
}
// UpdateEmailVerifiedAt sets the "email_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateEmailVerifiedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateEmailVerifiedAt()
})
}
// ClearEmailVerifiedAt clears the value of the "email_verified_at" field.
func (u *PendingAuthSessionUpsertOne) ClearEmailVerifiedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearEmailVerifiedAt()
})
}
// SetPasswordVerifiedAt sets the "password_verified_at" field.
func (u *PendingAuthSessionUpsertOne) SetPasswordVerifiedAt(v time.Time) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetPasswordVerifiedAt(v)
})
}
// UpdatePasswordVerifiedAt sets the "password_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdatePasswordVerifiedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdatePasswordVerifiedAt()
})
}
// ClearPasswordVerifiedAt clears the value of the "password_verified_at" field.
func (u *PendingAuthSessionUpsertOne) ClearPasswordVerifiedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearPasswordVerifiedAt()
})
}
// SetTotpVerifiedAt sets the "totp_verified_at" field.
func (u *PendingAuthSessionUpsertOne) SetTotpVerifiedAt(v time.Time) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetTotpVerifiedAt(v)
})
}
// UpdateTotpVerifiedAt sets the "totp_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateTotpVerifiedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateTotpVerifiedAt()
})
}
// ClearTotpVerifiedAt clears the value of the "totp_verified_at" field.
func (u *PendingAuthSessionUpsertOne) ClearTotpVerifiedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearTotpVerifiedAt()
})
}
// SetExpiresAt sets the "expires_at" field.
func (u *PendingAuthSessionUpsertOne) SetExpiresAt(v time.Time) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetExpiresAt(v)
})
}
// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateExpiresAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateExpiresAt()
})
}
// SetConsumedAt sets the "consumed_at" field.
func (u *PendingAuthSessionUpsertOne) SetConsumedAt(v time.Time) *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetConsumedAt(v)
})
}
// UpdateConsumedAt sets the "consumed_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertOne) UpdateConsumedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateConsumedAt()
})
}
// ClearConsumedAt clears the value of the "consumed_at" field.
func (u *PendingAuthSessionUpsertOne) ClearConsumedAt() *PendingAuthSessionUpsertOne {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearConsumedAt()
})
}
// Exec executes the query.
func (u *PendingAuthSessionUpsertOne) Exec(ctx context.Context) error {
if len(u.create.conflict) == 0 {
return errors.New("ent: missing options for PendingAuthSessionCreate.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *PendingAuthSessionUpsertOne) 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 *PendingAuthSessionUpsertOne) 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 *PendingAuthSessionUpsertOne) IDX(ctx context.Context) int64 {
id, err := u.ID(ctx)
if err != nil {
panic(err)
}
return id
}
// PendingAuthSessionCreateBulk is the builder for creating many PendingAuthSession entities in bulk.
type PendingAuthSessionCreateBulk struct {
config
err error
builders []*PendingAuthSessionCreate
conflict []sql.ConflictOption
}
// Save creates the PendingAuthSession entities in the database.
func (_c *PendingAuthSessionCreateBulk) Save(ctx context.Context) ([]*PendingAuthSession, error) {
if _c.err != nil {
return nil, _c.err
}
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
nodes := make([]*PendingAuthSession, 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.(*PendingAuthSessionMutation)
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 *PendingAuthSessionCreateBulk) SaveX(ctx context.Context) []*PendingAuthSession {
v, err := _c.Save(ctx)
if err != nil {
panic(err)
}
return v
}
// Exec executes the query.
func (_c *PendingAuthSessionCreateBulk) Exec(ctx context.Context) error {
_, err := _c.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_c *PendingAuthSessionCreateBulk) 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.PendingAuthSession.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.PendingAuthSessionUpsert) {
// SetCreatedAt(v+v).
// }).
// Exec(ctx)
func (_c *PendingAuthSessionCreateBulk) OnConflict(opts ...sql.ConflictOption) *PendingAuthSessionUpsertBulk {
_c.conflict = opts
return &PendingAuthSessionUpsertBulk{
create: _c,
}
}
// OnConflictColumns calls `OnConflict` and configures the columns
// as conflict target. Using this option is equivalent to using:
//
// client.PendingAuthSession.Create().
// OnConflict(sql.ConflictColumns(columns...)).
// Exec(ctx)
func (_c *PendingAuthSessionCreateBulk) OnConflictColumns(columns ...string) *PendingAuthSessionUpsertBulk {
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
return &PendingAuthSessionUpsertBulk{
create: _c,
}
}
// PendingAuthSessionUpsertBulk is the builder for "upsert"-ing
// a bulk of PendingAuthSession nodes.
type PendingAuthSessionUpsertBulk struct {
create *PendingAuthSessionCreateBulk
}
// UpdateNewValues updates the mutable fields using the new values that
// were set on create. Using this option is equivalent to using:
//
// client.PendingAuthSession.Create().
// OnConflict(
// sql.ResolveWithNewValues(),
// ).
// Exec(ctx)
func (u *PendingAuthSessionUpsertBulk) UpdateNewValues() *PendingAuthSessionUpsertBulk {
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(pendingauthsession.FieldCreatedAt)
}
}
}))
return u
}
// Ignore sets each column to itself in case of conflict.
// Using this option is equivalent to using:
//
// client.PendingAuthSession.Create().
// OnConflict(sql.ResolveWithIgnore()).
// Exec(ctx)
func (u *PendingAuthSessionUpsertBulk) Ignore() *PendingAuthSessionUpsertBulk {
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 *PendingAuthSessionUpsertBulk) DoNothing() *PendingAuthSessionUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.DoNothing())
return u
}
// Update allows overriding fields `UPDATE` values. See the PendingAuthSessionCreateBulk.OnConflict
// documentation for more info.
func (u *PendingAuthSessionUpsertBulk) Update(set func(*PendingAuthSessionUpsert)) *PendingAuthSessionUpsertBulk {
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
set(&PendingAuthSessionUpsert{UpdateSet: update})
}))
return u
}
// SetUpdatedAt sets the "updated_at" field.
func (u *PendingAuthSessionUpsertBulk) SetUpdatedAt(v time.Time) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetUpdatedAt(v)
})
}
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateUpdatedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateUpdatedAt()
})
}
// SetSessionToken sets the "session_token" field.
func (u *PendingAuthSessionUpsertBulk) SetSessionToken(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetSessionToken(v)
})
}
// UpdateSessionToken sets the "session_token" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateSessionToken() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateSessionToken()
})
}
// SetIntent sets the "intent" field.
func (u *PendingAuthSessionUpsertBulk) SetIntent(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetIntent(v)
})
}
// UpdateIntent sets the "intent" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateIntent() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateIntent()
})
}
// SetProviderType sets the "provider_type" field.
func (u *PendingAuthSessionUpsertBulk) SetProviderType(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetProviderType(v)
})
}
// UpdateProviderType sets the "provider_type" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateProviderType() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateProviderType()
})
}
// SetProviderKey sets the "provider_key" field.
func (u *PendingAuthSessionUpsertBulk) SetProviderKey(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetProviderKey(v)
})
}
// UpdateProviderKey sets the "provider_key" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateProviderKey() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateProviderKey()
})
}
// SetProviderSubject sets the "provider_subject" field.
func (u *PendingAuthSessionUpsertBulk) SetProviderSubject(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetProviderSubject(v)
})
}
// UpdateProviderSubject sets the "provider_subject" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateProviderSubject() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateProviderSubject()
})
}
// SetTargetUserID sets the "target_user_id" field.
func (u *PendingAuthSessionUpsertBulk) SetTargetUserID(v int64) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetTargetUserID(v)
})
}
// UpdateTargetUserID sets the "target_user_id" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateTargetUserID() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateTargetUserID()
})
}
// ClearTargetUserID clears the value of the "target_user_id" field.
func (u *PendingAuthSessionUpsertBulk) ClearTargetUserID() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearTargetUserID()
})
}
// SetRedirectTo sets the "redirect_to" field.
func (u *PendingAuthSessionUpsertBulk) SetRedirectTo(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetRedirectTo(v)
})
}
// UpdateRedirectTo sets the "redirect_to" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateRedirectTo() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateRedirectTo()
})
}
// SetResolvedEmail sets the "resolved_email" field.
func (u *PendingAuthSessionUpsertBulk) SetResolvedEmail(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetResolvedEmail(v)
})
}
// UpdateResolvedEmail sets the "resolved_email" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateResolvedEmail() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateResolvedEmail()
})
}
// SetRegistrationPasswordHash sets the "registration_password_hash" field.
func (u *PendingAuthSessionUpsertBulk) SetRegistrationPasswordHash(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetRegistrationPasswordHash(v)
})
}
// UpdateRegistrationPasswordHash sets the "registration_password_hash" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateRegistrationPasswordHash() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateRegistrationPasswordHash()
})
}
// SetUpstreamIdentityClaims sets the "upstream_identity_claims" field.
func (u *PendingAuthSessionUpsertBulk) SetUpstreamIdentityClaims(v map[string]interface{}) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetUpstreamIdentityClaims(v)
})
}
// UpdateUpstreamIdentityClaims sets the "upstream_identity_claims" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateUpstreamIdentityClaims() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateUpstreamIdentityClaims()
})
}
// SetLocalFlowState sets the "local_flow_state" field.
func (u *PendingAuthSessionUpsertBulk) SetLocalFlowState(v map[string]interface{}) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetLocalFlowState(v)
})
}
// UpdateLocalFlowState sets the "local_flow_state" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateLocalFlowState() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateLocalFlowState()
})
}
// SetBrowserSessionKey sets the "browser_session_key" field.
func (u *PendingAuthSessionUpsertBulk) SetBrowserSessionKey(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetBrowserSessionKey(v)
})
}
// UpdateBrowserSessionKey sets the "browser_session_key" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateBrowserSessionKey() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateBrowserSessionKey()
})
}
// SetCompletionCodeHash sets the "completion_code_hash" field.
func (u *PendingAuthSessionUpsertBulk) SetCompletionCodeHash(v string) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetCompletionCodeHash(v)
})
}
// UpdateCompletionCodeHash sets the "completion_code_hash" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateCompletionCodeHash() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateCompletionCodeHash()
})
}
// SetCompletionCodeExpiresAt sets the "completion_code_expires_at" field.
func (u *PendingAuthSessionUpsertBulk) SetCompletionCodeExpiresAt(v time.Time) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetCompletionCodeExpiresAt(v)
})
}
// UpdateCompletionCodeExpiresAt sets the "completion_code_expires_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateCompletionCodeExpiresAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateCompletionCodeExpiresAt()
})
}
// ClearCompletionCodeExpiresAt clears the value of the "completion_code_expires_at" field.
func (u *PendingAuthSessionUpsertBulk) ClearCompletionCodeExpiresAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearCompletionCodeExpiresAt()
})
}
// SetEmailVerifiedAt sets the "email_verified_at" field.
func (u *PendingAuthSessionUpsertBulk) SetEmailVerifiedAt(v time.Time) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetEmailVerifiedAt(v)
})
}
// UpdateEmailVerifiedAt sets the "email_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateEmailVerifiedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateEmailVerifiedAt()
})
}
// ClearEmailVerifiedAt clears the value of the "email_verified_at" field.
func (u *PendingAuthSessionUpsertBulk) ClearEmailVerifiedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearEmailVerifiedAt()
})
}
// SetPasswordVerifiedAt sets the "password_verified_at" field.
func (u *PendingAuthSessionUpsertBulk) SetPasswordVerifiedAt(v time.Time) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetPasswordVerifiedAt(v)
})
}
// UpdatePasswordVerifiedAt sets the "password_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdatePasswordVerifiedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdatePasswordVerifiedAt()
})
}
// ClearPasswordVerifiedAt clears the value of the "password_verified_at" field.
func (u *PendingAuthSessionUpsertBulk) ClearPasswordVerifiedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearPasswordVerifiedAt()
})
}
// SetTotpVerifiedAt sets the "totp_verified_at" field.
func (u *PendingAuthSessionUpsertBulk) SetTotpVerifiedAt(v time.Time) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetTotpVerifiedAt(v)
})
}
// UpdateTotpVerifiedAt sets the "totp_verified_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateTotpVerifiedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateTotpVerifiedAt()
})
}
// ClearTotpVerifiedAt clears the value of the "totp_verified_at" field.
func (u *PendingAuthSessionUpsertBulk) ClearTotpVerifiedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearTotpVerifiedAt()
})
}
// SetExpiresAt sets the "expires_at" field.
func (u *PendingAuthSessionUpsertBulk) SetExpiresAt(v time.Time) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetExpiresAt(v)
})
}
// UpdateExpiresAt sets the "expires_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateExpiresAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateExpiresAt()
})
}
// SetConsumedAt sets the "consumed_at" field.
func (u *PendingAuthSessionUpsertBulk) SetConsumedAt(v time.Time) *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.SetConsumedAt(v)
})
}
// UpdateConsumedAt sets the "consumed_at" field to the value that was provided on create.
func (u *PendingAuthSessionUpsertBulk) UpdateConsumedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.UpdateConsumedAt()
})
}
// ClearConsumedAt clears the value of the "consumed_at" field.
func (u *PendingAuthSessionUpsertBulk) ClearConsumedAt() *PendingAuthSessionUpsertBulk {
return u.Update(func(s *PendingAuthSessionUpsert) {
s.ClearConsumedAt()
})
}
// Exec executes the query.
func (u *PendingAuthSessionUpsertBulk) 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 PendingAuthSessionCreateBulk instead", i)
}
}
if len(u.create.conflict) == 0 {
return errors.New("ent: missing options for PendingAuthSessionCreateBulk.OnConflict")
}
return u.create.Exec(ctx)
}
// ExecX is like Exec, but panics if an error occurs.
func (u *PendingAuthSessionUpsertBulk) ExecX(ctx context.Context) {
if err := u.create.Exec(ctx); err != nil {
panic(err)
}
}
// 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/pendingauthsession"
"github.com/Wei-Shaw/sub2api/ent/predicate"
)
// PendingAuthSessionDelete is the builder for deleting a PendingAuthSession entity.
type PendingAuthSessionDelete struct {
config
hooks []Hook
mutation *PendingAuthSessionMutation
}
// Where appends a list predicates to the PendingAuthSessionDelete builder.
func (_d *PendingAuthSessionDelete) Where(ps ...predicate.PendingAuthSession) *PendingAuthSessionDelete {
_d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query and returns how many vertices were deleted.
func (_d *PendingAuthSessionDelete) 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 *PendingAuthSessionDelete) ExecX(ctx context.Context) int {
n, err := _d.Exec(ctx)
if err != nil {
panic(err)
}
return n
}
func (_d *PendingAuthSessionDelete) sqlExec(ctx context.Context) (int, error) {
_spec := sqlgraph.NewDeleteSpec(pendingauthsession.Table, sqlgraph.NewFieldSpec(pendingauthsession.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
}
// PendingAuthSessionDeleteOne is the builder for deleting a single PendingAuthSession entity.
type PendingAuthSessionDeleteOne struct {
_d *PendingAuthSessionDelete
}
// Where appends a list predicates to the PendingAuthSessionDelete builder.
func (_d *PendingAuthSessionDeleteOne) Where(ps ...predicate.PendingAuthSession) *PendingAuthSessionDeleteOne {
_d._d.mutation.Where(ps...)
return _d
}
// Exec executes the deletion query.
func (_d *PendingAuthSessionDeleteOne) Exec(ctx context.Context) error {
n, err := _d._d.Exec(ctx)
switch {
case err != nil:
return err
case n == 0:
return &NotFoundError{pendingauthsession.Label}
default:
return nil
}
}
// ExecX is like Exec, but panics if an error occurs.
func (_d *PendingAuthSessionDeleteOne) ExecX(ctx context.Context) {
if err := _d.Exec(ctx); err != nil {
panic(err)
}
}
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"database/sql/driver"
"fmt"
"math"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Wei-Shaw/sub2api/ent/identityadoptiondecision"
"github.com/Wei-Shaw/sub2api/ent/pendingauthsession"
"github.com/Wei-Shaw/sub2api/ent/predicate"
"github.com/Wei-Shaw/sub2api/ent/user"
)
// PendingAuthSessionQuery is the builder for querying PendingAuthSession entities.
type PendingAuthSessionQuery struct {
config
ctx *QueryContext
order []pendingauthsession.OrderOption
inters []Interceptor
predicates []predicate.PendingAuthSession
withTargetUser *UserQuery
withAdoptionDecision *IdentityAdoptionDecisionQuery
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 PendingAuthSessionQuery builder.
func (_q *PendingAuthSessionQuery) Where(ps ...predicate.PendingAuthSession) *PendingAuthSessionQuery {
_q.predicates = append(_q.predicates, ps...)
return _q
}
// Limit the number of records to be returned by this query.
func (_q *PendingAuthSessionQuery) Limit(limit int) *PendingAuthSessionQuery {
_q.ctx.Limit = &limit
return _q
}
// Offset to start from.
func (_q *PendingAuthSessionQuery) Offset(offset int) *PendingAuthSessionQuery {
_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 *PendingAuthSessionQuery) Unique(unique bool) *PendingAuthSessionQuery {
_q.ctx.Unique = &unique
return _q
}
// Order specifies how the records should be ordered.
func (_q *PendingAuthSessionQuery) Order(o ...pendingauthsession.OrderOption) *PendingAuthSessionQuery {
_q.order = append(_q.order, o...)
return _q
}
// QueryTargetUser chains the current query on the "target_user" edge.
func (_q *PendingAuthSessionQuery) QueryTargetUser() *UserQuery {
query := (&UserClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(pendingauthsession.Table, pendingauthsession.FieldID, selector),
sqlgraph.To(user.Table, user.FieldID),
sqlgraph.Edge(sqlgraph.M2O, true, pendingauthsession.TargetUserTable, pendingauthsession.TargetUserColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// QueryAdoptionDecision chains the current query on the "adoption_decision" edge.
func (_q *PendingAuthSessionQuery) QueryAdoptionDecision() *IdentityAdoptionDecisionQuery {
query := (&IdentityAdoptionDecisionClient{config: _q.config}).Query()
query.path = func(ctx context.Context) (fromU *sql.Selector, err error) {
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
selector := _q.sqlQuery(ctx)
if err := selector.Err(); err != nil {
return nil, err
}
step := sqlgraph.NewStep(
sqlgraph.From(pendingauthsession.Table, pendingauthsession.FieldID, selector),
sqlgraph.To(identityadoptiondecision.Table, identityadoptiondecision.FieldID),
sqlgraph.Edge(sqlgraph.O2O, false, pendingauthsession.AdoptionDecisionTable, pendingauthsession.AdoptionDecisionColumn),
)
fromU = sqlgraph.SetNeighbors(_q.driver.Dialect(), step)
return fromU, nil
}
return query
}
// First returns the first PendingAuthSession entity from the query.
// Returns a *NotFoundError when no PendingAuthSession was found.
func (_q *PendingAuthSessionQuery) First(ctx context.Context) (*PendingAuthSession, 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{pendingauthsession.Label}
}
return nodes[0], nil
}
// FirstX is like First, but panics if an error occurs.
func (_q *PendingAuthSessionQuery) FirstX(ctx context.Context) *PendingAuthSession {
node, err := _q.First(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return node
}
// FirstID returns the first PendingAuthSession ID from the query.
// Returns a *NotFoundError when no PendingAuthSession ID was found.
func (_q *PendingAuthSessionQuery) 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{pendingauthsession.Label}
return
}
return ids[0], nil
}
// FirstIDX is like FirstID, but panics if an error occurs.
func (_q *PendingAuthSessionQuery) FirstIDX(ctx context.Context) int64 {
id, err := _q.FirstID(ctx)
if err != nil && !IsNotFound(err) {
panic(err)
}
return id
}
// Only returns a single PendingAuthSession entity found by the query, ensuring it only returns one.
// Returns a *NotSingularError when more than one PendingAuthSession entity is found.
// Returns a *NotFoundError when no PendingAuthSession entities are found.
func (_q *PendingAuthSessionQuery) Only(ctx context.Context) (*PendingAuthSession, 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{pendingauthsession.Label}
default:
return nil, &NotSingularError{pendingauthsession.Label}
}
}
// OnlyX is like Only, but panics if an error occurs.
func (_q *PendingAuthSessionQuery) OnlyX(ctx context.Context) *PendingAuthSession {
node, err := _q.Only(ctx)
if err != nil {
panic(err)
}
return node
}
// OnlyID is like Only, but returns the only PendingAuthSession ID in the query.
// Returns a *NotSingularError when more than one PendingAuthSession ID is found.
// Returns a *NotFoundError when no entities are found.
func (_q *PendingAuthSessionQuery) 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{pendingauthsession.Label}
default:
err = &NotSingularError{pendingauthsession.Label}
}
return
}
// OnlyIDX is like OnlyID, but panics if an error occurs.
func (_q *PendingAuthSessionQuery) 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 PendingAuthSessions.
func (_q *PendingAuthSessionQuery) All(ctx context.Context) ([]*PendingAuthSession, error) {
ctx = setContextOp(ctx, _q.ctx, ent.OpQueryAll)
if err := _q.prepareQuery(ctx); err != nil {
return nil, err
}
qr := querierAll[[]*PendingAuthSession, *PendingAuthSessionQuery]()
return withInterceptors[[]*PendingAuthSession](ctx, _q, qr, _q.inters)
}
// AllX is like All, but panics if an error occurs.
func (_q *PendingAuthSessionQuery) AllX(ctx context.Context) []*PendingAuthSession {
nodes, err := _q.All(ctx)
if err != nil {
panic(err)
}
return nodes
}
// IDs executes the query and returns a list of PendingAuthSession IDs.
func (_q *PendingAuthSessionQuery) 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(pendingauthsession.FieldID).Scan(ctx, &ids); err != nil {
return nil, err
}
return ids, nil
}
// IDsX is like IDs, but panics if an error occurs.
func (_q *PendingAuthSessionQuery) 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 *PendingAuthSessionQuery) 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[*PendingAuthSessionQuery](), _q.inters)
}
// CountX is like Count, but panics if an error occurs.
func (_q *PendingAuthSessionQuery) 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 *PendingAuthSessionQuery) 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 *PendingAuthSessionQuery) ExistX(ctx context.Context) bool {
exist, err := _q.Exist(ctx)
if err != nil {
panic(err)
}
return exist
}
// Clone returns a duplicate of the PendingAuthSessionQuery 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 *PendingAuthSessionQuery) Clone() *PendingAuthSessionQuery {
if _q == nil {
return nil
}
return &PendingAuthSessionQuery{
config: _q.config,
ctx: _q.ctx.Clone(),
order: append([]pendingauthsession.OrderOption{}, _q.order...),
inters: append([]Interceptor{}, _q.inters...),
predicates: append([]predicate.PendingAuthSession{}, _q.predicates...),
withTargetUser: _q.withTargetUser.Clone(),
withAdoptionDecision: _q.withAdoptionDecision.Clone(),
// clone intermediate query.
sql: _q.sql.Clone(),
path: _q.path,
}
}
// WithTargetUser tells the query-builder to eager-load the nodes that are connected to
// the "target_user" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PendingAuthSessionQuery) WithTargetUser(opts ...func(*UserQuery)) *PendingAuthSessionQuery {
query := (&UserClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withTargetUser = query
return _q
}
// WithAdoptionDecision tells the query-builder to eager-load the nodes that are connected to
// the "adoption_decision" edge. The optional arguments are used to configure the query builder of the edge.
func (_q *PendingAuthSessionQuery) WithAdoptionDecision(opts ...func(*IdentityAdoptionDecisionQuery)) *PendingAuthSessionQuery {
query := (&IdentityAdoptionDecisionClient{config: _q.config}).Query()
for _, opt := range opts {
opt(query)
}
_q.withAdoptionDecision = query
return _q
}
// GroupBy is used to group vertices by one or more fields/columns.
// It is often used with aggregate functions, like: count, max, mean, min, sum.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// Count int `json:"count,omitempty"`
// }
//
// client.PendingAuthSession.Query().
// GroupBy(pendingauthsession.FieldCreatedAt).
// Aggregate(ent.Count()).
// Scan(ctx, &v)
func (_q *PendingAuthSessionQuery) GroupBy(field string, fields ...string) *PendingAuthSessionGroupBy {
_q.ctx.Fields = append([]string{field}, fields...)
grbuild := &PendingAuthSessionGroupBy{build: _q}
grbuild.flds = &_q.ctx.Fields
grbuild.label = pendingauthsession.Label
grbuild.scan = grbuild.Scan
return grbuild
}
// Select allows the selection one or more fields/columns for the given query,
// instead of selecting all fields in the entity.
//
// Example:
//
// var v []struct {
// CreatedAt time.Time `json:"created_at,omitempty"`
// }
//
// client.PendingAuthSession.Query().
// Select(pendingauthsession.FieldCreatedAt).
// Scan(ctx, &v)
func (_q *PendingAuthSessionQuery) Select(fields ...string) *PendingAuthSessionSelect {
_q.ctx.Fields = append(_q.ctx.Fields, fields...)
sbuild := &PendingAuthSessionSelect{PendingAuthSessionQuery: _q}
sbuild.label = pendingauthsession.Label
sbuild.flds, sbuild.scan = &_q.ctx.Fields, sbuild.Scan
return sbuild
}
// Aggregate returns a PendingAuthSessionSelect configured with the given aggregations.
func (_q *PendingAuthSessionQuery) Aggregate(fns ...AggregateFunc) *PendingAuthSessionSelect {
return _q.Select().Aggregate(fns...)
}
func (_q *PendingAuthSessionQuery) 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 !pendingauthsession.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 *PendingAuthSessionQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*PendingAuthSession, error) {
var (
nodes = []*PendingAuthSession{}
_spec = _q.querySpec()
loadedTypes = [2]bool{
_q.withTargetUser != nil,
_q.withAdoptionDecision != nil,
}
)
_spec.ScanValues = func(columns []string) ([]any, error) {
return (*PendingAuthSession).scanValues(nil, columns)
}
_spec.Assign = func(columns []string, values []any) error {
node := &PendingAuthSession{config: _q.config}
nodes = append(nodes, node)
node.Edges.loadedTypes = loadedTypes
return node.assignValues(columns, values)
}
if len(_q.modifiers) > 0 {
_spec.Modifiers = _q.modifiers
}
for i := range hooks {
hooks[i](ctx, _spec)
}
if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
return nil, err
}
if len(nodes) == 0 {
return nodes, nil
}
if query := _q.withTargetUser; query != nil {
if err := _q.loadTargetUser(ctx, query, nodes, nil,
func(n *PendingAuthSession, e *User) { n.Edges.TargetUser = e }); err != nil {
return nil, err
}
}
if query := _q.withAdoptionDecision; query != nil {
if err := _q.loadAdoptionDecision(ctx, query, nodes, nil,
func(n *PendingAuthSession, e *IdentityAdoptionDecision) { n.Edges.AdoptionDecision = e }); err != nil {
return nil, err
}
}
return nodes, nil
}
func (_q *PendingAuthSessionQuery) loadTargetUser(ctx context.Context, query *UserQuery, nodes []*PendingAuthSession, init func(*PendingAuthSession), assign func(*PendingAuthSession, *User)) error {
ids := make([]int64, 0, len(nodes))
nodeids := make(map[int64][]*PendingAuthSession)
for i := range nodes {
if nodes[i].TargetUserID == nil {
continue
}
fk := *nodes[i].TargetUserID
if _, ok := nodeids[fk]; !ok {
ids = append(ids, fk)
}
nodeids[fk] = append(nodeids[fk], nodes[i])
}
if len(ids) == 0 {
return nil
}
query.Where(user.IDIn(ids...))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
nodes, ok := nodeids[n.ID]
if !ok {
return fmt.Errorf(`unexpected foreign-key "target_user_id" returned %v`, n.ID)
}
for i := range nodes {
assign(nodes[i], n)
}
}
return nil
}
func (_q *PendingAuthSessionQuery) loadAdoptionDecision(ctx context.Context, query *IdentityAdoptionDecisionQuery, nodes []*PendingAuthSession, init func(*PendingAuthSession), assign func(*PendingAuthSession, *IdentityAdoptionDecision)) error {
fks := make([]driver.Value, 0, len(nodes))
nodeids := make(map[int64]*PendingAuthSession)
for i := range nodes {
fks = append(fks, nodes[i].ID)
nodeids[nodes[i].ID] = nodes[i]
}
if len(query.ctx.Fields) > 0 {
query.ctx.AppendFieldOnce(identityadoptiondecision.FieldPendingAuthSessionID)
}
query.Where(predicate.IdentityAdoptionDecision(func(s *sql.Selector) {
s.Where(sql.InValues(s.C(pendingauthsession.AdoptionDecisionColumn), fks...))
}))
neighbors, err := query.All(ctx)
if err != nil {
return err
}
for _, n := range neighbors {
fk := n.PendingAuthSessionID
node, ok := nodeids[fk]
if !ok {
return fmt.Errorf(`unexpected referenced foreign-key "pending_auth_session_id" returned %v for node %v`, fk, n.ID)
}
assign(node, n)
}
return nil
}
func (_q *PendingAuthSessionQuery) 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 *PendingAuthSessionQuery) querySpec() *sqlgraph.QuerySpec {
_spec := sqlgraph.NewQuerySpec(pendingauthsession.Table, pendingauthsession.Columns, sqlgraph.NewFieldSpec(pendingauthsession.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, pendingauthsession.FieldID)
for i := range fields {
if fields[i] != pendingauthsession.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
}
}
if _q.withTargetUser != nil {
_spec.Node.AddColumnOnce(pendingauthsession.FieldTargetUserID)
}
}
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 *PendingAuthSessionQuery) sqlQuery(ctx context.Context) *sql.Selector {
builder := sql.Dialect(_q.driver.Dialect())
t1 := builder.Table(pendingauthsession.Table)
columns := _q.ctx.Fields
if len(columns) == 0 {
columns = pendingauthsession.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 *PendingAuthSessionQuery) ForUpdate(opts ...sql.LockOption) *PendingAuthSessionQuery {
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 *PendingAuthSessionQuery) ForShare(opts ...sql.LockOption) *PendingAuthSessionQuery {
if _q.driver.Dialect() == dialect.Postgres {
_q.Unique(false)
}
_q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
s.ForShare(opts...)
})
return _q
}
// PendingAuthSessionGroupBy is the group-by builder for PendingAuthSession entities.
type PendingAuthSessionGroupBy struct {
selector
build *PendingAuthSessionQuery
}
// Aggregate adds the given aggregation functions to the group-by query.
func (_g *PendingAuthSessionGroupBy) Aggregate(fns ...AggregateFunc) *PendingAuthSessionGroupBy {
_g.fns = append(_g.fns, fns...)
return _g
}
// Scan applies the selector query and scans the result into the given value.
func (_g *PendingAuthSessionGroupBy) 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[*PendingAuthSessionQuery, *PendingAuthSessionGroupBy](ctx, _g.build, _g, _g.build.inters, v)
}
func (_g *PendingAuthSessionGroupBy) sqlScan(ctx context.Context, root *PendingAuthSessionQuery, 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)
}
// PendingAuthSessionSelect is the builder for selecting fields of PendingAuthSession entities.
type PendingAuthSessionSelect struct {
*PendingAuthSessionQuery
selector
}
// Aggregate adds the given aggregation functions to the selector query.
func (_s *PendingAuthSessionSelect) Aggregate(fns ...AggregateFunc) *PendingAuthSessionSelect {
_s.fns = append(_s.fns, fns...)
return _s
}
// Scan applies the selector query and scans the result into the given value.
func (_s *PendingAuthSessionSelect) 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[*PendingAuthSessionQuery, *PendingAuthSessionSelect](ctx, _s.PendingAuthSessionQuery, _s, _s.inters, v)
}
func (_s *PendingAuthSessionSelect) sqlScan(ctx context.Context, root *PendingAuthSessionQuery, 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)
}
// 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/identityadoptiondecision"
"github.com/Wei-Shaw/sub2api/ent/pendingauthsession"
"github.com/Wei-Shaw/sub2api/ent/predicate"
"github.com/Wei-Shaw/sub2api/ent/user"
)
// PendingAuthSessionUpdate is the builder for updating PendingAuthSession entities.
type PendingAuthSessionUpdate struct {
config
hooks []Hook
mutation *PendingAuthSessionMutation
}
// Where appends a list predicates to the PendingAuthSessionUpdate builder.
func (_u *PendingAuthSessionUpdate) Where(ps ...predicate.PendingAuthSession) *PendingAuthSessionUpdate {
_u.mutation.Where(ps...)
return _u
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *PendingAuthSessionUpdate) SetUpdatedAt(v time.Time) *PendingAuthSessionUpdate {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetSessionToken sets the "session_token" field.
func (_u *PendingAuthSessionUpdate) SetSessionToken(v string) *PendingAuthSessionUpdate {
_u.mutation.SetSessionToken(v)
return _u
}
// SetNillableSessionToken sets the "session_token" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableSessionToken(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetSessionToken(*v)
}
return _u
}
// SetIntent sets the "intent" field.
func (_u *PendingAuthSessionUpdate) SetIntent(v string) *PendingAuthSessionUpdate {
_u.mutation.SetIntent(v)
return _u
}
// SetNillableIntent sets the "intent" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableIntent(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetIntent(*v)
}
return _u
}
// SetProviderType sets the "provider_type" field.
func (_u *PendingAuthSessionUpdate) SetProviderType(v string) *PendingAuthSessionUpdate {
_u.mutation.SetProviderType(v)
return _u
}
// SetNillableProviderType sets the "provider_type" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableProviderType(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetProviderType(*v)
}
return _u
}
// SetProviderKey sets the "provider_key" field.
func (_u *PendingAuthSessionUpdate) SetProviderKey(v string) *PendingAuthSessionUpdate {
_u.mutation.SetProviderKey(v)
return _u
}
// SetNillableProviderKey sets the "provider_key" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableProviderKey(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetProviderKey(*v)
}
return _u
}
// SetProviderSubject sets the "provider_subject" field.
func (_u *PendingAuthSessionUpdate) SetProviderSubject(v string) *PendingAuthSessionUpdate {
_u.mutation.SetProviderSubject(v)
return _u
}
// SetNillableProviderSubject sets the "provider_subject" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableProviderSubject(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetProviderSubject(*v)
}
return _u
}
// SetTargetUserID sets the "target_user_id" field.
func (_u *PendingAuthSessionUpdate) SetTargetUserID(v int64) *PendingAuthSessionUpdate {
_u.mutation.SetTargetUserID(v)
return _u
}
// SetNillableTargetUserID sets the "target_user_id" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableTargetUserID(v *int64) *PendingAuthSessionUpdate {
if v != nil {
_u.SetTargetUserID(*v)
}
return _u
}
// ClearTargetUserID clears the value of the "target_user_id" field.
func (_u *PendingAuthSessionUpdate) ClearTargetUserID() *PendingAuthSessionUpdate {
_u.mutation.ClearTargetUserID()
return _u
}
// SetRedirectTo sets the "redirect_to" field.
func (_u *PendingAuthSessionUpdate) SetRedirectTo(v string) *PendingAuthSessionUpdate {
_u.mutation.SetRedirectTo(v)
return _u
}
// SetNillableRedirectTo sets the "redirect_to" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableRedirectTo(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetRedirectTo(*v)
}
return _u
}
// SetResolvedEmail sets the "resolved_email" field.
func (_u *PendingAuthSessionUpdate) SetResolvedEmail(v string) *PendingAuthSessionUpdate {
_u.mutation.SetResolvedEmail(v)
return _u
}
// SetNillableResolvedEmail sets the "resolved_email" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableResolvedEmail(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetResolvedEmail(*v)
}
return _u
}
// SetRegistrationPasswordHash sets the "registration_password_hash" field.
func (_u *PendingAuthSessionUpdate) SetRegistrationPasswordHash(v string) *PendingAuthSessionUpdate {
_u.mutation.SetRegistrationPasswordHash(v)
return _u
}
// SetNillableRegistrationPasswordHash sets the "registration_password_hash" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableRegistrationPasswordHash(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetRegistrationPasswordHash(*v)
}
return _u
}
// SetUpstreamIdentityClaims sets the "upstream_identity_claims" field.
func (_u *PendingAuthSessionUpdate) SetUpstreamIdentityClaims(v map[string]interface{}) *PendingAuthSessionUpdate {
_u.mutation.SetUpstreamIdentityClaims(v)
return _u
}
// SetLocalFlowState sets the "local_flow_state" field.
func (_u *PendingAuthSessionUpdate) SetLocalFlowState(v map[string]interface{}) *PendingAuthSessionUpdate {
_u.mutation.SetLocalFlowState(v)
return _u
}
// SetBrowserSessionKey sets the "browser_session_key" field.
func (_u *PendingAuthSessionUpdate) SetBrowserSessionKey(v string) *PendingAuthSessionUpdate {
_u.mutation.SetBrowserSessionKey(v)
return _u
}
// SetNillableBrowserSessionKey sets the "browser_session_key" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableBrowserSessionKey(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetBrowserSessionKey(*v)
}
return _u
}
// SetCompletionCodeHash sets the "completion_code_hash" field.
func (_u *PendingAuthSessionUpdate) SetCompletionCodeHash(v string) *PendingAuthSessionUpdate {
_u.mutation.SetCompletionCodeHash(v)
return _u
}
// SetNillableCompletionCodeHash sets the "completion_code_hash" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableCompletionCodeHash(v *string) *PendingAuthSessionUpdate {
if v != nil {
_u.SetCompletionCodeHash(*v)
}
return _u
}
// SetCompletionCodeExpiresAt sets the "completion_code_expires_at" field.
func (_u *PendingAuthSessionUpdate) SetCompletionCodeExpiresAt(v time.Time) *PendingAuthSessionUpdate {
_u.mutation.SetCompletionCodeExpiresAt(v)
return _u
}
// SetNillableCompletionCodeExpiresAt sets the "completion_code_expires_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableCompletionCodeExpiresAt(v *time.Time) *PendingAuthSessionUpdate {
if v != nil {
_u.SetCompletionCodeExpiresAt(*v)
}
return _u
}
// ClearCompletionCodeExpiresAt clears the value of the "completion_code_expires_at" field.
func (_u *PendingAuthSessionUpdate) ClearCompletionCodeExpiresAt() *PendingAuthSessionUpdate {
_u.mutation.ClearCompletionCodeExpiresAt()
return _u
}
// SetEmailVerifiedAt sets the "email_verified_at" field.
func (_u *PendingAuthSessionUpdate) SetEmailVerifiedAt(v time.Time) *PendingAuthSessionUpdate {
_u.mutation.SetEmailVerifiedAt(v)
return _u
}
// SetNillableEmailVerifiedAt sets the "email_verified_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableEmailVerifiedAt(v *time.Time) *PendingAuthSessionUpdate {
if v != nil {
_u.SetEmailVerifiedAt(*v)
}
return _u
}
// ClearEmailVerifiedAt clears the value of the "email_verified_at" field.
func (_u *PendingAuthSessionUpdate) ClearEmailVerifiedAt() *PendingAuthSessionUpdate {
_u.mutation.ClearEmailVerifiedAt()
return _u
}
// SetPasswordVerifiedAt sets the "password_verified_at" field.
func (_u *PendingAuthSessionUpdate) SetPasswordVerifiedAt(v time.Time) *PendingAuthSessionUpdate {
_u.mutation.SetPasswordVerifiedAt(v)
return _u
}
// SetNillablePasswordVerifiedAt sets the "password_verified_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillablePasswordVerifiedAt(v *time.Time) *PendingAuthSessionUpdate {
if v != nil {
_u.SetPasswordVerifiedAt(*v)
}
return _u
}
// ClearPasswordVerifiedAt clears the value of the "password_verified_at" field.
func (_u *PendingAuthSessionUpdate) ClearPasswordVerifiedAt() *PendingAuthSessionUpdate {
_u.mutation.ClearPasswordVerifiedAt()
return _u
}
// SetTotpVerifiedAt sets the "totp_verified_at" field.
func (_u *PendingAuthSessionUpdate) SetTotpVerifiedAt(v time.Time) *PendingAuthSessionUpdate {
_u.mutation.SetTotpVerifiedAt(v)
return _u
}
// SetNillableTotpVerifiedAt sets the "totp_verified_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableTotpVerifiedAt(v *time.Time) *PendingAuthSessionUpdate {
if v != nil {
_u.SetTotpVerifiedAt(*v)
}
return _u
}
// ClearTotpVerifiedAt clears the value of the "totp_verified_at" field.
func (_u *PendingAuthSessionUpdate) ClearTotpVerifiedAt() *PendingAuthSessionUpdate {
_u.mutation.ClearTotpVerifiedAt()
return _u
}
// SetExpiresAt sets the "expires_at" field.
func (_u *PendingAuthSessionUpdate) SetExpiresAt(v time.Time) *PendingAuthSessionUpdate {
_u.mutation.SetExpiresAt(v)
return _u
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableExpiresAt(v *time.Time) *PendingAuthSessionUpdate {
if v != nil {
_u.SetExpiresAt(*v)
}
return _u
}
// SetConsumedAt sets the "consumed_at" field.
func (_u *PendingAuthSessionUpdate) SetConsumedAt(v time.Time) *PendingAuthSessionUpdate {
_u.mutation.SetConsumedAt(v)
return _u
}
// SetNillableConsumedAt sets the "consumed_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableConsumedAt(v *time.Time) *PendingAuthSessionUpdate {
if v != nil {
_u.SetConsumedAt(*v)
}
return _u
}
// ClearConsumedAt clears the value of the "consumed_at" field.
func (_u *PendingAuthSessionUpdate) ClearConsumedAt() *PendingAuthSessionUpdate {
_u.mutation.ClearConsumedAt()
return _u
}
// SetTargetUser sets the "target_user" edge to the User entity.
func (_u *PendingAuthSessionUpdate) SetTargetUser(v *User) *PendingAuthSessionUpdate {
return _u.SetTargetUserID(v.ID)
}
// SetAdoptionDecisionID sets the "adoption_decision" edge to the IdentityAdoptionDecision entity by ID.
func (_u *PendingAuthSessionUpdate) SetAdoptionDecisionID(id int64) *PendingAuthSessionUpdate {
_u.mutation.SetAdoptionDecisionID(id)
return _u
}
// SetNillableAdoptionDecisionID sets the "adoption_decision" edge to the IdentityAdoptionDecision entity by ID if the given value is not nil.
func (_u *PendingAuthSessionUpdate) SetNillableAdoptionDecisionID(id *int64) *PendingAuthSessionUpdate {
if id != nil {
_u = _u.SetAdoptionDecisionID(*id)
}
return _u
}
// SetAdoptionDecision sets the "adoption_decision" edge to the IdentityAdoptionDecision entity.
func (_u *PendingAuthSessionUpdate) SetAdoptionDecision(v *IdentityAdoptionDecision) *PendingAuthSessionUpdate {
return _u.SetAdoptionDecisionID(v.ID)
}
// Mutation returns the PendingAuthSessionMutation object of the builder.
func (_u *PendingAuthSessionUpdate) Mutation() *PendingAuthSessionMutation {
return _u.mutation
}
// ClearTargetUser clears the "target_user" edge to the User entity.
func (_u *PendingAuthSessionUpdate) ClearTargetUser() *PendingAuthSessionUpdate {
_u.mutation.ClearTargetUser()
return _u
}
// ClearAdoptionDecision clears the "adoption_decision" edge to the IdentityAdoptionDecision entity.
func (_u *PendingAuthSessionUpdate) ClearAdoptionDecision() *PendingAuthSessionUpdate {
_u.mutation.ClearAdoptionDecision()
return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *PendingAuthSessionUpdate) Save(ctx context.Context) (int, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *PendingAuthSessionUpdate) SaveX(ctx context.Context) int {
affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (_u *PendingAuthSessionUpdate) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *PendingAuthSessionUpdate) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *PendingAuthSessionUpdate) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := pendingauthsession.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *PendingAuthSessionUpdate) check() error {
if v, ok := _u.mutation.SessionToken(); ok {
if err := pendingauthsession.SessionTokenValidator(v); err != nil {
return &ValidationError{Name: "session_token", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.session_token": %w`, err)}
}
}
if v, ok := _u.mutation.Intent(); ok {
if err := pendingauthsession.IntentValidator(v); err != nil {
return &ValidationError{Name: "intent", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.intent": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderType(); ok {
if err := pendingauthsession.ProviderTypeValidator(v); err != nil {
return &ValidationError{Name: "provider_type", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_type": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderKey(); ok {
if err := pendingauthsession.ProviderKeyValidator(v); err != nil {
return &ValidationError{Name: "provider_key", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_key": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderSubject(); ok {
if err := pendingauthsession.ProviderSubjectValidator(v); err != nil {
return &ValidationError{Name: "provider_subject", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_subject": %w`, err)}
}
}
return nil
}
func (_u *PendingAuthSessionUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(pendingauthsession.Table, pendingauthsession.Columns, sqlgraph.NewFieldSpec(pendingauthsession.FieldID, field.TypeInt64))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(pendingauthsession.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.SessionToken(); ok {
_spec.SetField(pendingauthsession.FieldSessionToken, field.TypeString, value)
}
if value, ok := _u.mutation.Intent(); ok {
_spec.SetField(pendingauthsession.FieldIntent, field.TypeString, value)
}
if value, ok := _u.mutation.ProviderType(); ok {
_spec.SetField(pendingauthsession.FieldProviderType, field.TypeString, value)
}
if value, ok := _u.mutation.ProviderKey(); ok {
_spec.SetField(pendingauthsession.FieldProviderKey, field.TypeString, value)
}
if value, ok := _u.mutation.ProviderSubject(); ok {
_spec.SetField(pendingauthsession.FieldProviderSubject, field.TypeString, value)
}
if value, ok := _u.mutation.RedirectTo(); ok {
_spec.SetField(pendingauthsession.FieldRedirectTo, field.TypeString, value)
}
if value, ok := _u.mutation.ResolvedEmail(); ok {
_spec.SetField(pendingauthsession.FieldResolvedEmail, field.TypeString, value)
}
if value, ok := _u.mutation.RegistrationPasswordHash(); ok {
_spec.SetField(pendingauthsession.FieldRegistrationPasswordHash, field.TypeString, value)
}
if value, ok := _u.mutation.UpstreamIdentityClaims(); ok {
_spec.SetField(pendingauthsession.FieldUpstreamIdentityClaims, field.TypeJSON, value)
}
if value, ok := _u.mutation.LocalFlowState(); ok {
_spec.SetField(pendingauthsession.FieldLocalFlowState, field.TypeJSON, value)
}
if value, ok := _u.mutation.BrowserSessionKey(); ok {
_spec.SetField(pendingauthsession.FieldBrowserSessionKey, field.TypeString, value)
}
if value, ok := _u.mutation.CompletionCodeHash(); ok {
_spec.SetField(pendingauthsession.FieldCompletionCodeHash, field.TypeString, value)
}
if value, ok := _u.mutation.CompletionCodeExpiresAt(); ok {
_spec.SetField(pendingauthsession.FieldCompletionCodeExpiresAt, field.TypeTime, value)
}
if _u.mutation.CompletionCodeExpiresAtCleared() {
_spec.ClearField(pendingauthsession.FieldCompletionCodeExpiresAt, field.TypeTime)
}
if value, ok := _u.mutation.EmailVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldEmailVerifiedAt, field.TypeTime, value)
}
if _u.mutation.EmailVerifiedAtCleared() {
_spec.ClearField(pendingauthsession.FieldEmailVerifiedAt, field.TypeTime)
}
if value, ok := _u.mutation.PasswordVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldPasswordVerifiedAt, field.TypeTime, value)
}
if _u.mutation.PasswordVerifiedAtCleared() {
_spec.ClearField(pendingauthsession.FieldPasswordVerifiedAt, field.TypeTime)
}
if value, ok := _u.mutation.TotpVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldTotpVerifiedAt, field.TypeTime, value)
}
if _u.mutation.TotpVerifiedAtCleared() {
_spec.ClearField(pendingauthsession.FieldTotpVerifiedAt, field.TypeTime)
}
if value, ok := _u.mutation.ExpiresAt(); ok {
_spec.SetField(pendingauthsession.FieldExpiresAt, field.TypeTime, value)
}
if value, ok := _u.mutation.ConsumedAt(); ok {
_spec.SetField(pendingauthsession.FieldConsumedAt, field.TypeTime, value)
}
if _u.mutation.ConsumedAtCleared() {
_spec.ClearField(pendingauthsession.FieldConsumedAt, field.TypeTime)
}
if _u.mutation.TargetUserCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: pendingauthsession.TargetUserTable,
Columns: []string{pendingauthsession.TargetUserColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.TargetUserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: pendingauthsession.TargetUserTable,
Columns: []string{pendingauthsession.TargetUserColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AdoptionDecisionCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
Table: pendingauthsession.AdoptionDecisionTable,
Columns: []string{pendingauthsession.AdoptionDecisionColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(identityadoptiondecision.FieldID, field.TypeInt64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AdoptionDecisionIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
Table: pendingauthsession.AdoptionDecisionTable,
Columns: []string{pendingauthsession.AdoptionDecisionColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(identityadoptiondecision.FieldID, field.TypeInt64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{pendingauthsession.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
_u.mutation.done = true
return _node, nil
}
// PendingAuthSessionUpdateOne is the builder for updating a single PendingAuthSession entity.
type PendingAuthSessionUpdateOne struct {
config
fields []string
hooks []Hook
mutation *PendingAuthSessionMutation
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *PendingAuthSessionUpdateOne) SetUpdatedAt(v time.Time) *PendingAuthSessionUpdateOne {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetSessionToken sets the "session_token" field.
func (_u *PendingAuthSessionUpdateOne) SetSessionToken(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetSessionToken(v)
return _u
}
// SetNillableSessionToken sets the "session_token" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableSessionToken(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetSessionToken(*v)
}
return _u
}
// SetIntent sets the "intent" field.
func (_u *PendingAuthSessionUpdateOne) SetIntent(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetIntent(v)
return _u
}
// SetNillableIntent sets the "intent" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableIntent(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetIntent(*v)
}
return _u
}
// SetProviderType sets the "provider_type" field.
func (_u *PendingAuthSessionUpdateOne) SetProviderType(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetProviderType(v)
return _u
}
// SetNillableProviderType sets the "provider_type" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableProviderType(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetProviderType(*v)
}
return _u
}
// SetProviderKey sets the "provider_key" field.
func (_u *PendingAuthSessionUpdateOne) SetProviderKey(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetProviderKey(v)
return _u
}
// SetNillableProviderKey sets the "provider_key" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableProviderKey(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetProviderKey(*v)
}
return _u
}
// SetProviderSubject sets the "provider_subject" field.
func (_u *PendingAuthSessionUpdateOne) SetProviderSubject(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetProviderSubject(v)
return _u
}
// SetNillableProviderSubject sets the "provider_subject" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableProviderSubject(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetProviderSubject(*v)
}
return _u
}
// SetTargetUserID sets the "target_user_id" field.
func (_u *PendingAuthSessionUpdateOne) SetTargetUserID(v int64) *PendingAuthSessionUpdateOne {
_u.mutation.SetTargetUserID(v)
return _u
}
// SetNillableTargetUserID sets the "target_user_id" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableTargetUserID(v *int64) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetTargetUserID(*v)
}
return _u
}
// ClearTargetUserID clears the value of the "target_user_id" field.
func (_u *PendingAuthSessionUpdateOne) ClearTargetUserID() *PendingAuthSessionUpdateOne {
_u.mutation.ClearTargetUserID()
return _u
}
// SetRedirectTo sets the "redirect_to" field.
func (_u *PendingAuthSessionUpdateOne) SetRedirectTo(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetRedirectTo(v)
return _u
}
// SetNillableRedirectTo sets the "redirect_to" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableRedirectTo(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetRedirectTo(*v)
}
return _u
}
// SetResolvedEmail sets the "resolved_email" field.
func (_u *PendingAuthSessionUpdateOne) SetResolvedEmail(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetResolvedEmail(v)
return _u
}
// SetNillableResolvedEmail sets the "resolved_email" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableResolvedEmail(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetResolvedEmail(*v)
}
return _u
}
// SetRegistrationPasswordHash sets the "registration_password_hash" field.
func (_u *PendingAuthSessionUpdateOne) SetRegistrationPasswordHash(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetRegistrationPasswordHash(v)
return _u
}
// SetNillableRegistrationPasswordHash sets the "registration_password_hash" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableRegistrationPasswordHash(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetRegistrationPasswordHash(*v)
}
return _u
}
// SetUpstreamIdentityClaims sets the "upstream_identity_claims" field.
func (_u *PendingAuthSessionUpdateOne) SetUpstreamIdentityClaims(v map[string]interface{}) *PendingAuthSessionUpdateOne {
_u.mutation.SetUpstreamIdentityClaims(v)
return _u
}
// SetLocalFlowState sets the "local_flow_state" field.
func (_u *PendingAuthSessionUpdateOne) SetLocalFlowState(v map[string]interface{}) *PendingAuthSessionUpdateOne {
_u.mutation.SetLocalFlowState(v)
return _u
}
// SetBrowserSessionKey sets the "browser_session_key" field.
func (_u *PendingAuthSessionUpdateOne) SetBrowserSessionKey(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetBrowserSessionKey(v)
return _u
}
// SetNillableBrowserSessionKey sets the "browser_session_key" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableBrowserSessionKey(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetBrowserSessionKey(*v)
}
return _u
}
// SetCompletionCodeHash sets the "completion_code_hash" field.
func (_u *PendingAuthSessionUpdateOne) SetCompletionCodeHash(v string) *PendingAuthSessionUpdateOne {
_u.mutation.SetCompletionCodeHash(v)
return _u
}
// SetNillableCompletionCodeHash sets the "completion_code_hash" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableCompletionCodeHash(v *string) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetCompletionCodeHash(*v)
}
return _u
}
// SetCompletionCodeExpiresAt sets the "completion_code_expires_at" field.
func (_u *PendingAuthSessionUpdateOne) SetCompletionCodeExpiresAt(v time.Time) *PendingAuthSessionUpdateOne {
_u.mutation.SetCompletionCodeExpiresAt(v)
return _u
}
// SetNillableCompletionCodeExpiresAt sets the "completion_code_expires_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableCompletionCodeExpiresAt(v *time.Time) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetCompletionCodeExpiresAt(*v)
}
return _u
}
// ClearCompletionCodeExpiresAt clears the value of the "completion_code_expires_at" field.
func (_u *PendingAuthSessionUpdateOne) ClearCompletionCodeExpiresAt() *PendingAuthSessionUpdateOne {
_u.mutation.ClearCompletionCodeExpiresAt()
return _u
}
// SetEmailVerifiedAt sets the "email_verified_at" field.
func (_u *PendingAuthSessionUpdateOne) SetEmailVerifiedAt(v time.Time) *PendingAuthSessionUpdateOne {
_u.mutation.SetEmailVerifiedAt(v)
return _u
}
// SetNillableEmailVerifiedAt sets the "email_verified_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableEmailVerifiedAt(v *time.Time) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetEmailVerifiedAt(*v)
}
return _u
}
// ClearEmailVerifiedAt clears the value of the "email_verified_at" field.
func (_u *PendingAuthSessionUpdateOne) ClearEmailVerifiedAt() *PendingAuthSessionUpdateOne {
_u.mutation.ClearEmailVerifiedAt()
return _u
}
// SetPasswordVerifiedAt sets the "password_verified_at" field.
func (_u *PendingAuthSessionUpdateOne) SetPasswordVerifiedAt(v time.Time) *PendingAuthSessionUpdateOne {
_u.mutation.SetPasswordVerifiedAt(v)
return _u
}
// SetNillablePasswordVerifiedAt sets the "password_verified_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillablePasswordVerifiedAt(v *time.Time) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetPasswordVerifiedAt(*v)
}
return _u
}
// ClearPasswordVerifiedAt clears the value of the "password_verified_at" field.
func (_u *PendingAuthSessionUpdateOne) ClearPasswordVerifiedAt() *PendingAuthSessionUpdateOne {
_u.mutation.ClearPasswordVerifiedAt()
return _u
}
// SetTotpVerifiedAt sets the "totp_verified_at" field.
func (_u *PendingAuthSessionUpdateOne) SetTotpVerifiedAt(v time.Time) *PendingAuthSessionUpdateOne {
_u.mutation.SetTotpVerifiedAt(v)
return _u
}
// SetNillableTotpVerifiedAt sets the "totp_verified_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableTotpVerifiedAt(v *time.Time) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetTotpVerifiedAt(*v)
}
return _u
}
// ClearTotpVerifiedAt clears the value of the "totp_verified_at" field.
func (_u *PendingAuthSessionUpdateOne) ClearTotpVerifiedAt() *PendingAuthSessionUpdateOne {
_u.mutation.ClearTotpVerifiedAt()
return _u
}
// SetExpiresAt sets the "expires_at" field.
func (_u *PendingAuthSessionUpdateOne) SetExpiresAt(v time.Time) *PendingAuthSessionUpdateOne {
_u.mutation.SetExpiresAt(v)
return _u
}
// SetNillableExpiresAt sets the "expires_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableExpiresAt(v *time.Time) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetExpiresAt(*v)
}
return _u
}
// SetConsumedAt sets the "consumed_at" field.
func (_u *PendingAuthSessionUpdateOne) SetConsumedAt(v time.Time) *PendingAuthSessionUpdateOne {
_u.mutation.SetConsumedAt(v)
return _u
}
// SetNillableConsumedAt sets the "consumed_at" field if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableConsumedAt(v *time.Time) *PendingAuthSessionUpdateOne {
if v != nil {
_u.SetConsumedAt(*v)
}
return _u
}
// ClearConsumedAt clears the value of the "consumed_at" field.
func (_u *PendingAuthSessionUpdateOne) ClearConsumedAt() *PendingAuthSessionUpdateOne {
_u.mutation.ClearConsumedAt()
return _u
}
// SetTargetUser sets the "target_user" edge to the User entity.
func (_u *PendingAuthSessionUpdateOne) SetTargetUser(v *User) *PendingAuthSessionUpdateOne {
return _u.SetTargetUserID(v.ID)
}
// SetAdoptionDecisionID sets the "adoption_decision" edge to the IdentityAdoptionDecision entity by ID.
func (_u *PendingAuthSessionUpdateOne) SetAdoptionDecisionID(id int64) *PendingAuthSessionUpdateOne {
_u.mutation.SetAdoptionDecisionID(id)
return _u
}
// SetNillableAdoptionDecisionID sets the "adoption_decision" edge to the IdentityAdoptionDecision entity by ID if the given value is not nil.
func (_u *PendingAuthSessionUpdateOne) SetNillableAdoptionDecisionID(id *int64) *PendingAuthSessionUpdateOne {
if id != nil {
_u = _u.SetAdoptionDecisionID(*id)
}
return _u
}
// SetAdoptionDecision sets the "adoption_decision" edge to the IdentityAdoptionDecision entity.
func (_u *PendingAuthSessionUpdateOne) SetAdoptionDecision(v *IdentityAdoptionDecision) *PendingAuthSessionUpdateOne {
return _u.SetAdoptionDecisionID(v.ID)
}
// Mutation returns the PendingAuthSessionMutation object of the builder.
func (_u *PendingAuthSessionUpdateOne) Mutation() *PendingAuthSessionMutation {
return _u.mutation
}
// ClearTargetUser clears the "target_user" edge to the User entity.
func (_u *PendingAuthSessionUpdateOne) ClearTargetUser() *PendingAuthSessionUpdateOne {
_u.mutation.ClearTargetUser()
return _u
}
// ClearAdoptionDecision clears the "adoption_decision" edge to the IdentityAdoptionDecision entity.
func (_u *PendingAuthSessionUpdateOne) ClearAdoptionDecision() *PendingAuthSessionUpdateOne {
_u.mutation.ClearAdoptionDecision()
return _u
}
// Where appends a list predicates to the PendingAuthSessionUpdate builder.
func (_u *PendingAuthSessionUpdateOne) Where(ps ...predicate.PendingAuthSession) *PendingAuthSessionUpdateOne {
_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 *PendingAuthSessionUpdateOne) Select(field string, fields ...string) *PendingAuthSessionUpdateOne {
_u.fields = append([]string{field}, fields...)
return _u
}
// Save executes the query and returns the updated PendingAuthSession entity.
func (_u *PendingAuthSessionUpdateOne) Save(ctx context.Context) (*PendingAuthSession, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *PendingAuthSessionUpdateOne) SaveX(ctx context.Context) *PendingAuthSession {
node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (_u *PendingAuthSessionUpdateOne) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *PendingAuthSessionUpdateOne) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *PendingAuthSessionUpdateOne) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := pendingauthsession.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *PendingAuthSessionUpdateOne) check() error {
if v, ok := _u.mutation.SessionToken(); ok {
if err := pendingauthsession.SessionTokenValidator(v); err != nil {
return &ValidationError{Name: "session_token", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.session_token": %w`, err)}
}
}
if v, ok := _u.mutation.Intent(); ok {
if err := pendingauthsession.IntentValidator(v); err != nil {
return &ValidationError{Name: "intent", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.intent": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderType(); ok {
if err := pendingauthsession.ProviderTypeValidator(v); err != nil {
return &ValidationError{Name: "provider_type", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_type": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderKey(); ok {
if err := pendingauthsession.ProviderKeyValidator(v); err != nil {
return &ValidationError{Name: "provider_key", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_key": %w`, err)}
}
}
if v, ok := _u.mutation.ProviderSubject(); ok {
if err := pendingauthsession.ProviderSubjectValidator(v); err != nil {
return &ValidationError{Name: "provider_subject", err: fmt.Errorf(`ent: validator failed for field "PendingAuthSession.provider_subject": %w`, err)}
}
}
return nil
}
func (_u *PendingAuthSessionUpdateOne) sqlSave(ctx context.Context) (_node *PendingAuthSession, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(pendingauthsession.Table, pendingauthsession.Columns, sqlgraph.NewFieldSpec(pendingauthsession.FieldID, field.TypeInt64))
id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "PendingAuthSession.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, pendingauthsession.FieldID)
for _, f := range fields {
if !pendingauthsession.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != pendingauthsession.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(pendingauthsession.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.SessionToken(); ok {
_spec.SetField(pendingauthsession.FieldSessionToken, field.TypeString, value)
}
if value, ok := _u.mutation.Intent(); ok {
_spec.SetField(pendingauthsession.FieldIntent, field.TypeString, value)
}
if value, ok := _u.mutation.ProviderType(); ok {
_spec.SetField(pendingauthsession.FieldProviderType, field.TypeString, value)
}
if value, ok := _u.mutation.ProviderKey(); ok {
_spec.SetField(pendingauthsession.FieldProviderKey, field.TypeString, value)
}
if value, ok := _u.mutation.ProviderSubject(); ok {
_spec.SetField(pendingauthsession.FieldProviderSubject, field.TypeString, value)
}
if value, ok := _u.mutation.RedirectTo(); ok {
_spec.SetField(pendingauthsession.FieldRedirectTo, field.TypeString, value)
}
if value, ok := _u.mutation.ResolvedEmail(); ok {
_spec.SetField(pendingauthsession.FieldResolvedEmail, field.TypeString, value)
}
if value, ok := _u.mutation.RegistrationPasswordHash(); ok {
_spec.SetField(pendingauthsession.FieldRegistrationPasswordHash, field.TypeString, value)
}
if value, ok := _u.mutation.UpstreamIdentityClaims(); ok {
_spec.SetField(pendingauthsession.FieldUpstreamIdentityClaims, field.TypeJSON, value)
}
if value, ok := _u.mutation.LocalFlowState(); ok {
_spec.SetField(pendingauthsession.FieldLocalFlowState, field.TypeJSON, value)
}
if value, ok := _u.mutation.BrowserSessionKey(); ok {
_spec.SetField(pendingauthsession.FieldBrowserSessionKey, field.TypeString, value)
}
if value, ok := _u.mutation.CompletionCodeHash(); ok {
_spec.SetField(pendingauthsession.FieldCompletionCodeHash, field.TypeString, value)
}
if value, ok := _u.mutation.CompletionCodeExpiresAt(); ok {
_spec.SetField(pendingauthsession.FieldCompletionCodeExpiresAt, field.TypeTime, value)
}
if _u.mutation.CompletionCodeExpiresAtCleared() {
_spec.ClearField(pendingauthsession.FieldCompletionCodeExpiresAt, field.TypeTime)
}
if value, ok := _u.mutation.EmailVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldEmailVerifiedAt, field.TypeTime, value)
}
if _u.mutation.EmailVerifiedAtCleared() {
_spec.ClearField(pendingauthsession.FieldEmailVerifiedAt, field.TypeTime)
}
if value, ok := _u.mutation.PasswordVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldPasswordVerifiedAt, field.TypeTime, value)
}
if _u.mutation.PasswordVerifiedAtCleared() {
_spec.ClearField(pendingauthsession.FieldPasswordVerifiedAt, field.TypeTime)
}
if value, ok := _u.mutation.TotpVerifiedAt(); ok {
_spec.SetField(pendingauthsession.FieldTotpVerifiedAt, field.TypeTime, value)
}
if _u.mutation.TotpVerifiedAtCleared() {
_spec.ClearField(pendingauthsession.FieldTotpVerifiedAt, field.TypeTime)
}
if value, ok := _u.mutation.ExpiresAt(); ok {
_spec.SetField(pendingauthsession.FieldExpiresAt, field.TypeTime, value)
}
if value, ok := _u.mutation.ConsumedAt(); ok {
_spec.SetField(pendingauthsession.FieldConsumedAt, field.TypeTime, value)
}
if _u.mutation.ConsumedAtCleared() {
_spec.ClearField(pendingauthsession.FieldConsumedAt, field.TypeTime)
}
if _u.mutation.TargetUserCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: pendingauthsession.TargetUserTable,
Columns: []string{pendingauthsession.TargetUserColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.TargetUserIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: pendingauthsession.TargetUserTable,
Columns: []string{pendingauthsession.TargetUserColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AdoptionDecisionCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
Table: pendingauthsession.AdoptionDecisionTable,
Columns: []string{pendingauthsession.AdoptionDecisionColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(identityadoptiondecision.FieldID, field.TypeInt64),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AdoptionDecisionIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2O,
Inverse: false,
Table: pendingauthsession.AdoptionDecisionTable,
Columns: []string{pendingauthsession.AdoptionDecisionColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(identityadoptiondecision.FieldID, field.TypeInt64),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_node = &PendingAuthSession{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{pendingauthsession.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
_u.mutation.done = true
return _node, nil
}
......@@ -21,6 +21,24 @@ type Announcement func(*sql.Selector)
// AnnouncementRead is the predicate function for announcementread builders.
type AnnouncementRead func(*sql.Selector)
// AuthIdentity is the predicate function for authidentity builders.
type AuthIdentity func(*sql.Selector)
// AuthIdentityChannel is the predicate function for authidentitychannel builders.
type AuthIdentityChannel func(*sql.Selector)
// ChannelMonitor is the predicate function for channelmonitor builders.
type ChannelMonitor func(*sql.Selector)
// ChannelMonitorDailyRollup is the predicate function for channelmonitordailyrollup builders.
type ChannelMonitorDailyRollup func(*sql.Selector)
// ChannelMonitorHistory is the predicate function for channelmonitorhistory builders.
type ChannelMonitorHistory func(*sql.Selector)
// ChannelMonitorRequestTemplate is the predicate function for channelmonitorrequesttemplate builders.
type ChannelMonitorRequestTemplate func(*sql.Selector)
// ErrorPassthroughRule is the predicate function for errorpassthroughrule builders.
type ErrorPassthroughRule func(*sql.Selector)
......@@ -30,6 +48,9 @@ type Group func(*sql.Selector)
// IdempotencyRecord is the predicate function for idempotencyrecord builders.
type IdempotencyRecord func(*sql.Selector)
// IdentityAdoptionDecision is the predicate function for identityadoptiondecision builders.
type IdentityAdoptionDecision func(*sql.Selector)
// PaymentAuditLog is the predicate function for paymentauditlog builders.
type PaymentAuditLog func(*sql.Selector)
......@@ -39,6 +60,9 @@ type PaymentOrder func(*sql.Selector)
// PaymentProviderInstance is the predicate function for paymentproviderinstance builders.
type PaymentProviderInstance func(*sql.Selector)
// PendingAuthSession is the predicate function for pendingauthsession builders.
type PendingAuthSession func(*sql.Selector)
// PromoCode is the predicate function for promocode builders.
type PromoCode func(*sql.Selector)
......
......@@ -10,12 +10,20 @@ import (
"github.com/Wei-Shaw/sub2api/ent/announcement"
"github.com/Wei-Shaw/sub2api/ent/announcementread"
"github.com/Wei-Shaw/sub2api/ent/apikey"
"github.com/Wei-Shaw/sub2api/ent/authidentity"
"github.com/Wei-Shaw/sub2api/ent/authidentitychannel"
"github.com/Wei-Shaw/sub2api/ent/channelmonitor"
"github.com/Wei-Shaw/sub2api/ent/channelmonitordailyrollup"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorhistory"
"github.com/Wei-Shaw/sub2api/ent/channelmonitorrequesttemplate"
"github.com/Wei-Shaw/sub2api/ent/errorpassthroughrule"
"github.com/Wei-Shaw/sub2api/ent/group"
"github.com/Wei-Shaw/sub2api/ent/idempotencyrecord"
"github.com/Wei-Shaw/sub2api/ent/identityadoptiondecision"
"github.com/Wei-Shaw/sub2api/ent/paymentauditlog"
"github.com/Wei-Shaw/sub2api/ent/paymentorder"
"github.com/Wei-Shaw/sub2api/ent/paymentproviderinstance"
"github.com/Wei-Shaw/sub2api/ent/pendingauthsession"
"github.com/Wei-Shaw/sub2api/ent/promocode"
"github.com/Wei-Shaw/sub2api/ent/promocodeusage"
"github.com/Wei-Shaw/sub2api/ent/proxy"
......@@ -314,6 +322,366 @@ func init() {
announcementreadDescCreatedAt := announcementreadFields[3].Descriptor()
// announcementread.DefaultCreatedAt holds the default value on creation for the created_at field.
announcementread.DefaultCreatedAt = announcementreadDescCreatedAt.Default.(func() time.Time)
authidentityMixin := schema.AuthIdentity{}.Mixin()
authidentityMixinFields0 := authidentityMixin[0].Fields()
_ = authidentityMixinFields0
authidentityFields := schema.AuthIdentity{}.Fields()
_ = authidentityFields
// authidentityDescCreatedAt is the schema descriptor for created_at field.
authidentityDescCreatedAt := authidentityMixinFields0[0].Descriptor()
// authidentity.DefaultCreatedAt holds the default value on creation for the created_at field.
authidentity.DefaultCreatedAt = authidentityDescCreatedAt.Default.(func() time.Time)
// authidentityDescUpdatedAt is the schema descriptor for updated_at field.
authidentityDescUpdatedAt := authidentityMixinFields0[1].Descriptor()
// authidentity.DefaultUpdatedAt holds the default value on creation for the updated_at field.
authidentity.DefaultUpdatedAt = authidentityDescUpdatedAt.Default.(func() time.Time)
// authidentity.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
authidentity.UpdateDefaultUpdatedAt = authidentityDescUpdatedAt.UpdateDefault.(func() time.Time)
// authidentityDescProviderType is the schema descriptor for provider_type field.
authidentityDescProviderType := authidentityFields[1].Descriptor()
// authidentity.ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
authidentity.ProviderTypeValidator = func() func(string) error {
validators := authidentityDescProviderType.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
validators[2].(func(string) error),
}
return func(provider_type string) error {
for _, fn := range fns {
if err := fn(provider_type); err != nil {
return err
}
}
return nil
}
}()
// authidentityDescProviderKey is the schema descriptor for provider_key field.
authidentityDescProviderKey := authidentityFields[2].Descriptor()
// authidentity.ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
authidentity.ProviderKeyValidator = authidentityDescProviderKey.Validators[0].(func(string) error)
// authidentityDescProviderSubject is the schema descriptor for provider_subject field.
authidentityDescProviderSubject := authidentityFields[3].Descriptor()
// authidentity.ProviderSubjectValidator is a validator for the "provider_subject" field. It is called by the builders before save.
authidentity.ProviderSubjectValidator = authidentityDescProviderSubject.Validators[0].(func(string) error)
// authidentityDescMetadata is the schema descriptor for metadata field.
authidentityDescMetadata := authidentityFields[6].Descriptor()
// authidentity.DefaultMetadata holds the default value on creation for the metadata field.
authidentity.DefaultMetadata = authidentityDescMetadata.Default.(func() map[string]interface{})
authidentitychannelMixin := schema.AuthIdentityChannel{}.Mixin()
authidentitychannelMixinFields0 := authidentitychannelMixin[0].Fields()
_ = authidentitychannelMixinFields0
authidentitychannelFields := schema.AuthIdentityChannel{}.Fields()
_ = authidentitychannelFields
// authidentitychannelDescCreatedAt is the schema descriptor for created_at field.
authidentitychannelDescCreatedAt := authidentitychannelMixinFields0[0].Descriptor()
// authidentitychannel.DefaultCreatedAt holds the default value on creation for the created_at field.
authidentitychannel.DefaultCreatedAt = authidentitychannelDescCreatedAt.Default.(func() time.Time)
// authidentitychannelDescUpdatedAt is the schema descriptor for updated_at field.
authidentitychannelDescUpdatedAt := authidentitychannelMixinFields0[1].Descriptor()
// authidentitychannel.DefaultUpdatedAt holds the default value on creation for the updated_at field.
authidentitychannel.DefaultUpdatedAt = authidentitychannelDescUpdatedAt.Default.(func() time.Time)
// authidentitychannel.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
authidentitychannel.UpdateDefaultUpdatedAt = authidentitychannelDescUpdatedAt.UpdateDefault.(func() time.Time)
// authidentitychannelDescProviderType is the schema descriptor for provider_type field.
authidentitychannelDescProviderType := authidentitychannelFields[1].Descriptor()
// authidentitychannel.ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
authidentitychannel.ProviderTypeValidator = func() func(string) error {
validators := authidentitychannelDescProviderType.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
validators[2].(func(string) error),
}
return func(provider_type string) error {
for _, fn := range fns {
if err := fn(provider_type); err != nil {
return err
}
}
return nil
}
}()
// authidentitychannelDescProviderKey is the schema descriptor for provider_key field.
authidentitychannelDescProviderKey := authidentitychannelFields[2].Descriptor()
// authidentitychannel.ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
authidentitychannel.ProviderKeyValidator = authidentitychannelDescProviderKey.Validators[0].(func(string) error)
// authidentitychannelDescChannel is the schema descriptor for channel field.
authidentitychannelDescChannel := authidentitychannelFields[3].Descriptor()
// authidentitychannel.ChannelValidator is a validator for the "channel" field. It is called by the builders before save.
authidentitychannel.ChannelValidator = func() func(string) error {
validators := authidentitychannelDescChannel.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(channel string) error {
for _, fn := range fns {
if err := fn(channel); err != nil {
return err
}
}
return nil
}
}()
// authidentitychannelDescChannelAppID is the schema descriptor for channel_app_id field.
authidentitychannelDescChannelAppID := authidentitychannelFields[4].Descriptor()
// authidentitychannel.ChannelAppIDValidator is a validator for the "channel_app_id" field. It is called by the builders before save.
authidentitychannel.ChannelAppIDValidator = authidentitychannelDescChannelAppID.Validators[0].(func(string) error)
// authidentitychannelDescChannelSubject is the schema descriptor for channel_subject field.
authidentitychannelDescChannelSubject := authidentitychannelFields[5].Descriptor()
// authidentitychannel.ChannelSubjectValidator is a validator for the "channel_subject" field. It is called by the builders before save.
authidentitychannel.ChannelSubjectValidator = authidentitychannelDescChannelSubject.Validators[0].(func(string) error)
// authidentitychannelDescMetadata is the schema descriptor for metadata field.
authidentitychannelDescMetadata := authidentitychannelFields[6].Descriptor()
// authidentitychannel.DefaultMetadata holds the default value on creation for the metadata field.
authidentitychannel.DefaultMetadata = authidentitychannelDescMetadata.Default.(func() map[string]interface{})
channelmonitorMixin := schema.ChannelMonitor{}.Mixin()
channelmonitorMixinFields0 := channelmonitorMixin[0].Fields()
_ = channelmonitorMixinFields0
channelmonitorFields := schema.ChannelMonitor{}.Fields()
_ = channelmonitorFields
// channelmonitorDescCreatedAt is the schema descriptor for created_at field.
channelmonitorDescCreatedAt := channelmonitorMixinFields0[0].Descriptor()
// channelmonitor.DefaultCreatedAt holds the default value on creation for the created_at field.
channelmonitor.DefaultCreatedAt = channelmonitorDescCreatedAt.Default.(func() time.Time)
// channelmonitorDescUpdatedAt is the schema descriptor for updated_at field.
channelmonitorDescUpdatedAt := channelmonitorMixinFields0[1].Descriptor()
// channelmonitor.DefaultUpdatedAt holds the default value on creation for the updated_at field.
channelmonitor.DefaultUpdatedAt = channelmonitorDescUpdatedAt.Default.(func() time.Time)
// channelmonitor.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
channelmonitor.UpdateDefaultUpdatedAt = channelmonitorDescUpdatedAt.UpdateDefault.(func() time.Time)
// channelmonitorDescName is the schema descriptor for name field.
channelmonitorDescName := channelmonitorFields[0].Descriptor()
// channelmonitor.NameValidator is a validator for the "name" field. It is called by the builders before save.
channelmonitor.NameValidator = func() func(string) error {
validators := channelmonitorDescName.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(name string) error {
for _, fn := range fns {
if err := fn(name); err != nil {
return err
}
}
return nil
}
}()
// channelmonitorDescEndpoint is the schema descriptor for endpoint field.
channelmonitorDescEndpoint := channelmonitorFields[2].Descriptor()
// channelmonitor.EndpointValidator is a validator for the "endpoint" field. It is called by the builders before save.
channelmonitor.EndpointValidator = func() func(string) error {
validators := channelmonitorDescEndpoint.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(endpoint string) error {
for _, fn := range fns {
if err := fn(endpoint); err != nil {
return err
}
}
return nil
}
}()
// channelmonitorDescAPIKeyEncrypted is the schema descriptor for api_key_encrypted field.
channelmonitorDescAPIKeyEncrypted := channelmonitorFields[3].Descriptor()
// channelmonitor.APIKeyEncryptedValidator is a validator for the "api_key_encrypted" field. It is called by the builders before save.
channelmonitor.APIKeyEncryptedValidator = channelmonitorDescAPIKeyEncrypted.Validators[0].(func(string) error)
// channelmonitorDescPrimaryModel is the schema descriptor for primary_model field.
channelmonitorDescPrimaryModel := channelmonitorFields[4].Descriptor()
// channelmonitor.PrimaryModelValidator is a validator for the "primary_model" field. It is called by the builders before save.
channelmonitor.PrimaryModelValidator = func() func(string) error {
validators := channelmonitorDescPrimaryModel.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(primary_model string) error {
for _, fn := range fns {
if err := fn(primary_model); err != nil {
return err
}
}
return nil
}
}()
// channelmonitorDescExtraModels is the schema descriptor for extra_models field.
channelmonitorDescExtraModels := channelmonitorFields[5].Descriptor()
// channelmonitor.DefaultExtraModels holds the default value on creation for the extra_models field.
channelmonitor.DefaultExtraModels = channelmonitorDescExtraModels.Default.([]string)
// channelmonitorDescGroupName is the schema descriptor for group_name field.
channelmonitorDescGroupName := channelmonitorFields[6].Descriptor()
// channelmonitor.DefaultGroupName holds the default value on creation for the group_name field.
channelmonitor.DefaultGroupName = channelmonitorDescGroupName.Default.(string)
// channelmonitor.GroupNameValidator is a validator for the "group_name" field. It is called by the builders before save.
channelmonitor.GroupNameValidator = channelmonitorDescGroupName.Validators[0].(func(string) error)
// channelmonitorDescEnabled is the schema descriptor for enabled field.
channelmonitorDescEnabled := channelmonitorFields[7].Descriptor()
// channelmonitor.DefaultEnabled holds the default value on creation for the enabled field.
channelmonitor.DefaultEnabled = channelmonitorDescEnabled.Default.(bool)
// channelmonitorDescIntervalSeconds is the schema descriptor for interval_seconds field.
channelmonitorDescIntervalSeconds := channelmonitorFields[8].Descriptor()
// channelmonitor.IntervalSecondsValidator is a validator for the "interval_seconds" field. It is called by the builders before save.
channelmonitor.IntervalSecondsValidator = channelmonitorDescIntervalSeconds.Validators[0].(func(int) error)
// channelmonitorDescExtraHeaders is the schema descriptor for extra_headers field.
channelmonitorDescExtraHeaders := channelmonitorFields[12].Descriptor()
// channelmonitor.DefaultExtraHeaders holds the default value on creation for the extra_headers field.
channelmonitor.DefaultExtraHeaders = channelmonitorDescExtraHeaders.Default.(map[string]string)
// channelmonitorDescBodyOverrideMode is the schema descriptor for body_override_mode field.
channelmonitorDescBodyOverrideMode := channelmonitorFields[13].Descriptor()
// channelmonitor.DefaultBodyOverrideMode holds the default value on creation for the body_override_mode field.
channelmonitor.DefaultBodyOverrideMode = channelmonitorDescBodyOverrideMode.Default.(string)
// channelmonitor.BodyOverrideModeValidator is a validator for the "body_override_mode" field. It is called by the builders before save.
channelmonitor.BodyOverrideModeValidator = channelmonitorDescBodyOverrideMode.Validators[0].(func(string) error)
channelmonitordailyrollupFields := schema.ChannelMonitorDailyRollup{}.Fields()
_ = channelmonitordailyrollupFields
// channelmonitordailyrollupDescModel is the schema descriptor for model field.
channelmonitordailyrollupDescModel := channelmonitordailyrollupFields[1].Descriptor()
// channelmonitordailyrollup.ModelValidator is a validator for the "model" field. It is called by the builders before save.
channelmonitordailyrollup.ModelValidator = func() func(string) error {
validators := channelmonitordailyrollupDescModel.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(model string) error {
for _, fn := range fns {
if err := fn(model); err != nil {
return err
}
}
return nil
}
}()
// channelmonitordailyrollupDescTotalChecks is the schema descriptor for total_checks field.
channelmonitordailyrollupDescTotalChecks := channelmonitordailyrollupFields[3].Descriptor()
// channelmonitordailyrollup.DefaultTotalChecks holds the default value on creation for the total_checks field.
channelmonitordailyrollup.DefaultTotalChecks = channelmonitordailyrollupDescTotalChecks.Default.(int)
// channelmonitordailyrollupDescOkCount is the schema descriptor for ok_count field.
channelmonitordailyrollupDescOkCount := channelmonitordailyrollupFields[4].Descriptor()
// channelmonitordailyrollup.DefaultOkCount holds the default value on creation for the ok_count field.
channelmonitordailyrollup.DefaultOkCount = channelmonitordailyrollupDescOkCount.Default.(int)
// channelmonitordailyrollupDescOperationalCount is the schema descriptor for operational_count field.
channelmonitordailyrollupDescOperationalCount := channelmonitordailyrollupFields[5].Descriptor()
// channelmonitordailyrollup.DefaultOperationalCount holds the default value on creation for the operational_count field.
channelmonitordailyrollup.DefaultOperationalCount = channelmonitordailyrollupDescOperationalCount.Default.(int)
// channelmonitordailyrollupDescDegradedCount is the schema descriptor for degraded_count field.
channelmonitordailyrollupDescDegradedCount := channelmonitordailyrollupFields[6].Descriptor()
// channelmonitordailyrollup.DefaultDegradedCount holds the default value on creation for the degraded_count field.
channelmonitordailyrollup.DefaultDegradedCount = channelmonitordailyrollupDescDegradedCount.Default.(int)
// channelmonitordailyrollupDescFailedCount is the schema descriptor for failed_count field.
channelmonitordailyrollupDescFailedCount := channelmonitordailyrollupFields[7].Descriptor()
// channelmonitordailyrollup.DefaultFailedCount holds the default value on creation for the failed_count field.
channelmonitordailyrollup.DefaultFailedCount = channelmonitordailyrollupDescFailedCount.Default.(int)
// channelmonitordailyrollupDescErrorCount is the schema descriptor for error_count field.
channelmonitordailyrollupDescErrorCount := channelmonitordailyrollupFields[8].Descriptor()
// channelmonitordailyrollup.DefaultErrorCount holds the default value on creation for the error_count field.
channelmonitordailyrollup.DefaultErrorCount = channelmonitordailyrollupDescErrorCount.Default.(int)
// channelmonitordailyrollupDescSumLatencyMs is the schema descriptor for sum_latency_ms field.
channelmonitordailyrollupDescSumLatencyMs := channelmonitordailyrollupFields[9].Descriptor()
// channelmonitordailyrollup.DefaultSumLatencyMs holds the default value on creation for the sum_latency_ms field.
channelmonitordailyrollup.DefaultSumLatencyMs = channelmonitordailyrollupDescSumLatencyMs.Default.(int64)
// channelmonitordailyrollupDescCountLatency is the schema descriptor for count_latency field.
channelmonitordailyrollupDescCountLatency := channelmonitordailyrollupFields[10].Descriptor()
// channelmonitordailyrollup.DefaultCountLatency holds the default value on creation for the count_latency field.
channelmonitordailyrollup.DefaultCountLatency = channelmonitordailyrollupDescCountLatency.Default.(int)
// channelmonitordailyrollupDescSumPingLatencyMs is the schema descriptor for sum_ping_latency_ms field.
channelmonitordailyrollupDescSumPingLatencyMs := channelmonitordailyrollupFields[11].Descriptor()
// channelmonitordailyrollup.DefaultSumPingLatencyMs holds the default value on creation for the sum_ping_latency_ms field.
channelmonitordailyrollup.DefaultSumPingLatencyMs = channelmonitordailyrollupDescSumPingLatencyMs.Default.(int64)
// channelmonitordailyrollupDescCountPingLatency is the schema descriptor for count_ping_latency field.
channelmonitordailyrollupDescCountPingLatency := channelmonitordailyrollupFields[12].Descriptor()
// channelmonitordailyrollup.DefaultCountPingLatency holds the default value on creation for the count_ping_latency field.
channelmonitordailyrollup.DefaultCountPingLatency = channelmonitordailyrollupDescCountPingLatency.Default.(int)
// channelmonitordailyrollupDescComputedAt is the schema descriptor for computed_at field.
channelmonitordailyrollupDescComputedAt := channelmonitordailyrollupFields[13].Descriptor()
// channelmonitordailyrollup.DefaultComputedAt holds the default value on creation for the computed_at field.
channelmonitordailyrollup.DefaultComputedAt = channelmonitordailyrollupDescComputedAt.Default.(func() time.Time)
// channelmonitordailyrollup.UpdateDefaultComputedAt holds the default value on update for the computed_at field.
channelmonitordailyrollup.UpdateDefaultComputedAt = channelmonitordailyrollupDescComputedAt.UpdateDefault.(func() time.Time)
channelmonitorhistoryFields := schema.ChannelMonitorHistory{}.Fields()
_ = channelmonitorhistoryFields
// channelmonitorhistoryDescModel is the schema descriptor for model field.
channelmonitorhistoryDescModel := channelmonitorhistoryFields[1].Descriptor()
// channelmonitorhistory.ModelValidator is a validator for the "model" field. It is called by the builders before save.
channelmonitorhistory.ModelValidator = func() func(string) error {
validators := channelmonitorhistoryDescModel.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(model string) error {
for _, fn := range fns {
if err := fn(model); err != nil {
return err
}
}
return nil
}
}()
// channelmonitorhistoryDescMessage is the schema descriptor for message field.
channelmonitorhistoryDescMessage := channelmonitorhistoryFields[5].Descriptor()
// channelmonitorhistory.DefaultMessage holds the default value on creation for the message field.
channelmonitorhistory.DefaultMessage = channelmonitorhistoryDescMessage.Default.(string)
// channelmonitorhistory.MessageValidator is a validator for the "message" field. It is called by the builders before save.
channelmonitorhistory.MessageValidator = channelmonitorhistoryDescMessage.Validators[0].(func(string) error)
// channelmonitorhistoryDescCheckedAt is the schema descriptor for checked_at field.
channelmonitorhistoryDescCheckedAt := channelmonitorhistoryFields[6].Descriptor()
// channelmonitorhistory.DefaultCheckedAt holds the default value on creation for the checked_at field.
channelmonitorhistory.DefaultCheckedAt = channelmonitorhistoryDescCheckedAt.Default.(func() time.Time)
channelmonitorrequesttemplateMixin := schema.ChannelMonitorRequestTemplate{}.Mixin()
channelmonitorrequesttemplateMixinFields0 := channelmonitorrequesttemplateMixin[0].Fields()
_ = channelmonitorrequesttemplateMixinFields0
channelmonitorrequesttemplateFields := schema.ChannelMonitorRequestTemplate{}.Fields()
_ = channelmonitorrequesttemplateFields
// channelmonitorrequesttemplateDescCreatedAt is the schema descriptor for created_at field.
channelmonitorrequesttemplateDescCreatedAt := channelmonitorrequesttemplateMixinFields0[0].Descriptor()
// channelmonitorrequesttemplate.DefaultCreatedAt holds the default value on creation for the created_at field.
channelmonitorrequesttemplate.DefaultCreatedAt = channelmonitorrequesttemplateDescCreatedAt.Default.(func() time.Time)
// channelmonitorrequesttemplateDescUpdatedAt is the schema descriptor for updated_at field.
channelmonitorrequesttemplateDescUpdatedAt := channelmonitorrequesttemplateMixinFields0[1].Descriptor()
// channelmonitorrequesttemplate.DefaultUpdatedAt holds the default value on creation for the updated_at field.
channelmonitorrequesttemplate.DefaultUpdatedAt = channelmonitorrequesttemplateDescUpdatedAt.Default.(func() time.Time)
// channelmonitorrequesttemplate.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
channelmonitorrequesttemplate.UpdateDefaultUpdatedAt = channelmonitorrequesttemplateDescUpdatedAt.UpdateDefault.(func() time.Time)
// channelmonitorrequesttemplateDescName is the schema descriptor for name field.
channelmonitorrequesttemplateDescName := channelmonitorrequesttemplateFields[0].Descriptor()
// channelmonitorrequesttemplate.NameValidator is a validator for the "name" field. It is called by the builders before save.
channelmonitorrequesttemplate.NameValidator = func() func(string) error {
validators := channelmonitorrequesttemplateDescName.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(name string) error {
for _, fn := range fns {
if err := fn(name); err != nil {
return err
}
}
return nil
}
}()
// channelmonitorrequesttemplateDescDescription is the schema descriptor for description field.
channelmonitorrequesttemplateDescDescription := channelmonitorrequesttemplateFields[2].Descriptor()
// channelmonitorrequesttemplate.DefaultDescription holds the default value on creation for the description field.
channelmonitorrequesttemplate.DefaultDescription = channelmonitorrequesttemplateDescDescription.Default.(string)
// channelmonitorrequesttemplate.DescriptionValidator is a validator for the "description" field. It is called by the builders before save.
channelmonitorrequesttemplate.DescriptionValidator = channelmonitorrequesttemplateDescDescription.Validators[0].(func(string) error)
// channelmonitorrequesttemplateDescExtraHeaders is the schema descriptor for extra_headers field.
channelmonitorrequesttemplateDescExtraHeaders := channelmonitorrequesttemplateFields[3].Descriptor()
// channelmonitorrequesttemplate.DefaultExtraHeaders holds the default value on creation for the extra_headers field.
channelmonitorrequesttemplate.DefaultExtraHeaders = channelmonitorrequesttemplateDescExtraHeaders.Default.(map[string]string)
// channelmonitorrequesttemplateDescBodyOverrideMode is the schema descriptor for body_override_mode field.
channelmonitorrequesttemplateDescBodyOverrideMode := channelmonitorrequesttemplateFields[4].Descriptor()
// channelmonitorrequesttemplate.DefaultBodyOverrideMode holds the default value on creation for the body_override_mode field.
channelmonitorrequesttemplate.DefaultBodyOverrideMode = channelmonitorrequesttemplateDescBodyOverrideMode.Default.(string)
// channelmonitorrequesttemplate.BodyOverrideModeValidator is a validator for the "body_override_mode" field. It is called by the builders before save.
channelmonitorrequesttemplate.BodyOverrideModeValidator = channelmonitorrequesttemplateDescBodyOverrideMode.Validators[0].(func(string) error)
errorpassthroughruleMixin := schema.ErrorPassthroughRule{}.Mixin()
errorpassthroughruleMixinFields0 := errorpassthroughruleMixin[0].Fields()
_ = errorpassthroughruleMixinFields0
......@@ -482,6 +850,10 @@ func init() {
groupDescMessagesDispatchModelConfig := groupFields[26].Descriptor()
// group.DefaultMessagesDispatchModelConfig holds the default value on creation for the messages_dispatch_model_config field.
group.DefaultMessagesDispatchModelConfig = groupDescMessagesDispatchModelConfig.Default.(domain.OpenAIMessagesDispatchModelConfig)
// groupDescRpmLimit is the schema descriptor for rpm_limit field.
groupDescRpmLimit := groupFields[27].Descriptor()
// group.DefaultRpmLimit holds the default value on creation for the rpm_limit field.
group.DefaultRpmLimit = groupDescRpmLimit.Default.(int)
idempotencyrecordMixin := schema.IdempotencyRecord{}.Mixin()
idempotencyrecordMixinFields0 := idempotencyrecordMixin[0].Fields()
_ = idempotencyrecordMixinFields0
......@@ -517,6 +889,33 @@ func init() {
idempotencyrecordDescErrorReason := idempotencyrecordFields[6].Descriptor()
// idempotencyrecord.ErrorReasonValidator is a validator for the "error_reason" field. It is called by the builders before save.
idempotencyrecord.ErrorReasonValidator = idempotencyrecordDescErrorReason.Validators[0].(func(string) error)
identityadoptiondecisionMixin := schema.IdentityAdoptionDecision{}.Mixin()
identityadoptiondecisionMixinFields0 := identityadoptiondecisionMixin[0].Fields()
_ = identityadoptiondecisionMixinFields0
identityadoptiondecisionFields := schema.IdentityAdoptionDecision{}.Fields()
_ = identityadoptiondecisionFields
// identityadoptiondecisionDescCreatedAt is the schema descriptor for created_at field.
identityadoptiondecisionDescCreatedAt := identityadoptiondecisionMixinFields0[0].Descriptor()
// identityadoptiondecision.DefaultCreatedAt holds the default value on creation for the created_at field.
identityadoptiondecision.DefaultCreatedAt = identityadoptiondecisionDescCreatedAt.Default.(func() time.Time)
// identityadoptiondecisionDescUpdatedAt is the schema descriptor for updated_at field.
identityadoptiondecisionDescUpdatedAt := identityadoptiondecisionMixinFields0[1].Descriptor()
// identityadoptiondecision.DefaultUpdatedAt holds the default value on creation for the updated_at field.
identityadoptiondecision.DefaultUpdatedAt = identityadoptiondecisionDescUpdatedAt.Default.(func() time.Time)
// identityadoptiondecision.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
identityadoptiondecision.UpdateDefaultUpdatedAt = identityadoptiondecisionDescUpdatedAt.UpdateDefault.(func() time.Time)
// identityadoptiondecisionDescAdoptDisplayName is the schema descriptor for adopt_display_name field.
identityadoptiondecisionDescAdoptDisplayName := identityadoptiondecisionFields[2].Descriptor()
// identityadoptiondecision.DefaultAdoptDisplayName holds the default value on creation for the adopt_display_name field.
identityadoptiondecision.DefaultAdoptDisplayName = identityadoptiondecisionDescAdoptDisplayName.Default.(bool)
// identityadoptiondecisionDescAdoptAvatar is the schema descriptor for adopt_avatar field.
identityadoptiondecisionDescAdoptAvatar := identityadoptiondecisionFields[3].Descriptor()
// identityadoptiondecision.DefaultAdoptAvatar holds the default value on creation for the adopt_avatar field.
identityadoptiondecision.DefaultAdoptAvatar = identityadoptiondecisionDescAdoptAvatar.Default.(bool)
// identityadoptiondecisionDescDecidedAt is the schema descriptor for decided_at field.
identityadoptiondecisionDescDecidedAt := identityadoptiondecisionFields[4].Descriptor()
// identityadoptiondecision.DefaultDecidedAt holds the default value on creation for the decided_at field.
identityadoptiondecision.DefaultDecidedAt = identityadoptiondecisionDescDecidedAt.Default.(func() time.Time)
paymentauditlogFields := schema.PaymentAuditLog{}.Fields()
_ = paymentauditlogFields
// paymentauditlogDescOrderID is the schema descriptor for order_id field.
......@@ -583,38 +982,42 @@ func init() {
paymentorderDescProviderInstanceID := paymentorderFields[18].Descriptor()
// paymentorder.ProviderInstanceIDValidator is a validator for the "provider_instance_id" field. It is called by the builders before save.
paymentorder.ProviderInstanceIDValidator = paymentorderDescProviderInstanceID.Validators[0].(func(string) error)
// paymentorderDescProviderKey is the schema descriptor for provider_key field.
paymentorderDescProviderKey := paymentorderFields[19].Descriptor()
// paymentorder.ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
paymentorder.ProviderKeyValidator = paymentorderDescProviderKey.Validators[0].(func(string) error)
// paymentorderDescStatus is the schema descriptor for status field.
paymentorderDescStatus := paymentorderFields[19].Descriptor()
paymentorderDescStatus := paymentorderFields[21].Descriptor()
// paymentorder.DefaultStatus holds the default value on creation for the status field.
paymentorder.DefaultStatus = paymentorderDescStatus.Default.(string)
// paymentorder.StatusValidator is a validator for the "status" field. It is called by the builders before save.
paymentorder.StatusValidator = paymentorderDescStatus.Validators[0].(func(string) error)
// paymentorderDescRefundAmount is the schema descriptor for refund_amount field.
paymentorderDescRefundAmount := paymentorderFields[20].Descriptor()
paymentorderDescRefundAmount := paymentorderFields[22].Descriptor()
// paymentorder.DefaultRefundAmount holds the default value on creation for the refund_amount field.
paymentorder.DefaultRefundAmount = paymentorderDescRefundAmount.Default.(float64)
// paymentorderDescForceRefund is the schema descriptor for force_refund field.
paymentorderDescForceRefund := paymentorderFields[23].Descriptor()
paymentorderDescForceRefund := paymentorderFields[25].Descriptor()
// paymentorder.DefaultForceRefund holds the default value on creation for the force_refund field.
paymentorder.DefaultForceRefund = paymentorderDescForceRefund.Default.(bool)
// paymentorderDescRefundRequestedBy is the schema descriptor for refund_requested_by field.
paymentorderDescRefundRequestedBy := paymentorderFields[26].Descriptor()
paymentorderDescRefundRequestedBy := paymentorderFields[28].Descriptor()
// paymentorder.RefundRequestedByValidator is a validator for the "refund_requested_by" field. It is called by the builders before save.
paymentorder.RefundRequestedByValidator = paymentorderDescRefundRequestedBy.Validators[0].(func(string) error)
// paymentorderDescClientIP is the schema descriptor for client_ip field.
paymentorderDescClientIP := paymentorderFields[32].Descriptor()
paymentorderDescClientIP := paymentorderFields[34].Descriptor()
// paymentorder.ClientIPValidator is a validator for the "client_ip" field. It is called by the builders before save.
paymentorder.ClientIPValidator = paymentorderDescClientIP.Validators[0].(func(string) error)
// paymentorderDescSrcHost is the schema descriptor for src_host field.
paymentorderDescSrcHost := paymentorderFields[33].Descriptor()
paymentorderDescSrcHost := paymentorderFields[35].Descriptor()
// paymentorder.SrcHostValidator is a validator for the "src_host" field. It is called by the builders before save.
paymentorder.SrcHostValidator = paymentorderDescSrcHost.Validators[0].(func(string) error)
// paymentorderDescCreatedAt is the schema descriptor for created_at field.
paymentorderDescCreatedAt := paymentorderFields[35].Descriptor()
paymentorderDescCreatedAt := paymentorderFields[37].Descriptor()
// paymentorder.DefaultCreatedAt holds the default value on creation for the created_at field.
paymentorder.DefaultCreatedAt = paymentorderDescCreatedAt.Default.(func() time.Time)
// paymentorderDescUpdatedAt is the schema descriptor for updated_at field.
paymentorderDescUpdatedAt := paymentorderFields[36].Descriptor()
paymentorderDescUpdatedAt := paymentorderFields[38].Descriptor()
// paymentorder.DefaultUpdatedAt holds the default value on creation for the updated_at field.
paymentorder.DefaultUpdatedAt = paymentorderDescUpdatedAt.Default.(func() time.Time)
// paymentorder.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
......@@ -687,6 +1090,113 @@ func init() {
paymentproviderinstance.DefaultUpdatedAt = paymentproviderinstanceDescUpdatedAt.Default.(func() time.Time)
// paymentproviderinstance.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
paymentproviderinstance.UpdateDefaultUpdatedAt = paymentproviderinstanceDescUpdatedAt.UpdateDefault.(func() time.Time)
pendingauthsessionMixin := schema.PendingAuthSession{}.Mixin()
pendingauthsessionMixinFields0 := pendingauthsessionMixin[0].Fields()
_ = pendingauthsessionMixinFields0
pendingauthsessionFields := schema.PendingAuthSession{}.Fields()
_ = pendingauthsessionFields
// pendingauthsessionDescCreatedAt is the schema descriptor for created_at field.
pendingauthsessionDescCreatedAt := pendingauthsessionMixinFields0[0].Descriptor()
// pendingauthsession.DefaultCreatedAt holds the default value on creation for the created_at field.
pendingauthsession.DefaultCreatedAt = pendingauthsessionDescCreatedAt.Default.(func() time.Time)
// pendingauthsessionDescUpdatedAt is the schema descriptor for updated_at field.
pendingauthsessionDescUpdatedAt := pendingauthsessionMixinFields0[1].Descriptor()
// pendingauthsession.DefaultUpdatedAt holds the default value on creation for the updated_at field.
pendingauthsession.DefaultUpdatedAt = pendingauthsessionDescUpdatedAt.Default.(func() time.Time)
// pendingauthsession.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
pendingauthsession.UpdateDefaultUpdatedAt = pendingauthsessionDescUpdatedAt.UpdateDefault.(func() time.Time)
// pendingauthsessionDescSessionToken is the schema descriptor for session_token field.
pendingauthsessionDescSessionToken := pendingauthsessionFields[0].Descriptor()
// pendingauthsession.SessionTokenValidator is a validator for the "session_token" field. It is called by the builders before save.
pendingauthsession.SessionTokenValidator = func() func(string) error {
validators := pendingauthsessionDescSessionToken.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
}
return func(session_token string) error {
for _, fn := range fns {
if err := fn(session_token); err != nil {
return err
}
}
return nil
}
}()
// pendingauthsessionDescIntent is the schema descriptor for intent field.
pendingauthsessionDescIntent := pendingauthsessionFields[1].Descriptor()
// pendingauthsession.IntentValidator is a validator for the "intent" field. It is called by the builders before save.
pendingauthsession.IntentValidator = func() func(string) error {
validators := pendingauthsessionDescIntent.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
validators[2].(func(string) error),
}
return func(intent string) error {
for _, fn := range fns {
if err := fn(intent); err != nil {
return err
}
}
return nil
}
}()
// pendingauthsessionDescProviderType is the schema descriptor for provider_type field.
pendingauthsessionDescProviderType := pendingauthsessionFields[2].Descriptor()
// pendingauthsession.ProviderTypeValidator is a validator for the "provider_type" field. It is called by the builders before save.
pendingauthsession.ProviderTypeValidator = func() func(string) error {
validators := pendingauthsessionDescProviderType.Validators
fns := [...]func(string) error{
validators[0].(func(string) error),
validators[1].(func(string) error),
validators[2].(func(string) error),
}
return func(provider_type string) error {
for _, fn := range fns {
if err := fn(provider_type); err != nil {
return err
}
}
return nil
}
}()
// pendingauthsessionDescProviderKey is the schema descriptor for provider_key field.
pendingauthsessionDescProviderKey := pendingauthsessionFields[3].Descriptor()
// pendingauthsession.ProviderKeyValidator is a validator for the "provider_key" field. It is called by the builders before save.
pendingauthsession.ProviderKeyValidator = pendingauthsessionDescProviderKey.Validators[0].(func(string) error)
// pendingauthsessionDescProviderSubject is the schema descriptor for provider_subject field.
pendingauthsessionDescProviderSubject := pendingauthsessionFields[4].Descriptor()
// pendingauthsession.ProviderSubjectValidator is a validator for the "provider_subject" field. It is called by the builders before save.
pendingauthsession.ProviderSubjectValidator = pendingauthsessionDescProviderSubject.Validators[0].(func(string) error)
// pendingauthsessionDescRedirectTo is the schema descriptor for redirect_to field.
pendingauthsessionDescRedirectTo := pendingauthsessionFields[6].Descriptor()
// pendingauthsession.DefaultRedirectTo holds the default value on creation for the redirect_to field.
pendingauthsession.DefaultRedirectTo = pendingauthsessionDescRedirectTo.Default.(string)
// pendingauthsessionDescResolvedEmail is the schema descriptor for resolved_email field.
pendingauthsessionDescResolvedEmail := pendingauthsessionFields[7].Descriptor()
// pendingauthsession.DefaultResolvedEmail holds the default value on creation for the resolved_email field.
pendingauthsession.DefaultResolvedEmail = pendingauthsessionDescResolvedEmail.Default.(string)
// pendingauthsessionDescRegistrationPasswordHash is the schema descriptor for registration_password_hash field.
pendingauthsessionDescRegistrationPasswordHash := pendingauthsessionFields[8].Descriptor()
// pendingauthsession.DefaultRegistrationPasswordHash holds the default value on creation for the registration_password_hash field.
pendingauthsession.DefaultRegistrationPasswordHash = pendingauthsessionDescRegistrationPasswordHash.Default.(string)
// pendingauthsessionDescUpstreamIdentityClaims is the schema descriptor for upstream_identity_claims field.
pendingauthsessionDescUpstreamIdentityClaims := pendingauthsessionFields[9].Descriptor()
// pendingauthsession.DefaultUpstreamIdentityClaims holds the default value on creation for the upstream_identity_claims field.
pendingauthsession.DefaultUpstreamIdentityClaims = pendingauthsessionDescUpstreamIdentityClaims.Default.(func() map[string]interface{})
// pendingauthsessionDescLocalFlowState is the schema descriptor for local_flow_state field.
pendingauthsessionDescLocalFlowState := pendingauthsessionFields[10].Descriptor()
// pendingauthsession.DefaultLocalFlowState holds the default value on creation for the local_flow_state field.
pendingauthsession.DefaultLocalFlowState = pendingauthsessionDescLocalFlowState.Default.(func() map[string]interface{})
// pendingauthsessionDescBrowserSessionKey is the schema descriptor for browser_session_key field.
pendingauthsessionDescBrowserSessionKey := pendingauthsessionFields[11].Descriptor()
// pendingauthsession.DefaultBrowserSessionKey holds the default value on creation for the browser_session_key field.
pendingauthsession.DefaultBrowserSessionKey = pendingauthsessionDescBrowserSessionKey.Default.(string)
// pendingauthsessionDescCompletionCodeHash is the schema descriptor for completion_code_hash field.
pendingauthsessionDescCompletionCodeHash := pendingauthsessionFields[12].Descriptor()
// pendingauthsession.DefaultCompletionCodeHash holds the default value on creation for the completion_code_hash field.
pendingauthsession.DefaultCompletionCodeHash = pendingauthsessionDescCompletionCodeHash.Default.(string)
promocodeFields := schema.PromoCode{}.Fields()
_ = promocodeFields
// promocodeDescCode is the schema descriptor for code field.
......@@ -1328,22 +1838,32 @@ func init() {
userDescTotpEnabled := userFields[9].Descriptor()
// user.DefaultTotpEnabled holds the default value on creation for the totp_enabled field.
user.DefaultTotpEnabled = userDescTotpEnabled.Default.(bool)
// userDescSignupSource is the schema descriptor for signup_source field.
userDescSignupSource := userFields[11].Descriptor()
// user.DefaultSignupSource holds the default value on creation for the signup_source field.
user.DefaultSignupSource = userDescSignupSource.Default.(string)
// user.SignupSourceValidator is a validator for the "signup_source" field. It is called by the builders before save.
user.SignupSourceValidator = userDescSignupSource.Validators[0].(func(string) error)
// userDescBalanceNotifyEnabled is the schema descriptor for balance_notify_enabled field.
userDescBalanceNotifyEnabled := userFields[11].Descriptor()
userDescBalanceNotifyEnabled := userFields[14].Descriptor()
// user.DefaultBalanceNotifyEnabled holds the default value on creation for the balance_notify_enabled field.
user.DefaultBalanceNotifyEnabled = userDescBalanceNotifyEnabled.Default.(bool)
// userDescBalanceNotifyThresholdType is the schema descriptor for balance_notify_threshold_type field.
userDescBalanceNotifyThresholdType := userFields[12].Descriptor()
userDescBalanceNotifyThresholdType := userFields[15].Descriptor()
// user.DefaultBalanceNotifyThresholdType holds the default value on creation for the balance_notify_threshold_type field.
user.DefaultBalanceNotifyThresholdType = userDescBalanceNotifyThresholdType.Default.(string)
// userDescBalanceNotifyExtraEmails is the schema descriptor for balance_notify_extra_emails field.
userDescBalanceNotifyExtraEmails := userFields[14].Descriptor()
userDescBalanceNotifyExtraEmails := userFields[17].Descriptor()
// user.DefaultBalanceNotifyExtraEmails holds the default value on creation for the balance_notify_extra_emails field.
user.DefaultBalanceNotifyExtraEmails = userDescBalanceNotifyExtraEmails.Default.(string)
// userDescTotalRecharged is the schema descriptor for total_recharged field.
userDescTotalRecharged := userFields[15].Descriptor()
userDescTotalRecharged := userFields[18].Descriptor()
// user.DefaultTotalRecharged holds the default value on creation for the total_recharged field.
user.DefaultTotalRecharged = userDescTotalRecharged.Default.(float64)
// userDescRpmLimit is the schema descriptor for rpm_limit field.
userDescRpmLimit := userFields[19].Descriptor()
// user.DefaultRpmLimit holds the default value on creation for the rpm_limit field.
user.DefaultRpmLimit = userDescRpmLimit.Default.(int)
userallowedgroupFields := schema.UserAllowedGroup{}.Fields()
_ = userallowedgroupFields
// userallowedgroupDescCreatedAt is the schema descriptor for created_at field.
......
package schema
import (
"fmt"
"github.com/Wei-Shaw/sub2api/ent/schema/mixins"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
var authProviderTypes = map[string]struct{}{
"email": {},
"linuxdo": {},
"oidc": {},
"wechat": {},
}
func validateAuthProviderType(value string) error {
if _, ok := authProviderTypes[value]; ok {
return nil
}
return fmt.Errorf("invalid auth provider type %q", value)
}
// AuthIdentity stores the canonical login identity for an account.
type AuthIdentity struct {
ent.Schema
}
func (AuthIdentity) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "auth_identities"},
}
}
func (AuthIdentity) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.TimeMixin{},
}
}
func (AuthIdentity) Fields() []ent.Field {
return []ent.Field{
field.Int64("user_id"),
field.String("provider_type").
MaxLen(20).
NotEmpty().
Validate(validateAuthProviderType),
field.String("provider_key").
NotEmpty().
SchemaType(map[string]string{dialect.Postgres: "text"}),
field.String("provider_subject").
NotEmpty().
SchemaType(map[string]string{dialect.Postgres: "text"}),
field.Time("verified_at").
Optional().
Nillable().
SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
field.String("issuer").
Optional().
Nillable().
SchemaType(map[string]string{dialect.Postgres: "text"}),
field.JSON("metadata", map[string]any{}).
Default(func() map[string]any { return map[string]any{} }).
SchemaType(map[string]string{dialect.Postgres: "jsonb"}),
}
}
func (AuthIdentity) Edges() []ent.Edge {
return []ent.Edge{
edge.From("user", User.Type).
Ref("auth_identities").
Field("user_id").
Required().
Unique(),
edge.To("channels", AuthIdentityChannel.Type).
Annotations(entsql.OnDelete(entsql.Cascade)),
edge.To("adoption_decisions", IdentityAdoptionDecision.Type),
}
}
func (AuthIdentity) Indexes() []ent.Index {
return []ent.Index{
index.Fields("provider_type", "provider_key", "provider_subject").Unique(),
index.Fields("user_id"),
index.Fields("user_id", "provider_type"),
}
}
package schema
import (
"github.com/Wei-Shaw/sub2api/ent/schema/mixins"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// AuthIdentityChannel stores channel-scoped identifiers for a canonical identity.
type AuthIdentityChannel struct {
ent.Schema
}
func (AuthIdentityChannel) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "auth_identity_channels"},
}
}
func (AuthIdentityChannel) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.TimeMixin{},
}
}
func (AuthIdentityChannel) Fields() []ent.Field {
return []ent.Field{
field.Int64("identity_id"),
field.String("provider_type").
MaxLen(20).
NotEmpty().
Validate(validateAuthProviderType),
field.String("provider_key").
NotEmpty().
SchemaType(map[string]string{dialect.Postgres: "text"}),
field.String("channel").
MaxLen(20).
NotEmpty(),
field.String("channel_app_id").
NotEmpty().
SchemaType(map[string]string{dialect.Postgres: "text"}),
field.String("channel_subject").
NotEmpty().
SchemaType(map[string]string{dialect.Postgres: "text"}),
field.JSON("metadata", map[string]any{}).
Default(func() map[string]any { return map[string]any{} }).
SchemaType(map[string]string{dialect.Postgres: "jsonb"}),
}
}
func (AuthIdentityChannel) Edges() []ent.Edge {
return []ent.Edge{
edge.From("identity", AuthIdentity.Type).
Ref("channels").
Field("identity_id").
Required().
Unique(),
}
}
func (AuthIdentityChannel) Indexes() []ent.Index {
return []ent.Index{
index.Fields("provider_type", "provider_key", "channel", "channel_app_id", "channel_subject").Unique(),
index.Fields("identity_id"),
}
}
package schema
import (
"testing"
"entgo.io/ent"
"entgo.io/ent/entc/load"
"entgo.io/ent/schema/field"
"github.com/stretchr/testify/require"
)
func TestAuthIdentityFoundationSchemas(t *testing.T) {
spec, err := (&load.Config{Path: "."}).Load()
require.NoError(t, err)
schemas := map[string]*load.Schema{}
for _, schema := range spec.Schemas {
schemas[schema.Name] = schema
}
authIdentity := requireSchema(t, schemas, "AuthIdentity")
requireSchemaFields(t, authIdentity,
"user_id",
"provider_type",
"provider_key",
"provider_subject",
"verified_at",
"issuer",
"metadata",
)
requireHasUniqueIndex(t, authIdentity, "provider_type", "provider_key", "provider_subject")
authIdentityChannel := requireSchema(t, schemas, "AuthIdentityChannel")
requireSchemaFields(t, authIdentityChannel,
"identity_id",
"provider_type",
"provider_key",
"channel",
"channel_app_id",
"channel_subject",
"metadata",
)
requireHasUniqueIndex(t, authIdentityChannel, "provider_type", "provider_key", "channel", "channel_app_id", "channel_subject")
pendingAuthSession := requireSchema(t, schemas, "PendingAuthSession")
requireSchemaFields(t, pendingAuthSession,
"intent",
"provider_type",
"provider_key",
"provider_subject",
"target_user_id",
"redirect_to",
"resolved_email",
"registration_password_hash",
"upstream_identity_claims",
"local_flow_state",
"browser_session_key",
"completion_code_hash",
"completion_code_expires_at",
"email_verified_at",
"password_verified_at",
"totp_verified_at",
"expires_at",
"consumed_at",
)
adoptionDecision := requireSchema(t, schemas, "IdentityAdoptionDecision")
requireSchemaFields(t, adoptionDecision,
"pending_auth_session_id",
"identity_id",
"adopt_display_name",
"adopt_avatar",
"decided_at",
)
requireHasUniqueIndex(t, adoptionDecision, "pending_auth_session_id")
userSchema := requireSchema(t, schemas, "User")
requireSchemaFields(t, userSchema, "signup_source", "last_login_at", "last_active_at")
signupSource := requireSchemaField(t, userSchema, "signup_source")
require.Equal(t, field.TypeString, signupSource.Info.Type)
require.True(t, signupSource.Default)
require.Equal(t, "email", signupSource.DefaultValue)
require.Equal(t, 1, signupSource.Validators)
validator := requireStringFieldValidator(t, User{}.Fields(), "signup_source")
for _, value := range []string{"email", "linuxdo", "wechat", "oidc"} {
require.NoError(t, validator(value))
}
require.Error(t, validator("github"))
}
func requireSchema(t *testing.T, schemas map[string]*load.Schema, name string) *load.Schema {
t.Helper()
schema, ok := schemas[name]
require.True(t, ok, "schema %s should exist", name)
return schema
}
func requireSchemaFields(t *testing.T, schema *load.Schema, names ...string) {
t.Helper()
fields := map[string]struct{}{}
for _, field := range schema.Fields {
fields[field.Name] = struct{}{}
}
for _, name := range names {
_, ok := fields[name]
require.True(t, ok, "schema %s should include field %s", schema.Name, name)
}
}
func requireSchemaField(t *testing.T, schema *load.Schema, name string) *load.Field {
t.Helper()
for _, schemaField := range schema.Fields {
if schemaField.Name == name {
return schemaField
}
}
require.Failf(t, "missing schema field", "schema %s should include field %s", schema.Name, name)
return nil
}
func requireStringFieldValidator(t *testing.T, fields []ent.Field, name string) func(string) error {
t.Helper()
for _, entField := range fields {
descriptor := entField.Descriptor()
if descriptor.Name != name {
continue
}
require.NotEmpty(t, descriptor.Validators, "field %s should include a validator", name)
validator, ok := descriptor.Validators[0].(func(string) error)
require.True(t, ok, "field %s validator should be func(string) error", name)
return validator
}
require.Failf(t, "missing field validator", "schema should include field %s", name)
return nil
}
func requireHasUniqueIndex(t *testing.T, schema *load.Schema, fields ...string) {
t.Helper()
for _, index := range schema.Indexes {
if !index.Unique {
continue
}
if len(index.Fields) != len(fields) {
continue
}
match := true
for i := range fields {
if index.Fields[i] != fields[i] {
match = false
break
}
}
if match {
return
}
}
require.Failf(t, "missing unique index", "schema %s should include unique index on %v", schema.Name, fields)
}
package schema
import (
"github.com/Wei-Shaw/sub2api/ent/schema/mixins"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// ChannelMonitor holds the schema definition for the ChannelMonitor entity.
// 渠道监控配置:定期对指定 provider/endpoint/api_key 下的模型做心跳测试。
type ChannelMonitor struct {
ent.Schema
}
func (ChannelMonitor) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "channel_monitors"},
}
}
func (ChannelMonitor) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.TimeMixin{},
}
}
func (ChannelMonitor) Fields() []ent.Field {
return []ent.Field{
field.String("name").
NotEmpty().
MaxLen(100),
field.Enum("provider").
Values("openai", "anthropic", "gemini"),
field.String("endpoint").
NotEmpty().
MaxLen(500).
Comment("Provider base origin, e.g. https://api.openai.com"),
field.String("api_key_encrypted").
NotEmpty().
Sensitive().
Comment("AES-256-GCM encrypted API key"),
field.String("primary_model").
NotEmpty().
MaxLen(200),
field.JSON("extra_models", []string{}).
Default([]string{}).
Comment("Additional model names to test alongside primary_model"),
field.String("group_name").
Optional().
Default("").
MaxLen(100),
field.Bool("enabled").
Default(true),
field.Int("interval_seconds").
Range(15, 3600),
field.Time("last_checked_at").
Optional().
Nillable(),
field.Int64("created_by"),
// ---- 自定义请求快照字段(来自模板 / 手动编辑) ----
// template_id: 关联的请求模板 ID(仅用于 UI 分组 + 一键应用)。
// 实际运行时 checker 只读下面 3 个快照字段,**不再回查模板表**。
// 模板被删除时此字段会被 SET NULL(见 Edges 的 OnDelete 注解)。
field.Int64("template_id").
Optional().
Nillable(),
// extra_headers: 自定义 HTTP 头快照(来自模板 or 用户手填)。
// 运行时 merge 进 adapter 默认 headers。
field.JSON("extra_headers", map[string]string{}).
Default(map[string]string{}),
// body_override_mode: 同 ChannelMonitorRequestTemplate.body_override_mode
field.String("body_override_mode").
Default("off").
MaxLen(10),
// body_override: 同 ChannelMonitorRequestTemplate.body_override
field.JSON("body_override", map[string]any{}).
Optional(),
}
}
func (ChannelMonitor) Edges() []ent.Edge {
return []ent.Edge{
edge.To("history", ChannelMonitorHistory.Type).
Annotations(entsql.OnDelete(entsql.Cascade)),
edge.To("daily_rollups", ChannelMonitorDailyRollup.Type).
Annotations(entsql.OnDelete(entsql.Cascade)),
// 关联请求模板:模板被删除时 template_id 自动置空,
// 监控本身保留(继续用快照字段跑)。
edge.To("request_template", ChannelMonitorRequestTemplate.Type).
Field("template_id").
Unique().
Annotations(entsql.OnDelete(entsql.SetNull)),
}
}
func (ChannelMonitor) Indexes() []ent.Index {
return []ent.Index{
index.Fields("enabled", "last_checked_at"),
index.Fields("provider"),
index.Fields("group_name"),
index.Fields("template_id"),
}
}
package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// ChannelMonitorDailyRollup 按 (monitor_id, model, bucket_date) 维度聚合的渠道监控日统计。
// 每天的明细被收敛为一行(保留 status 分布 + 延迟和),用于 7d/15d/30d 窗口的可用率
// 加权计算(avg_latency = sum_latency_ms / count_latency;availability = ok_count / total_checks)。
// 超过保留期由每日维护任务分批物理删(不用软删除,理由同 channel_monitor_history)。
type ChannelMonitorDailyRollup struct {
ent.Schema
}
func (ChannelMonitorDailyRollup) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "channel_monitor_daily_rollups"},
}
}
func (ChannelMonitorDailyRollup) Fields() []ent.Field {
return []ent.Field{
field.Int64("monitor_id"),
field.String("model").
NotEmpty().
MaxLen(200),
field.Time("bucket_date").
SchemaType(map[string]string{dialect.Postgres: "date"}),
field.Int("total_checks").Default(0),
field.Int("ok_count").Default(0),
field.Int("operational_count").Default(0),
field.Int("degraded_count").Default(0),
field.Int("failed_count").Default(0),
field.Int("error_count").Default(0),
field.Int64("sum_latency_ms").Default(0),
field.Int("count_latency").Default(0),
field.Int64("sum_ping_latency_ms").Default(0),
field.Int("count_ping_latency").Default(0),
field.Time("computed_at").Default(time.Now).UpdateDefault(time.Now),
}
}
func (ChannelMonitorDailyRollup) Edges() []ent.Edge {
return []ent.Edge{
edge.From("monitor", ChannelMonitor.Type).
Ref("daily_rollups").
Field("monitor_id").
Unique().
Required(),
}
}
func (ChannelMonitorDailyRollup) Indexes() []ent.Index {
return []ent.Index{
index.Fields("monitor_id", "model", "bucket_date").Unique(),
index.Fields("bucket_date"),
}
}
package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// ChannelMonitorHistory holds the schema definition for the ChannelMonitorHistory entity.
// 渠道监控历史:每次检测每个模型一行记录。明细只保留 1 天,超过 1 天由每日维护任务
// 先聚合到 channel_monitor_daily_rollups,再分批物理删(不用软删除:日志类表无恢复
// 需求,软删会让行和索引只增不减,徒增磁盘和查询开销)。
type ChannelMonitorHistory struct {
ent.Schema
}
func (ChannelMonitorHistory) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "channel_monitor_histories"},
}
}
func (ChannelMonitorHistory) Fields() []ent.Field {
return []ent.Field{
field.Int64("monitor_id"),
field.String("model").
NotEmpty().
MaxLen(200),
field.Enum("status").
Values("operational", "degraded", "failed", "error"),
field.Int("latency_ms").
Optional().
Nillable(),
field.Int("ping_latency_ms").
Optional().
Nillable(),
field.String("message").
Optional().
Default("").
MaxLen(500),
field.Time("checked_at").
Default(time.Now),
}
}
func (ChannelMonitorHistory) Edges() []ent.Edge {
return []ent.Edge{
edge.From("monitor", ChannelMonitor.Type).
Ref("history").
Field("monitor_id").
Unique().
Required(),
}
}
func (ChannelMonitorHistory) Indexes() []ent.Index {
return []ent.Index{
index.Fields("monitor_id", "model", "checked_at"),
index.Fields("checked_at"),
}
}
package schema
import (
"github.com/Wei-Shaw/sub2api/ent/schema/mixins"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// ChannelMonitorRequestTemplate 请求模板:一组可复用的 headers + 可选 body 覆盖配置。
//
// 语义为快照:模板被"应用"到监控时,extra_headers / body_override_mode / body_override
// 会被**拷贝**到 channel_monitors 同名字段;后续模板变动不会自动影响已应用的监控——
// 必须用户主动在模板编辑 Dialog 里点「应用到关联监控」才会覆盖快照。
// 这样模板改错不会瞬间打挂所有已经跑起来的监控。
type ChannelMonitorRequestTemplate struct {
ent.Schema
}
func (ChannelMonitorRequestTemplate) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "channel_monitor_request_templates"},
}
}
func (ChannelMonitorRequestTemplate) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.TimeMixin{},
}
}
func (ChannelMonitorRequestTemplate) Fields() []ent.Field {
return []ent.Field{
field.String("name").
NotEmpty().
MaxLen(100),
field.Enum("provider").
Values("openai", "anthropic", "gemini"),
field.String("description").
Optional().
Default("").
MaxLen(500),
// extra_headers: 用户自定义 HTTP 头(如 User-Agent 伪装)。
// 运行时 merge 进 adapter 默认 headers,用户值优先;
// hop-by-hop 黑名单(Host/Content-Length/...)由 checker 过滤。
field.JSON("extra_headers", map[string]string{}).
Default(map[string]string{}),
// body_override_mode: 'off' | 'merge' | 'replace'
// off - 用 adapter 默认 body(忽略 body_override)
// merge - adapter 默认 body 与 body_override 浅合并(body_override 优先,
// model/messages/contents 等关键字段在 checker 里走黑名单跳过)
// replace - 直接用 body_override 作为完整 body;此时跳过 challenge 校验,
// 改为 HTTP 2xx + 响应文本非空即视为可用
field.String("body_override_mode").
Default("off").
MaxLen(10),
// body_override: JSON 对象,根据 body_override_mode 使用。
// 用 map[string]any 以便前端传任意结构(含嵌套)。
field.JSON("body_override", map[string]any{}).
Optional(),
}
}
func (ChannelMonitorRequestTemplate) Edges() []ent.Edge {
return []ent.Edge{
edge.From("monitors", ChannelMonitor.Type).
Ref("request_template"),
}
}
func (ChannelMonitorRequestTemplate) Indexes() []ent.Index {
return []ent.Index{
// 同一 provider 内 name 唯一:允许 Anthropic + OpenAI 重名 "伪装官方客户端"。
index.Fields("provider", "name").Unique(),
}
}
......@@ -145,6 +145,11 @@ func (Group) Fields() []ent.Field {
Default(domain.OpenAIMessagesDispatchModelConfig{}).
SchemaType(map[string]string{dialect.Postgres: "jsonb"}).
Comment("OpenAI Messages 调度模型配置:按 Claude 系列/精确模型映射到目标 GPT 模型"),
// 分组级每分钟请求数上限(0 = 不限制)。设置后优先于用户级兜底生效。
field.Int("rpm_limit").
Default(0).
Comment("分组 RPM 上限,0 表示不限制;设置后接管该分组用户的限流"),
}
}
......
package schema
import (
"time"
"github.com/Wei-Shaw/sub2api/ent/schema/mixins"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// IdentityAdoptionDecision stores the one-time profile adoption choice captured during a pending auth flow.
type IdentityAdoptionDecision struct {
ent.Schema
}
func (IdentityAdoptionDecision) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{Table: "identity_adoption_decisions"},
}
}
func (IdentityAdoptionDecision) Mixin() []ent.Mixin {
return []ent.Mixin{
mixins.TimeMixin{},
}
}
func (IdentityAdoptionDecision) Fields() []ent.Field {
return []ent.Field{
field.Int64("pending_auth_session_id"),
field.Int64("identity_id").
Optional().
Nillable(),
field.Bool("adopt_display_name").
Default(false),
field.Bool("adopt_avatar").
Default(false),
field.Time("decided_at").
Immutable().
Default(time.Now).
SchemaType(map[string]string{dialect.Postgres: "timestamptz"}),
}
}
func (IdentityAdoptionDecision) Edges() []ent.Edge {
return []ent.Edge{
edge.From("pending_auth_session", PendingAuthSession.Type).
Ref("adoption_decision").
Field("pending_auth_session_id").
Required().
Unique(),
edge.From("identity", AuthIdentity.Type).
Ref("adoption_decisions").
Field("identity_id").
Unique(),
}
}
func (IdentityAdoptionDecision) Indexes() []ent.Index {
return []ent.Index{
index.Fields("pending_auth_session_id").Unique(),
index.Fields("identity_id"),
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment