| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815 |
- // 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)
- }
- }
|