12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391 |
- // 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(u uint64) *WhatsappChannelCreate {
- wcc.mutation.SetWaID(u)
- return wcc
- }
- // SetNillableWaID sets the "wa_id" field if the given value is not nil.
- func (wcc *WhatsappChannelCreate) SetNillableWaID(u *uint64) *WhatsappChannelCreate {
- if u != nil {
- wcc.SetWaID(*u)
- }
- 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.TypeUint64, 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 uint64) *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
- }
- // AddWaID adds v to the "wa_id" field.
- func (u *WhatsappChannelUpsert) AddWaID(v uint64) *WhatsappChannelUpsert {
- u.Add(whatsappchannel.FieldWaID, v)
- 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 uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWaID(v)
- })
- }
- // AddWaID adds v to the "wa_id" field.
- func (u *WhatsappChannelUpsertOne) AddWaID(v uint64) *WhatsappChannelUpsertOne {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddWaID(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 uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.SetWaID(v)
- })
- }
- // AddWaID adds v to the "wa_id" field.
- func (u *WhatsappChannelUpsertBulk) AddWaID(v uint64) *WhatsappChannelUpsertBulk {
- return u.Update(func(s *WhatsappChannelUpsert) {
- s.AddWaID(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)
- }
- }
|