123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/whatsappchannel"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // WhatsappChannelCreate is the builder for creating a WhatsappChannel entity.
- type WhatsappChannelCreate struct {
- config
- mutation *WhatsappChannelMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (wcc *WhatsappChannelCreate) SetCreatedAt(t time.Time) *WhatsappChannelCreate {
- wcc.mutation.SetCreatedAt(t)
- return wcc
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableCreatedAt(t *time.Time) *WhatsappChannelCreate {
- if t != nil {
- wcc.SetCreatedAt(*t)
- }
- return wcc
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (wcc *WhatsappChannelCreate) SetUpdatedAt(t time.Time) *WhatsappChannelCreate {
- wcc.mutation.SetUpdatedAt(t)
- return wcc
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableUpdatedAt(t *time.Time) *WhatsappChannelCreate {
- if t != nil {
- wcc.SetUpdatedAt(*t)
- }
- return wcc
- }
- // SetStatus sets the "status" field.
- func (wcc *WhatsappChannelCreate) SetStatus(u uint8) *WhatsappChannelCreate {
- wcc.mutation.SetStatus(u)
- return wcc
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableStatus(u *uint8) *WhatsappChannelCreate {
- if u != nil {
- wcc.SetStatus(*u)
- }
- return wcc
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (wcc *WhatsappChannelCreate) SetDeletedAt(t time.Time) *WhatsappChannelCreate {
- wcc.mutation.SetDeletedAt(t)
- return wcc
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableDeletedAt(t *time.Time) *WhatsappChannelCreate {
- if t != nil {
- wcc.SetDeletedAt(*t)
- }
- return wcc
- }
- // SetAk sets the "ak" field.
- func (wcc *WhatsappChannelCreate) SetAk(s string) *WhatsappChannelCreate {
- wcc.mutation.SetAk(s)
- return wcc
- }
- // SetNillableAk sets the "ak" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableAk(s *string) *WhatsappChannelCreate {
- if s != nil {
- wcc.SetAk(*s)
- }
- return wcc
- }
- // SetSk sets the "sk" field.
- func (wcc *WhatsappChannelCreate) SetSk(s string) *WhatsappChannelCreate {
- wcc.mutation.SetSk(s)
- return wcc
- }
- // SetNillableSk sets the "sk" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableSk(s *string) *WhatsappChannelCreate {
- if s != nil {
- wcc.SetSk(*s)
- }
- return wcc
- }
- // SetWaID sets the "wa_id" field.
- func (wcc *WhatsappChannelCreate) SetWaID(s string) *WhatsappChannelCreate {
- wcc.mutation.SetWaID(s)
- return wcc
- }
- // SetNillableWaID sets the "wa_id" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableWaID(s *string) *WhatsappChannelCreate {
- if s != nil {
- wcc.SetWaID(*s)
- }
- return wcc
- }
- // SetWaName sets the "wa_name" field.
- func (wcc *WhatsappChannelCreate) SetWaName(s string) *WhatsappChannelCreate {
- wcc.mutation.SetWaName(s)
- return wcc
- }
- // SetNillableWaName sets the "wa_name" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableWaName(s *string) *WhatsappChannelCreate {
- if s != nil {
- wcc.SetWaName(*s)
- }
- return wcc
- }
- // SetWabaID sets the "waba_id" field.
- func (wcc *WhatsappChannelCreate) SetWabaID(u uint64) *WhatsappChannelCreate {
- wcc.mutation.SetWabaID(u)
- return wcc
- }
- // SetNillableWabaID sets the "waba_id" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableWabaID(u *uint64) *WhatsappChannelCreate {
- if u != nil {
- wcc.SetWabaID(*u)
- }
- return wcc
- }
- // SetBusinessID sets the "business_id" field.
- func (wcc *WhatsappChannelCreate) SetBusinessID(u uint64) *WhatsappChannelCreate {
- wcc.mutation.SetBusinessID(u)
- return wcc
- }
- // SetNillableBusinessID sets the "business_id" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableBusinessID(u *uint64) *WhatsappChannelCreate {
- if u != nil {
- wcc.SetBusinessID(*u)
- }
- return wcc
- }
- // SetOrganizationID sets the "organization_id" field.
- func (wcc *WhatsappChannelCreate) SetOrganizationID(u uint64) *WhatsappChannelCreate {
- wcc.mutation.SetOrganizationID(u)
- return wcc
- }
- // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableOrganizationID(u *uint64) *WhatsappChannelCreate {
- if u != nil {
- wcc.SetOrganizationID(*u)
- }
- return wcc
- }
- // SetVerifyAccount sets the "verify_account" field.
- func (wcc *WhatsappChannelCreate) SetVerifyAccount(s string) *WhatsappChannelCreate {
- wcc.mutation.SetVerifyAccount(s)
- return wcc
- }
- // SetNillableVerifyAccount sets the "verify_account" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableVerifyAccount(s *string) *WhatsappChannelCreate {
- if s != nil {
- wcc.SetVerifyAccount(*s)
- }
- return wcc
- }
- // SetID sets the "id" field.
- func (wcc *WhatsappChannelCreate) SetID(u uint64) *WhatsappChannelCreate {
- wcc.mutation.SetID(u)
- return wcc
- }
- // Mutation returns the WhatsappChannelMutation object of the builder.
- func (wcc *WhatsappChannelCreate) Mutation() *WhatsappChannelMutation {
- return wcc.mutation
- }
- // Save creates the WhatsappChannel in the database.
- func (wcc *WhatsappChannelCreate) Save(ctx context.Context) (*WhatsappChannel, error) {
- if err := wcc.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, wcc.sqlSave, wcc.mutation, wcc.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (wcc *WhatsappChannelCreate) SaveX(ctx context.Context) *WhatsappChannel {
- v, err := wcc.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (wcc *WhatsappChannelCreate) Exec(ctx context.Context) error {
- _, err := wcc.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (wcc *WhatsappChannelCreate) ExecX(ctx context.Context) {
- if err := wcc.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (wcc *WhatsappChannelCreate) defaults() error {
- if _, ok := wcc.mutation.CreatedAt(); !ok {
- if whatsappchannel.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized whatsappchannel.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := whatsappchannel.DefaultCreatedAt()
- wcc.mutation.SetCreatedAt(v)
- }
- if _, ok := wcc.mutation.UpdatedAt(); !ok {
- if whatsappchannel.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized whatsappchannel.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := whatsappchannel.DefaultUpdatedAt()
- wcc.mutation.SetUpdatedAt(v)
- }
- if _, ok := wcc.mutation.Status(); !ok {
- v := whatsappchannel.DefaultStatus
- wcc.mutation.SetStatus(v)
- }
- if _, ok := wcc.mutation.Ak(); !ok {
- v := whatsappchannel.DefaultAk
- wcc.mutation.SetAk(v)
- }
- if _, ok := wcc.mutation.Sk(); !ok {
- v := whatsappchannel.DefaultSk
- wcc.mutation.SetSk(v)
- }
- if _, ok := wcc.mutation.WaID(); !ok {
- v := whatsappchannel.DefaultWaID
- wcc.mutation.SetWaID(v)
- }
- if _, ok := wcc.mutation.WaName(); !ok {
- v := whatsappchannel.DefaultWaName
- wcc.mutation.SetWaName(v)
- }
- if _, ok := wcc.mutation.WabaID(); !ok {
- v := whatsappchannel.DefaultWabaID
- wcc.mutation.SetWabaID(v)
- }
- if _, ok := wcc.mutation.BusinessID(); !ok {
- v := whatsappchannel.DefaultBusinessID
- wcc.mutation.SetBusinessID(v)
- }
- if _, ok := wcc.mutation.OrganizationID(); !ok {
- v := whatsappchannel.DefaultOrganizationID
- wcc.mutation.SetOrganizationID(v)
- }
- if _, ok := wcc.mutation.VerifyAccount(); !ok {
- v := whatsappchannel.DefaultVerifyAccount
- wcc.mutation.SetVerifyAccount(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (wcc *WhatsappChannelCreate) check() error {
- if _, ok := wcc.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "WhatsappChannel.created_at"`)}
- }
- if _, ok := wcc.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "WhatsappChannel.updated_at"`)}
- }
- if _, ok := wcc.mutation.Sk(); !ok {
- return &ValidationError{Name: "sk", err: errors.New(`ent: missing required field "WhatsappChannel.sk"`)}
- }
- if _, ok := wcc.mutation.WabaID(); !ok {
- return &ValidationError{Name: "waba_id", err: errors.New(`ent: missing required field "WhatsappChannel.waba_id"`)}
- }
- if _, ok := wcc.mutation.BusinessID(); !ok {
- return &ValidationError{Name: "business_id", err: errors.New(`ent: missing required field "WhatsappChannel.business_id"`)}
- }
- if _, ok := wcc.mutation.VerifyAccount(); !ok {
- return &ValidationError{Name: "verify_account", err: errors.New(`ent: missing required field "WhatsappChannel.verify_account"`)}
- }
- return nil
- }
- func (wcc *WhatsappChannelCreate) sqlSave(ctx context.Context) (*WhatsappChannel, error) {
- if err := wcc.check(); err != nil {
- return nil, err
- }
- _node, _spec := wcc.createSpec()
- if err := sqlgraph.CreateNode(ctx, wcc.driver, _spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- if _spec.ID.Value != _node.ID {
- id := _spec.ID.Value.(int64)
- _node.ID = uint64(id)
- }
- wcc.mutation.id = &_node.ID
- wcc.mutation.done = true
- return _node, nil
- }
- func (wcc *WhatsappChannelCreate) createSpec() (*WhatsappChannel, *sqlgraph.CreateSpec) {
- var (
- _node = &WhatsappChannel{config: wcc.config}
- _spec = sqlgraph.NewCreateSpec(whatsappchannel.Table, sqlgraph.NewFieldSpec(whatsappchannel.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = wcc.conflict
- if id, ok := wcc.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := wcc.mutation.CreatedAt(); ok {
- _spec.SetField(whatsappchannel.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := wcc.mutation.UpdatedAt(); ok {
- _spec.SetField(whatsappchannel.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := wcc.mutation.Status(); ok {
- _spec.SetField(whatsappchannel.FieldStatus, field.TypeUint8, value)
- _node.Status = value
- }
- if value, ok := wcc.mutation.DeletedAt(); ok {
- _spec.SetField(whatsappchannel.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = value
- }
- if value, ok := wcc.mutation.Ak(); ok {
- _spec.SetField(whatsappchannel.FieldAk, field.TypeString, value)
- _node.Ak = value
- }
- if value, ok := wcc.mutation.Sk(); ok {
- _spec.SetField(whatsappchannel.FieldSk, field.TypeString, value)
- _node.Sk = value
- }
- if value, ok := wcc.mutation.WaID(); ok {
- _spec.SetField(whatsappchannel.FieldWaID, field.TypeString, value)
- _node.WaID = value
- }
- if value, ok := wcc.mutation.WaName(); ok {
- _spec.SetField(whatsappchannel.FieldWaName, field.TypeString, value)
- _node.WaName = value
- }
- if value, ok := wcc.mutation.WabaID(); ok {
- _spec.SetField(whatsappchannel.FieldWabaID, field.TypeUint64, value)
- _node.WabaID = value
- }
- if value, ok := wcc.mutation.BusinessID(); ok {
- _spec.SetField(whatsappchannel.FieldBusinessID, field.TypeUint64, value)
- _node.BusinessID = value
- }
- if value, ok := wcc.mutation.OrganizationID(); ok {
- _spec.SetField(whatsappchannel.FieldOrganizationID, field.TypeUint64, value)
- _node.OrganizationID = value
- }
- if value, ok := wcc.mutation.VerifyAccount(); ok {
- _spec.SetField(whatsappchannel.FieldVerifyAccount, field.TypeString, value)
- _node.VerifyAccount = value
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.WhatsappChannel.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.WhatsappChannelUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (wcc *WhatsappChannelCreate) OnConflict(opts ...sql.ConflictOption) *WhatsappChannelUpsertOne {
- wcc.conflict = opts
- return &WhatsappChannelUpsertOne{
- create: wcc,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.WhatsappChannel.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (wcc *WhatsappChannelCreate) OnConflictColumns(columns ...string) *WhatsappChannelUpsertOne {
- wcc.conflict = append(wcc.conflict, sql.ConflictColumns(columns...))
- return &WhatsappChannelUpsertOne{
- create: wcc,
- }
- }
- type (
- // WhatsappChannelUpsertOne is the builder for "upsert"-ing
- // one WhatsappChannel node.
- WhatsappChannelUpsertOne struct {
- create *WhatsappChannelCreate
- }
- // WhatsappChannelUpsert is the "OnConflict" setter.
- WhatsappChannelUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *WhatsappChannelUpsert) SetUpdatedAt(v time.Time) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateUpdatedAt() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldUpdatedAt)
- return u
- }
- // SetStatus sets the "status" field.
- func (u *WhatsappChannelUpsert) SetStatus(v uint8) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldStatus, v)
- return u
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateStatus() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldStatus)
- return u
- }
- // AddStatus adds v to the "status" field.
- func (u *WhatsappChannelUpsert) AddStatus(v uint8) *WhatsappChannelUpsert {
- u.Add(whatsappchannel.FieldStatus, v)
- return u
- }
- // ClearStatus clears the value of the "status" field.
- func (u *WhatsappChannelUpsert) ClearStatus() *WhatsappChannelUpsert {
- u.SetNull(whatsappchannel.FieldStatus)
- return u
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *WhatsappChannelUpsert) SetDeletedAt(v time.Time) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldDeletedAt, v)
- return u
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateDeletedAt() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldDeletedAt)
- return u
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *WhatsappChannelUpsert) ClearDeletedAt() *WhatsappChannelUpsert {
- u.SetNull(whatsappchannel.FieldDeletedAt)
- return u
- }
- // SetAk sets the "ak" field.
- func (u *WhatsappChannelUpsert) SetAk(v string) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldAk, v)
- return u
- }
- // UpdateAk sets the "ak" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateAk() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldAk)
- return u
- }
- // ClearAk clears the value of the "ak" field.
- func (u *WhatsappChannelUpsert) ClearAk() *WhatsappChannelUpsert {
- u.SetNull(whatsappchannel.FieldAk)
- return u
- }
- // SetSk sets the "sk" field.
- func (u *WhatsappChannelUpsert) SetSk(v string) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldSk, v)
- return u
- }
- // UpdateSk sets the "sk" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateSk() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldSk)
- return u
- }
- // SetWaID sets the "wa_id" field.
- func (u *WhatsappChannelUpsert) SetWaID(v string) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldWaID, v)
- return u
- }
- // UpdateWaID sets the "wa_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateWaID() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldWaID)
- return u
- }
- // ClearWaID clears the value of the "wa_id" field.
- func (u *WhatsappChannelUpsert) ClearWaID() *WhatsappChannelUpsert {
- u.SetNull(whatsappchannel.FieldWaID)
- return u
- }
- // SetWaName sets the "wa_name" field.
- func (u *WhatsappChannelUpsert) SetWaName(v string) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldWaName, v)
- return u
- }
- // UpdateWaName sets the "wa_name" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateWaName() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldWaName)
- return u
- }
- // ClearWaName clears the value of the "wa_name" field.
- func (u *WhatsappChannelUpsert) ClearWaName() *WhatsappChannelUpsert {
- u.SetNull(whatsappchannel.FieldWaName)
- return u
- }
- // SetWabaID sets the "waba_id" field.
- func (u *WhatsappChannelUpsert) SetWabaID(v uint64) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldWabaID, v)
- return u
- }
- // UpdateWabaID sets the "waba_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateWabaID() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldWabaID)
- return u
- }
- // AddWabaID adds v to the "waba_id" field.
- func (u *WhatsappChannelUpsert) AddWabaID(v uint64) *WhatsappChannelUpsert {
- u.Add(whatsappchannel.FieldWabaID, v)
- return u
- }
- // SetBusinessID sets the "business_id" field.
- func (u *WhatsappChannelUpsert) SetBusinessID(v uint64) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldBusinessID, v)
- return u
- }
- // UpdateBusinessID sets the "business_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateBusinessID() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldBusinessID)
- return u
- }
- // AddBusinessID adds v to the "business_id" field.
- func (u *WhatsappChannelUpsert) AddBusinessID(v uint64) *WhatsappChannelUpsert {
- u.Add(whatsappchannel.FieldBusinessID, v)
- return u
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *WhatsappChannelUpsert) SetOrganizationID(v uint64) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldOrganizationID, v)
- return u
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateOrganizationID() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldOrganizationID)
- return u
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *WhatsappChannelUpsert) AddOrganizationID(v uint64) *WhatsappChannelUpsert {
- u.Add(whatsappchannel.FieldOrganizationID, v)
- return u
- }
- // ClearOrganizationID clears the value of the "organization_id" field.
- func (u *WhatsappChannelUpsert) ClearOrganizationID() *WhatsappChannelUpsert {
- u.SetNull(whatsappchannel.FieldOrganizationID)
- return u
- }
- // SetVerifyAccount sets the "verify_account" field.
- func (u *WhatsappChannelUpsert) SetVerifyAccount(v string) *WhatsappChannelUpsert {
- u.Set(whatsappchannel.FieldVerifyAccount, v)
- return u
- }
- // UpdateVerifyAccount sets the "verify_account" field to the value that was provided on create.
- func (u *WhatsappChannelUpsert) UpdateVerifyAccount() *WhatsappChannelUpsert {
- u.SetExcluded(whatsappchannel.FieldVerifyAccount)
- return u
- }
- // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
- // Using this option is equivalent to using:
- //
- // client.WhatsappChannel.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(whatsappchannel.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *WhatsappChannelUpsertOne) UpdateNewValues() *WhatsappChannelUpsertOne {
- 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.ID(); exists {
- s.SetIgnore(whatsappchannel.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(whatsappchannel.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.WhatsappChannel.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *WhatsappChannelUpsertOne) Ignore() *WhatsappChannelUpsertOne {
- 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 *WhatsappChannelUpsertOne) DoNothing() *WhatsappChannelUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the WhatsappChannelCreate.OnConflict
- // documentation for more info.
- func (u *WhatsappChannelUpsertOne) Update(set func(*WhatsappChannelUpsert)) *WhatsappChannelUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&WhatsappChannelUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *WhatsappChannelUpsertOne) SetUpdatedAt(v time.Time) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateUpdatedAt() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *WhatsappChannelUpsertOne) SetStatus(v uint8) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *WhatsappChannelUpsertOne) AddStatus(v uint8) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateStatus() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *WhatsappChannelUpsertOne) ClearStatus() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearStatus()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *WhatsappChannelUpsertOne) SetDeletedAt(v time.Time) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateDeletedAt() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *WhatsappChannelUpsertOne) ClearDeletedAt() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetAk sets the "ak" field.
- func (u *WhatsappChannelUpsertOne) SetAk(v string) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetAk(v)
- })
- }
- // UpdateAk sets the "ak" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateAk() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateAk()
- })
- }
- // ClearAk clears the value of the "ak" field.
- func (u *WhatsappChannelUpsertOne) ClearAk() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearAk()
- })
- }
- // SetSk sets the "sk" field.
- func (u *WhatsappChannelUpsertOne) SetSk(v string) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetSk(v)
- })
- }
- // UpdateSk sets the "sk" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateSk() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateSk()
- })
- }
- // SetWaID sets the "wa_id" field.
- func (u *WhatsappChannelUpsertOne) SetWaID(v string) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWaID(v)
- })
- }
- // UpdateWaID sets the "wa_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateWaID() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateWaID()
- })
- }
- // ClearWaID clears the value of the "wa_id" field.
- func (u *WhatsappChannelUpsertOne) ClearWaID() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearWaID()
- })
- }
- // SetWaName sets the "wa_name" field.
- func (u *WhatsappChannelUpsertOne) SetWaName(v string) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWaName(v)
- })
- }
- // UpdateWaName sets the "wa_name" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateWaName() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateWaName()
- })
- }
- // ClearWaName clears the value of the "wa_name" field.
- func (u *WhatsappChannelUpsertOne) ClearWaName() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearWaName()
- })
- }
- // SetWabaID sets the "waba_id" field.
- func (u *WhatsappChannelUpsertOne) SetWabaID(v uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWabaID(v)
- })
- }
- // AddWabaID adds v to the "waba_id" field.
- func (u *WhatsappChannelUpsertOne) AddWabaID(v uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddWabaID(v)
- })
- }
- // UpdateWabaID sets the "waba_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateWabaID() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateWabaID()
- })
- }
- // SetBusinessID sets the "business_id" field.
- func (u *WhatsappChannelUpsertOne) SetBusinessID(v uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetBusinessID(v)
- })
- }
- // AddBusinessID adds v to the "business_id" field.
- func (u *WhatsappChannelUpsertOne) AddBusinessID(v uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddBusinessID(v)
- })
- }
- // UpdateBusinessID sets the "business_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateBusinessID() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateBusinessID()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *WhatsappChannelUpsertOne) SetOrganizationID(v uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *WhatsappChannelUpsertOne) AddOrganizationID(v uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateOrganizationID() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // ClearOrganizationID clears the value of the "organization_id" field.
- func (u *WhatsappChannelUpsertOne) ClearOrganizationID() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearOrganizationID()
- })
- }
- // SetVerifyAccount sets the "verify_account" field.
- func (u *WhatsappChannelUpsertOne) SetVerifyAccount(v string) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetVerifyAccount(v)
- })
- }
- // UpdateVerifyAccount sets the "verify_account" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertOne) UpdateVerifyAccount() *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateVerifyAccount()
- })
- }
- // Exec executes the query.
- func (u *WhatsappChannelUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for WhatsappChannelCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *WhatsappChannelUpsertOne) 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 *WhatsappChannelUpsertOne) ID(ctx context.Context) (id uint64, 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 *WhatsappChannelUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // WhatsappChannelCreateBulk is the builder for creating many WhatsappChannel entities in bulk.
- type WhatsappChannelCreateBulk struct {
- config
- err error
- builders []*WhatsappChannelCreate
- conflict []sql.ConflictOption
- }
- // Save creates the WhatsappChannel entities in the database.
- func (wccb *WhatsappChannelCreateBulk) Save(ctx context.Context) ([]*WhatsappChannel, error) {
- if wccb.err != nil {
- return nil, wccb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(wccb.builders))
- nodes := make([]*WhatsappChannel, len(wccb.builders))
- mutators := make([]Mutator, len(wccb.builders))
- for i := range wccb.builders {
- func(i int, root context.Context) {
- builder := wccb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*WhatsappChannelMutation)
- 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, wccb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = wccb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, wccb.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 && nodes[i].ID == 0 {
- id := specs[i].ID.Value.(int64)
- nodes[i].ID = uint64(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, wccb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (wccb *WhatsappChannelCreateBulk) SaveX(ctx context.Context) []*WhatsappChannel {
- v, err := wccb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (wccb *WhatsappChannelCreateBulk) Exec(ctx context.Context) error {
- _, err := wccb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (wccb *WhatsappChannelCreateBulk) ExecX(ctx context.Context) {
- if err := wccb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.WhatsappChannel.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.WhatsappChannelUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (wccb *WhatsappChannelCreateBulk) OnConflict(opts ...sql.ConflictOption) *WhatsappChannelUpsertBulk {
- wccb.conflict = opts
- return &WhatsappChannelUpsertBulk{
- create: wccb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.WhatsappChannel.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (wccb *WhatsappChannelCreateBulk) OnConflictColumns(columns ...string) *WhatsappChannelUpsertBulk {
- wccb.conflict = append(wccb.conflict, sql.ConflictColumns(columns...))
- return &WhatsappChannelUpsertBulk{
- create: wccb,
- }
- }
- // WhatsappChannelUpsertBulk is the builder for "upsert"-ing
- // a bulk of WhatsappChannel nodes.
- type WhatsappChannelUpsertBulk struct {
- create *WhatsappChannelCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.WhatsappChannel.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(whatsappchannel.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *WhatsappChannelUpsertBulk) UpdateNewValues() *WhatsappChannelUpsertBulk {
- 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.ID(); exists {
- s.SetIgnore(whatsappchannel.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(whatsappchannel.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.WhatsappChannel.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *WhatsappChannelUpsertBulk) Ignore() *WhatsappChannelUpsertBulk {
- 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 *WhatsappChannelUpsertBulk) DoNothing() *WhatsappChannelUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the WhatsappChannelCreateBulk.OnConflict
- // documentation for more info.
- func (u *WhatsappChannelUpsertBulk) Update(set func(*WhatsappChannelUpsert)) *WhatsappChannelUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&WhatsappChannelUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *WhatsappChannelUpsertBulk) SetUpdatedAt(v time.Time) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateUpdatedAt() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *WhatsappChannelUpsertBulk) SetStatus(v uint8) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *WhatsappChannelUpsertBulk) AddStatus(v uint8) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateStatus() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *WhatsappChannelUpsertBulk) ClearStatus() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearStatus()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *WhatsappChannelUpsertBulk) SetDeletedAt(v time.Time) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateDeletedAt() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *WhatsappChannelUpsertBulk) ClearDeletedAt() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetAk sets the "ak" field.
- func (u *WhatsappChannelUpsertBulk) SetAk(v string) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetAk(v)
- })
- }
- // UpdateAk sets the "ak" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateAk() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateAk()
- })
- }
- // ClearAk clears the value of the "ak" field.
- func (u *WhatsappChannelUpsertBulk) ClearAk() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearAk()
- })
- }
- // SetSk sets the "sk" field.
- func (u *WhatsappChannelUpsertBulk) SetSk(v string) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetSk(v)
- })
- }
- // UpdateSk sets the "sk" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateSk() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateSk()
- })
- }
- // SetWaID sets the "wa_id" field.
- func (u *WhatsappChannelUpsertBulk) SetWaID(v string) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWaID(v)
- })
- }
- // UpdateWaID sets the "wa_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateWaID() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateWaID()
- })
- }
- // ClearWaID clears the value of the "wa_id" field.
- func (u *WhatsappChannelUpsertBulk) ClearWaID() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearWaID()
- })
- }
- // SetWaName sets the "wa_name" field.
- func (u *WhatsappChannelUpsertBulk) SetWaName(v string) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWaName(v)
- })
- }
- // UpdateWaName sets the "wa_name" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateWaName() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateWaName()
- })
- }
- // ClearWaName clears the value of the "wa_name" field.
- func (u *WhatsappChannelUpsertBulk) ClearWaName() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearWaName()
- })
- }
- // SetWabaID sets the "waba_id" field.
- func (u *WhatsappChannelUpsertBulk) SetWabaID(v uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWabaID(v)
- })
- }
- // AddWabaID adds v to the "waba_id" field.
- func (u *WhatsappChannelUpsertBulk) AddWabaID(v uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddWabaID(v)
- })
- }
- // UpdateWabaID sets the "waba_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateWabaID() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateWabaID()
- })
- }
- // SetBusinessID sets the "business_id" field.
- func (u *WhatsappChannelUpsertBulk) SetBusinessID(v uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetBusinessID(v)
- })
- }
- // AddBusinessID adds v to the "business_id" field.
- func (u *WhatsappChannelUpsertBulk) AddBusinessID(v uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddBusinessID(v)
- })
- }
- // UpdateBusinessID sets the "business_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateBusinessID() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateBusinessID()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *WhatsappChannelUpsertBulk) SetOrganizationID(v uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *WhatsappChannelUpsertBulk) AddOrganizationID(v uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateOrganizationID() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // ClearOrganizationID clears the value of the "organization_id" field.
- func (u *WhatsappChannelUpsertBulk) ClearOrganizationID() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.ClearOrganizationID()
- })
- }
- // SetVerifyAccount sets the "verify_account" field.
- func (u *WhatsappChannelUpsertBulk) SetVerifyAccount(v string) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetVerifyAccount(v)
- })
- }
- // UpdateVerifyAccount sets the "verify_account" field to the value that was provided on create.
- func (u *WhatsappChannelUpsertBulk) UpdateVerifyAccount() *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.UpdateVerifyAccount()
- })
- }
- // Exec executes the query.
- func (u *WhatsappChannelUpsertBulk) 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 WhatsappChannelCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for WhatsappChannelCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *WhatsappChannelUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|