123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797 |
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/agent"
- "wechat-api/ent/whatsapp"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- type WhatsappCreate struct {
- config
- mutation *WhatsappMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- func (wc *WhatsappCreate) SetCreatedAt(t time.Time) *WhatsappCreate {
- wc.mutation.SetCreatedAt(t)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableCreatedAt(t *time.Time) *WhatsappCreate {
- if t != nil {
- wc.SetCreatedAt(*t)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetUpdatedAt(t time.Time) *WhatsappCreate {
- wc.mutation.SetUpdatedAt(t)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableUpdatedAt(t *time.Time) *WhatsappCreate {
- if t != nil {
- wc.SetUpdatedAt(*t)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetStatus(u uint8) *WhatsappCreate {
- wc.mutation.SetStatus(u)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableStatus(u *uint8) *WhatsappCreate {
- if u != nil {
- wc.SetStatus(*u)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetDeletedAt(t time.Time) *WhatsappCreate {
- wc.mutation.SetDeletedAt(t)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableDeletedAt(t *time.Time) *WhatsappCreate {
- if t != nil {
- wc.SetDeletedAt(*t)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetAk(s string) *WhatsappCreate {
- wc.mutation.SetAk(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableAk(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetAk(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetSk(s string) *WhatsappCreate {
- wc.mutation.SetSk(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableSk(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetSk(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetCallback(s string) *WhatsappCreate {
- wc.mutation.SetCallback(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableCallback(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetCallback(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetAccount(s string) *WhatsappCreate {
- wc.mutation.SetAccount(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableAccount(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetAccount(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetNickname(s string) *WhatsappCreate {
- wc.mutation.SetNickname(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableNickname(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetNickname(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetPhone(s string) *WhatsappCreate {
- wc.mutation.SetPhone(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillablePhone(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetPhone(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetOrganizationID(u uint64) *WhatsappCreate {
- wc.mutation.SetOrganizationID(u)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableOrganizationID(u *uint64) *WhatsappCreate {
- if u != nil {
- wc.SetOrganizationID(*u)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetAgentID(u uint64) *WhatsappCreate {
- wc.mutation.SetAgentID(u)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableAgentID(u *uint64) *WhatsappCreate {
- if u != nil {
- wc.SetAgentID(*u)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetAPIBase(s string) *WhatsappCreate {
- wc.mutation.SetAPIBase(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableAPIBase(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetAPIBase(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetAPIKey(s string) *WhatsappCreate {
- wc.mutation.SetAPIKey(s)
- return wc
- }
- func (wc *WhatsappCreate) SetNillableAPIKey(s *string) *WhatsappCreate {
- if s != nil {
- wc.SetAPIKey(*s)
- }
- return wc
- }
- func (wc *WhatsappCreate) SetAllowList(s []string) *WhatsappCreate {
- wc.mutation.SetAllowList(s)
- return wc
- }
- func (wc *WhatsappCreate) SetGroupAllowList(s []string) *WhatsappCreate {
- wc.mutation.SetGroupAllowList(s)
- return wc
- }
- func (wc *WhatsappCreate) SetBlockList(s []string) *WhatsappCreate {
- wc.mutation.SetBlockList(s)
- return wc
- }
- func (wc *WhatsappCreate) SetGroupBlockList(s []string) *WhatsappCreate {
- wc.mutation.SetGroupBlockList(s)
- return wc
- }
- func (wc *WhatsappCreate) SetID(u uint64) *WhatsappCreate {
- wc.mutation.SetID(u)
- return wc
- }
- func (wc *WhatsappCreate) SetAgent(a *Agent) *WhatsappCreate {
- return wc.SetAgentID(a.ID)
- }
- func (wc *WhatsappCreate) Mutation() *WhatsappMutation {
- return wc.mutation
- }
- func (wc *WhatsappCreate) Save(ctx context.Context) (*Whatsapp, error) {
- if err := wc.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, wc.sqlSave, wc.mutation, wc.hooks)
- }
- func (wc *WhatsappCreate) SaveX(ctx context.Context) *Whatsapp {
- v, err := wc.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- func (wc *WhatsappCreate) Exec(ctx context.Context) error {
- _, err := wc.Save(ctx)
- return err
- }
- func (wc *WhatsappCreate) ExecX(ctx context.Context) {
- if err := wc.Exec(ctx); err != nil {
- panic(err)
- }
- }
- func (wc *WhatsappCreate) defaults() error {
- if _, ok := wc.mutation.CreatedAt(); !ok {
- if whatsapp.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized whatsapp.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := whatsapp.DefaultCreatedAt()
- wc.mutation.SetCreatedAt(v)
- }
- if _, ok := wc.mutation.UpdatedAt(); !ok {
- if whatsapp.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized whatsapp.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := whatsapp.DefaultUpdatedAt()
- wc.mutation.SetUpdatedAt(v)
- }
- if _, ok := wc.mutation.Status(); !ok {
- v := whatsapp.DefaultStatus
- wc.mutation.SetStatus(v)
- }
- if _, ok := wc.mutation.Ak(); !ok {
- v := whatsapp.DefaultAk
- wc.mutation.SetAk(v)
- }
- if _, ok := wc.mutation.Sk(); !ok {
- v := whatsapp.DefaultSk
- wc.mutation.SetSk(v)
- }
- if _, ok := wc.mutation.Callback(); !ok {
- v := whatsapp.DefaultCallback
- wc.mutation.SetCallback(v)
- }
- if _, ok := wc.mutation.Account(); !ok {
- v := whatsapp.DefaultAccount
- wc.mutation.SetAccount(v)
- }
- if _, ok := wc.mutation.Nickname(); !ok {
- v := whatsapp.DefaultNickname
- wc.mutation.SetNickname(v)
- }
- if _, ok := wc.mutation.Phone(); !ok {
- v := whatsapp.DefaultPhone
- wc.mutation.SetPhone(v)
- }
- if _, ok := wc.mutation.OrganizationID(); !ok {
- v := whatsapp.DefaultOrganizationID
- wc.mutation.SetOrganizationID(v)
- }
- if _, ok := wc.mutation.AgentID(); !ok {
- v := whatsapp.DefaultAgentID
- wc.mutation.SetAgentID(v)
- }
- if _, ok := wc.mutation.APIBase(); !ok {
- v := whatsapp.DefaultAPIBase
- wc.mutation.SetAPIBase(v)
- }
- if _, ok := wc.mutation.APIKey(); !ok {
- v := whatsapp.DefaultAPIKey
- wc.mutation.SetAPIKey(v)
- }
- return nil
- }
- func (wc *WhatsappCreate) check() error {
- if _, ok := wc.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Whatsapp.created_at"`)}
- }
- if _, ok := wc.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Whatsapp.updated_at"`)}
- }
- if _, ok := wc.mutation.Sk(); !ok {
- return &ValidationError{Name: "sk", err: errors.New(`ent: missing required field "Whatsapp.sk"`)}
- }
- if _, ok := wc.mutation.Nickname(); !ok {
- return &ValidationError{Name: "nickname", err: errors.New(`ent: missing required field "Whatsapp.nickname"`)}
- }
- if _, ok := wc.mutation.Phone(); !ok {
- return &ValidationError{Name: "phone", err: errors.New(`ent: missing required field "Whatsapp.phone"`)}
- }
- if _, ok := wc.mutation.AgentID(); !ok {
- return &ValidationError{Name: "agent_id", err: errors.New(`ent: missing required field "Whatsapp.agent_id"`)}
- }
- if _, ok := wc.mutation.AgentID(); !ok {
- return &ValidationError{Name: "agent", err: errors.New(`ent: missing required edge "Whatsapp.agent"`)}
- }
- return nil
- }
- func (wc *WhatsappCreate) sqlSave(ctx context.Context) (*Whatsapp, error) {
- if err := wc.check(); err != nil {
- return nil, err
- }
- _node, _spec := wc.createSpec()
- if err := sqlgraph.CreateNode(ctx, wc.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)
- }
- wc.mutation.id = &_node.ID
- wc.mutation.done = true
- return _node, nil
- }
- func (wc *WhatsappCreate) createSpec() (*Whatsapp, *sqlgraph.CreateSpec) {
- var (
- _node = &Whatsapp{config: wc.config}
- _spec = sqlgraph.NewCreateSpec(whatsapp.Table, sqlgraph.NewFieldSpec(whatsapp.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = wc.conflict
- if id, ok := wc.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := wc.mutation.CreatedAt(); ok {
- _spec.SetField(whatsapp.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := wc.mutation.UpdatedAt(); ok {
- _spec.SetField(whatsapp.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := wc.mutation.Status(); ok {
- _spec.SetField(whatsapp.FieldStatus, field.TypeUint8, value)
- _node.Status = value
- }
- if value, ok := wc.mutation.DeletedAt(); ok {
- _spec.SetField(whatsapp.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = value
- }
- if value, ok := wc.mutation.Ak(); ok {
- _spec.SetField(whatsapp.FieldAk, field.TypeString, value)
- _node.Ak = value
- }
- if value, ok := wc.mutation.Sk(); ok {
- _spec.SetField(whatsapp.FieldSk, field.TypeString, value)
- _node.Sk = value
- }
- if value, ok := wc.mutation.Callback(); ok {
- _spec.SetField(whatsapp.FieldCallback, field.TypeString, value)
- _node.Callback = value
- }
- if value, ok := wc.mutation.Account(); ok {
- _spec.SetField(whatsapp.FieldAccount, field.TypeString, value)
- _node.Account = value
- }
- if value, ok := wc.mutation.Nickname(); ok {
- _spec.SetField(whatsapp.FieldNickname, field.TypeString, value)
- _node.Nickname = value
- }
- if value, ok := wc.mutation.Phone(); ok {
- _spec.SetField(whatsapp.FieldPhone, field.TypeString, value)
- _node.Phone = value
- }
- if value, ok := wc.mutation.OrganizationID(); ok {
- _spec.SetField(whatsapp.FieldOrganizationID, field.TypeUint64, value)
- _node.OrganizationID = value
- }
- if value, ok := wc.mutation.APIBase(); ok {
- _spec.SetField(whatsapp.FieldAPIBase, field.TypeString, value)
- _node.APIBase = value
- }
- if value, ok := wc.mutation.APIKey(); ok {
- _spec.SetField(whatsapp.FieldAPIKey, field.TypeString, value)
- _node.APIKey = value
- }
- if value, ok := wc.mutation.AllowList(); ok {
- _spec.SetField(whatsapp.FieldAllowList, field.TypeJSON, value)
- _node.AllowList = value
- }
- if value, ok := wc.mutation.GroupAllowList(); ok {
- _spec.SetField(whatsapp.FieldGroupAllowList, field.TypeJSON, value)
- _node.GroupAllowList = value
- }
- if value, ok := wc.mutation.BlockList(); ok {
- _spec.SetField(whatsapp.FieldBlockList, field.TypeJSON, value)
- _node.BlockList = value
- }
- if value, ok := wc.mutation.GroupBlockList(); ok {
- _spec.SetField(whatsapp.FieldGroupBlockList, field.TypeJSON, value)
- _node.GroupBlockList = value
- }
- if nodes := wc.mutation.AgentIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.M2O,
- Inverse: true,
- Table: whatsapp.AgentTable,
- Columns: []string{whatsapp.AgentColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(agent.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _node.AgentID = nodes[0]
- _spec.Edges = append(_spec.Edges, edge)
- }
- return _node, _spec
- }
- func (wc *WhatsappCreate) OnConflict(opts ...sql.ConflictOption) *WhatsappUpsertOne {
- wc.conflict = opts
- return &WhatsappUpsertOne{
- create: wc,
- }
- }
- func (wc *WhatsappCreate) OnConflictColumns(columns ...string) *WhatsappUpsertOne {
- wc.conflict = append(wc.conflict, sql.ConflictColumns(columns...))
- return &WhatsappUpsertOne{
- create: wc,
- }
- }
- type (
-
-
- WhatsappUpsertOne struct {
- create *WhatsappCreate
- }
-
- WhatsappUpsert struct {
- *sql.UpdateSet
- }
- )
- func (u *WhatsappUpsert) SetUpdatedAt(v time.Time) *WhatsappUpsert {
- u.Set(whatsapp.FieldUpdatedAt, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateUpdatedAt() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldUpdatedAt)
- return u
- }
- func (u *WhatsappUpsert) SetStatus(v uint8) *WhatsappUpsert {
- u.Set(whatsapp.FieldStatus, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateStatus() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldStatus)
- return u
- }
- func (u *WhatsappUpsert) AddStatus(v uint8) *WhatsappUpsert {
- u.Add(whatsapp.FieldStatus, v)
- return u
- }
- func (u *WhatsappUpsert) ClearStatus() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldStatus)
- return u
- }
- func (u *WhatsappUpsert) SetDeletedAt(v time.Time) *WhatsappUpsert {
- u.Set(whatsapp.FieldDeletedAt, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateDeletedAt() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldDeletedAt)
- return u
- }
- func (u *WhatsappUpsert) ClearDeletedAt() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldDeletedAt)
- return u
- }
- func (u *WhatsappUpsert) SetAk(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldAk, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateAk() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldAk)
- return u
- }
- func (u *WhatsappUpsert) ClearAk() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldAk)
- return u
- }
- func (u *WhatsappUpsert) SetSk(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldSk, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateSk() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldSk)
- return u
- }
- func (u *WhatsappUpsert) SetCallback(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldCallback, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateCallback() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldCallback)
- return u
- }
- func (u *WhatsappUpsert) ClearCallback() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldCallback)
- return u
- }
- func (u *WhatsappUpsert) SetAccount(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldAccount, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateAccount() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldAccount)
- return u
- }
- func (u *WhatsappUpsert) ClearAccount() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldAccount)
- return u
- }
- func (u *WhatsappUpsert) SetNickname(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldNickname, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateNickname() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldNickname)
- return u
- }
- func (u *WhatsappUpsert) SetPhone(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldPhone, v)
- return u
- }
- func (u *WhatsappUpsert) UpdatePhone() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldPhone)
- return u
- }
- func (u *WhatsappUpsert) SetOrganizationID(v uint64) *WhatsappUpsert {
- u.Set(whatsapp.FieldOrganizationID, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateOrganizationID() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldOrganizationID)
- return u
- }
- func (u *WhatsappUpsert) AddOrganizationID(v uint64) *WhatsappUpsert {
- u.Add(whatsapp.FieldOrganizationID, v)
- return u
- }
- func (u *WhatsappUpsert) ClearOrganizationID() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldOrganizationID)
- return u
- }
- func (u *WhatsappUpsert) SetAgentID(v uint64) *WhatsappUpsert {
- u.Set(whatsapp.FieldAgentID, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateAgentID() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldAgentID)
- return u
- }
- func (u *WhatsappUpsert) SetAPIBase(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldAPIBase, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateAPIBase() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldAPIBase)
- return u
- }
- func (u *WhatsappUpsert) ClearAPIBase() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldAPIBase)
- return u
- }
- func (u *WhatsappUpsert) SetAPIKey(v string) *WhatsappUpsert {
- u.Set(whatsapp.FieldAPIKey, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateAPIKey() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldAPIKey)
- return u
- }
- func (u *WhatsappUpsert) ClearAPIKey() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldAPIKey)
- return u
- }
- func (u *WhatsappUpsert) SetAllowList(v []string) *WhatsappUpsert {
- u.Set(whatsapp.FieldAllowList, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateAllowList() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldAllowList)
- return u
- }
- func (u *WhatsappUpsert) ClearAllowList() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldAllowList)
- return u
- }
- func (u *WhatsappUpsert) SetGroupAllowList(v []string) *WhatsappUpsert {
- u.Set(whatsapp.FieldGroupAllowList, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateGroupAllowList() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldGroupAllowList)
- return u
- }
- func (u *WhatsappUpsert) ClearGroupAllowList() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldGroupAllowList)
- return u
- }
- func (u *WhatsappUpsert) SetBlockList(v []string) *WhatsappUpsert {
- u.Set(whatsapp.FieldBlockList, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateBlockList() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldBlockList)
- return u
- }
- func (u *WhatsappUpsert) ClearBlockList() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldBlockList)
- return u
- }
- func (u *WhatsappUpsert) SetGroupBlockList(v []string) *WhatsappUpsert {
- u.Set(whatsapp.FieldGroupBlockList, v)
- return u
- }
- func (u *WhatsappUpsert) UpdateGroupBlockList() *WhatsappUpsert {
- u.SetExcluded(whatsapp.FieldGroupBlockList)
- return u
- }
- func (u *WhatsappUpsert) ClearGroupBlockList() *WhatsappUpsert {
- u.SetNull(whatsapp.FieldGroupBlockList)
- return u
- }
- func (u *WhatsappUpsertOne) UpdateNewValues() *WhatsappUpsertOne {
- 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(whatsapp.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(whatsapp.FieldCreatedAt)
- }
- }))
- return u
- }
- func (u *WhatsappUpsertOne) Ignore() *WhatsappUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- func (u *WhatsappUpsertOne) DoNothing() *WhatsappUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- func (u *WhatsappUpsertOne) Update(set func(*WhatsappUpsert)) *WhatsappUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&WhatsappUpsert{UpdateSet: update})
- }))
- return u
- }
- func (u *WhatsappUpsertOne) SetUpdatedAt(v time.Time) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateUpdatedAt() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- func (u *WhatsappUpsertOne) SetStatus(v uint8) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetStatus(v)
- })
- }
- func (u *WhatsappUpsertOne) AddStatus(v uint8) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.AddStatus(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateStatus() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateStatus()
- })
- }
- func (u *WhatsappUpsertOne) ClearStatus() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearStatus()
- })
- }
- func (u *WhatsappUpsertOne) SetDeletedAt(v time.Time) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetDeletedAt(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateDeletedAt() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateDeletedAt()
- })
- }
- func (u *WhatsappUpsertOne) ClearDeletedAt() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearDeletedAt()
- })
- }
- func (u *WhatsappUpsertOne) SetAk(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAk(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateAk() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAk()
- })
- }
- func (u *WhatsappUpsertOne) ClearAk() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAk()
- })
- }
- func (u *WhatsappUpsertOne) SetSk(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetSk(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateSk() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateSk()
- })
- }
- func (u *WhatsappUpsertOne) SetCallback(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetCallback(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateCallback() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateCallback()
- })
- }
- func (u *WhatsappUpsertOne) ClearCallback() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearCallback()
- })
- }
- func (u *WhatsappUpsertOne) SetAccount(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAccount(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateAccount() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAccount()
- })
- }
- func (u *WhatsappUpsertOne) ClearAccount() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAccount()
- })
- }
- func (u *WhatsappUpsertOne) SetNickname(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetNickname(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateNickname() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateNickname()
- })
- }
- func (u *WhatsappUpsertOne) SetPhone(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetPhone(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdatePhone() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdatePhone()
- })
- }
- func (u *WhatsappUpsertOne) SetOrganizationID(v uint64) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetOrganizationID(v)
- })
- }
- func (u *WhatsappUpsertOne) AddOrganizationID(v uint64) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.AddOrganizationID(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateOrganizationID() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateOrganizationID()
- })
- }
- func (u *WhatsappUpsertOne) ClearOrganizationID() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearOrganizationID()
- })
- }
- func (u *WhatsappUpsertOne) SetAgentID(v uint64) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAgentID(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateAgentID() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAgentID()
- })
- }
- func (u *WhatsappUpsertOne) SetAPIBase(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAPIBase(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateAPIBase() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAPIBase()
- })
- }
- func (u *WhatsappUpsertOne) ClearAPIBase() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAPIBase()
- })
- }
- func (u *WhatsappUpsertOne) SetAPIKey(v string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAPIKey(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateAPIKey() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAPIKey()
- })
- }
- func (u *WhatsappUpsertOne) ClearAPIKey() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAPIKey()
- })
- }
- func (u *WhatsappUpsertOne) SetAllowList(v []string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAllowList(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateAllowList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAllowList()
- })
- }
- func (u *WhatsappUpsertOne) ClearAllowList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAllowList()
- })
- }
- func (u *WhatsappUpsertOne) SetGroupAllowList(v []string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetGroupAllowList(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateGroupAllowList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateGroupAllowList()
- })
- }
- func (u *WhatsappUpsertOne) ClearGroupAllowList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearGroupAllowList()
- })
- }
- func (u *WhatsappUpsertOne) SetBlockList(v []string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetBlockList(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateBlockList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateBlockList()
- })
- }
- func (u *WhatsappUpsertOne) ClearBlockList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearBlockList()
- })
- }
- func (u *WhatsappUpsertOne) SetGroupBlockList(v []string) *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetGroupBlockList(v)
- })
- }
- func (u *WhatsappUpsertOne) UpdateGroupBlockList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateGroupBlockList()
- })
- }
- func (u *WhatsappUpsertOne) ClearGroupBlockList() *WhatsappUpsertOne {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearGroupBlockList()
- })
- }
- func (u *WhatsappUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for WhatsappCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- func (u *WhatsappUpsertOne) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
- func (u *WhatsappUpsertOne) ID(ctx context.Context) (id uint64, err error) {
- node, err := u.create.Save(ctx)
- if err != nil {
- return id, err
- }
- return node.ID, nil
- }
- func (u *WhatsappUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- type WhatsappCreateBulk struct {
- config
- err error
- builders []*WhatsappCreate
- conflict []sql.ConflictOption
- }
- func (wcb *WhatsappCreateBulk) Save(ctx context.Context) ([]*Whatsapp, error) {
- if wcb.err != nil {
- return nil, wcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(wcb.builders))
- nodes := make([]*Whatsapp, len(wcb.builders))
- mutators := make([]Mutator, len(wcb.builders))
- for i := range wcb.builders {
- func(i int, root context.Context) {
- builder := wcb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*WhatsappMutation)
- 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, wcb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = wcb.conflict
-
- if err = sqlgraph.BatchCreate(ctx, wcb.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, wcb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- func (wcb *WhatsappCreateBulk) SaveX(ctx context.Context) []*Whatsapp {
- v, err := wcb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- func (wcb *WhatsappCreateBulk) Exec(ctx context.Context) error {
- _, err := wcb.Save(ctx)
- return err
- }
- func (wcb *WhatsappCreateBulk) ExecX(ctx context.Context) {
- if err := wcb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- func (wcb *WhatsappCreateBulk) OnConflict(opts ...sql.ConflictOption) *WhatsappUpsertBulk {
- wcb.conflict = opts
- return &WhatsappUpsertBulk{
- create: wcb,
- }
- }
- func (wcb *WhatsappCreateBulk) OnConflictColumns(columns ...string) *WhatsappUpsertBulk {
- wcb.conflict = append(wcb.conflict, sql.ConflictColumns(columns...))
- return &WhatsappUpsertBulk{
- create: wcb,
- }
- }
- type WhatsappUpsertBulk struct {
- create *WhatsappCreateBulk
- }
- func (u *WhatsappUpsertBulk) UpdateNewValues() *WhatsappUpsertBulk {
- 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(whatsapp.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(whatsapp.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- func (u *WhatsappUpsertBulk) Ignore() *WhatsappUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- func (u *WhatsappUpsertBulk) DoNothing() *WhatsappUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- func (u *WhatsappUpsertBulk) Update(set func(*WhatsappUpsert)) *WhatsappUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&WhatsappUpsert{UpdateSet: update})
- }))
- return u
- }
- func (u *WhatsappUpsertBulk) SetUpdatedAt(v time.Time) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateUpdatedAt() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- func (u *WhatsappUpsertBulk) SetStatus(v uint8) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetStatus(v)
- })
- }
- func (u *WhatsappUpsertBulk) AddStatus(v uint8) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.AddStatus(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateStatus() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateStatus()
- })
- }
- func (u *WhatsappUpsertBulk) ClearStatus() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearStatus()
- })
- }
- func (u *WhatsappUpsertBulk) SetDeletedAt(v time.Time) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetDeletedAt(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateDeletedAt() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateDeletedAt()
- })
- }
- func (u *WhatsappUpsertBulk) ClearDeletedAt() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearDeletedAt()
- })
- }
- func (u *WhatsappUpsertBulk) SetAk(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAk(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateAk() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAk()
- })
- }
- func (u *WhatsappUpsertBulk) ClearAk() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAk()
- })
- }
- func (u *WhatsappUpsertBulk) SetSk(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetSk(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateSk() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateSk()
- })
- }
- func (u *WhatsappUpsertBulk) SetCallback(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetCallback(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateCallback() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateCallback()
- })
- }
- func (u *WhatsappUpsertBulk) ClearCallback() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearCallback()
- })
- }
- func (u *WhatsappUpsertBulk) SetAccount(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAccount(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateAccount() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAccount()
- })
- }
- func (u *WhatsappUpsertBulk) ClearAccount() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAccount()
- })
- }
- func (u *WhatsappUpsertBulk) SetNickname(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetNickname(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateNickname() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateNickname()
- })
- }
- func (u *WhatsappUpsertBulk) SetPhone(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetPhone(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdatePhone() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdatePhone()
- })
- }
- func (u *WhatsappUpsertBulk) SetOrganizationID(v uint64) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetOrganizationID(v)
- })
- }
- func (u *WhatsappUpsertBulk) AddOrganizationID(v uint64) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.AddOrganizationID(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateOrganizationID() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateOrganizationID()
- })
- }
- func (u *WhatsappUpsertBulk) ClearOrganizationID() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearOrganizationID()
- })
- }
- func (u *WhatsappUpsertBulk) SetAgentID(v uint64) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAgentID(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateAgentID() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAgentID()
- })
- }
- func (u *WhatsappUpsertBulk) SetAPIBase(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAPIBase(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateAPIBase() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAPIBase()
- })
- }
- func (u *WhatsappUpsertBulk) ClearAPIBase() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAPIBase()
- })
- }
- func (u *WhatsappUpsertBulk) SetAPIKey(v string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAPIKey(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateAPIKey() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAPIKey()
- })
- }
- func (u *WhatsappUpsertBulk) ClearAPIKey() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAPIKey()
- })
- }
- func (u *WhatsappUpsertBulk) SetAllowList(v []string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetAllowList(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateAllowList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateAllowList()
- })
- }
- func (u *WhatsappUpsertBulk) ClearAllowList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearAllowList()
- })
- }
- func (u *WhatsappUpsertBulk) SetGroupAllowList(v []string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetGroupAllowList(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateGroupAllowList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateGroupAllowList()
- })
- }
- func (u *WhatsappUpsertBulk) ClearGroupAllowList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearGroupAllowList()
- })
- }
- func (u *WhatsappUpsertBulk) SetBlockList(v []string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetBlockList(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateBlockList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateBlockList()
- })
- }
- func (u *WhatsappUpsertBulk) ClearBlockList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearBlockList()
- })
- }
- func (u *WhatsappUpsertBulk) SetGroupBlockList(v []string) *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.SetGroupBlockList(v)
- })
- }
- func (u *WhatsappUpsertBulk) UpdateGroupBlockList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.UpdateGroupBlockList()
- })
- }
- func (u *WhatsappUpsertBulk) ClearGroupBlockList() *WhatsappUpsertBulk {
- return u.Update(func(s *WhatsappUpsert) {
- s.ClearGroupBlockList()
- })
- }
- func (u *WhatsappUpsertBulk) 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 WhatsappCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for WhatsappCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- func (u *WhatsappUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|