1816 lines
64 KiB
Go
1816 lines
64 KiB
Go
// 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)
|
|
}
|
|
}
|