1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/compapijob"
- "wechat-api/ent/custom_types"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // CompapiJobCreate is the builder for creating a CompapiJob entity.
- type CompapiJobCreate struct {
- config
- mutation *CompapiJobMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (cjc *CompapiJobCreate) SetCreatedAt(t time.Time) *CompapiJobCreate {
- cjc.mutation.SetCreatedAt(t)
- return cjc
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableCreatedAt(t *time.Time) *CompapiJobCreate {
- if t != nil {
- cjc.SetCreatedAt(*t)
- }
- return cjc
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (cjc *CompapiJobCreate) SetUpdatedAt(t time.Time) *CompapiJobCreate {
- cjc.mutation.SetUpdatedAt(t)
- return cjc
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableUpdatedAt(t *time.Time) *CompapiJobCreate {
- if t != nil {
- cjc.SetUpdatedAt(*t)
- }
- return cjc
- }
- // SetDistAt sets the "dist_at" field.
- func (cjc *CompapiJobCreate) SetDistAt(t time.Time) *CompapiJobCreate {
- cjc.mutation.SetDistAt(t)
- return cjc
- }
- // SetNillableDistAt sets the "dist_at" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableDistAt(t *time.Time) *CompapiJobCreate {
- if t != nil {
- cjc.SetDistAt(*t)
- }
- return cjc
- }
- // SetDistStatus sets the "dist_status" field.
- func (cjc *CompapiJobCreate) SetDistStatus(i int8) *CompapiJobCreate {
- cjc.mutation.SetDistStatus(i)
- return cjc
- }
- // SetNillableDistStatus sets the "dist_status" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableDistStatus(i *int8) *CompapiJobCreate {
- if i != nil {
- cjc.SetDistStatus(*i)
- }
- return cjc
- }
- // SetCallbackStatus sets the "callback_status" field.
- func (cjc *CompapiJobCreate) SetCallbackStatus(i int8) *CompapiJobCreate {
- cjc.mutation.SetCallbackStatus(i)
- return cjc
- }
- // SetNillableCallbackStatus sets the "callback_status" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableCallbackStatus(i *int8) *CompapiJobCreate {
- if i != nil {
- cjc.SetCallbackStatus(*i)
- }
- return cjc
- }
- // SetCallbackURL sets the "callback_url" field.
- func (cjc *CompapiJobCreate) SetCallbackURL(s string) *CompapiJobCreate {
- cjc.mutation.SetCallbackURL(s)
- return cjc
- }
- // SetRequestJSON sets the "request_json" field.
- func (cjc *CompapiJobCreate) SetRequestJSON(ctd custom_types.OriginalData) *CompapiJobCreate {
- cjc.mutation.SetRequestJSON(ctd)
- return cjc
- }
- // SetAuthToken sets the "auth_token" field.
- func (cjc *CompapiJobCreate) SetAuthToken(s string) *CompapiJobCreate {
- cjc.mutation.SetAuthToken(s)
- return cjc
- }
- // SetNillableAuthToken sets the "auth_token" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableAuthToken(s *string) *CompapiJobCreate {
- if s != nil {
- cjc.SetAuthToken(*s)
- }
- return cjc
- }
- // SetEventType sets the "event_type" field.
- func (cjc *CompapiJobCreate) SetEventType(s string) *CompapiJobCreate {
- cjc.mutation.SetEventType(s)
- return cjc
- }
- // SetNillableEventType sets the "event_type" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableEventType(s *string) *CompapiJobCreate {
- if s != nil {
- cjc.SetEventType(*s)
- }
- return cjc
- }
- // SetWorkidIdx sets the "workid_idx" field.
- func (cjc *CompapiJobCreate) SetWorkidIdx(i int8) *CompapiJobCreate {
- cjc.mutation.SetWorkidIdx(i)
- return cjc
- }
- // SetNillableWorkidIdx sets the "workid_idx" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableWorkidIdx(i *int8) *CompapiJobCreate {
- if i != nil {
- cjc.SetWorkidIdx(*i)
- }
- return cjc
- }
- // SetChatID sets the "chat_id" field.
- func (cjc *CompapiJobCreate) SetChatID(s string) *CompapiJobCreate {
- cjc.mutation.SetChatID(s)
- return cjc
- }
- // SetNillableChatID sets the "chat_id" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableChatID(s *string) *CompapiJobCreate {
- if s != nil {
- cjc.SetChatID(*s)
- }
- return cjc
- }
- // SetRetryCount sets the "retry_count" field.
- func (cjc *CompapiJobCreate) SetRetryCount(i int8) *CompapiJobCreate {
- cjc.mutation.SetRetryCount(i)
- return cjc
- }
- // SetNillableRetryCount sets the "retry_count" field if the given value is not nil.
- func (cjc *CompapiJobCreate) SetNillableRetryCount(i *int8) *CompapiJobCreate {
- if i != nil {
- cjc.SetRetryCount(*i)
- }
- return cjc
- }
- // SetID sets the "id" field.
- func (cjc *CompapiJobCreate) SetID(u uint64) *CompapiJobCreate {
- cjc.mutation.SetID(u)
- return cjc
- }
- // Mutation returns the CompapiJobMutation object of the builder.
- func (cjc *CompapiJobCreate) Mutation() *CompapiJobMutation {
- return cjc.mutation
- }
- // Save creates the CompapiJob in the database.
- func (cjc *CompapiJobCreate) Save(ctx context.Context) (*CompapiJob, error) {
- cjc.defaults()
- return withHooks(ctx, cjc.sqlSave, cjc.mutation, cjc.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (cjc *CompapiJobCreate) SaveX(ctx context.Context) *CompapiJob {
- v, err := cjc.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (cjc *CompapiJobCreate) Exec(ctx context.Context) error {
- _, err := cjc.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (cjc *CompapiJobCreate) ExecX(ctx context.Context) {
- if err := cjc.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (cjc *CompapiJobCreate) defaults() {
- if _, ok := cjc.mutation.CreatedAt(); !ok {
- v := compapijob.DefaultCreatedAt()
- cjc.mutation.SetCreatedAt(v)
- }
- if _, ok := cjc.mutation.UpdatedAt(); !ok {
- v := compapijob.DefaultUpdatedAt()
- cjc.mutation.SetUpdatedAt(v)
- }
- if _, ok := cjc.mutation.DistStatus(); !ok {
- v := compapijob.DefaultDistStatus
- cjc.mutation.SetDistStatus(v)
- }
- if _, ok := cjc.mutation.CallbackStatus(); !ok {
- v := compapijob.DefaultCallbackStatus
- cjc.mutation.SetCallbackStatus(v)
- }
- if _, ok := cjc.mutation.AuthToken(); !ok {
- v := compapijob.DefaultAuthToken
- cjc.mutation.SetAuthToken(v)
- }
- if _, ok := cjc.mutation.EventType(); !ok {
- v := compapijob.DefaultEventType
- cjc.mutation.SetEventType(v)
- }
- if _, ok := cjc.mutation.WorkidIdx(); !ok {
- v := compapijob.DefaultWorkidIdx
- cjc.mutation.SetWorkidIdx(v)
- }
- if _, ok := cjc.mutation.ChatID(); !ok {
- v := compapijob.DefaultChatID
- cjc.mutation.SetChatID(v)
- }
- if _, ok := cjc.mutation.RetryCount(); !ok {
- v := compapijob.DefaultRetryCount
- cjc.mutation.SetRetryCount(v)
- }
- }
- // check runs all checks and user-defined validators on the builder.
- func (cjc *CompapiJobCreate) check() error {
- if _, ok := cjc.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "CompapiJob.created_at"`)}
- }
- if _, ok := cjc.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "CompapiJob.updated_at"`)}
- }
- if _, ok := cjc.mutation.CallbackURL(); !ok {
- return &ValidationError{Name: "callback_url", err: errors.New(`ent: missing required field "CompapiJob.callback_url"`)}
- }
- if _, ok := cjc.mutation.RequestJSON(); !ok {
- return &ValidationError{Name: "request_json", err: errors.New(`ent: missing required field "CompapiJob.request_json"`)}
- }
- if _, ok := cjc.mutation.AuthToken(); !ok {
- return &ValidationError{Name: "auth_token", err: errors.New(`ent: missing required field "CompapiJob.auth_token"`)}
- }
- if _, ok := cjc.mutation.EventType(); !ok {
- return &ValidationError{Name: "event_type", err: errors.New(`ent: missing required field "CompapiJob.event_type"`)}
- }
- return nil
- }
- func (cjc *CompapiJobCreate) sqlSave(ctx context.Context) (*CompapiJob, error) {
- if err := cjc.check(); err != nil {
- return nil, err
- }
- _node, _spec := cjc.createSpec()
- if err := sqlgraph.CreateNode(ctx, cjc.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)
- }
- cjc.mutation.id = &_node.ID
- cjc.mutation.done = true
- return _node, nil
- }
- func (cjc *CompapiJobCreate) createSpec() (*CompapiJob, *sqlgraph.CreateSpec) {
- var (
- _node = &CompapiJob{config: cjc.config}
- _spec = sqlgraph.NewCreateSpec(compapijob.Table, sqlgraph.NewFieldSpec(compapijob.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = cjc.conflict
- if id, ok := cjc.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := cjc.mutation.CreatedAt(); ok {
- _spec.SetField(compapijob.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := cjc.mutation.UpdatedAt(); ok {
- _spec.SetField(compapijob.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := cjc.mutation.DistAt(); ok {
- _spec.SetField(compapijob.FieldDistAt, field.TypeTime, value)
- _node.DistAt = value
- }
- if value, ok := cjc.mutation.DistStatus(); ok {
- _spec.SetField(compapijob.FieldDistStatus, field.TypeInt8, value)
- _node.DistStatus = value
- }
- if value, ok := cjc.mutation.CallbackStatus(); ok {
- _spec.SetField(compapijob.FieldCallbackStatus, field.TypeInt8, value)
- _node.CallbackStatus = value
- }
- if value, ok := cjc.mutation.CallbackURL(); ok {
- _spec.SetField(compapijob.FieldCallbackURL, field.TypeString, value)
- _node.CallbackURL = value
- }
- if value, ok := cjc.mutation.RequestJSON(); ok {
- _spec.SetField(compapijob.FieldRequestJSON, field.TypeJSON, value)
- _node.RequestJSON = value
- }
- if value, ok := cjc.mutation.AuthToken(); ok {
- _spec.SetField(compapijob.FieldAuthToken, field.TypeString, value)
- _node.AuthToken = value
- }
- if value, ok := cjc.mutation.EventType(); ok {
- _spec.SetField(compapijob.FieldEventType, field.TypeString, value)
- _node.EventType = value
- }
- if value, ok := cjc.mutation.WorkidIdx(); ok {
- _spec.SetField(compapijob.FieldWorkidIdx, field.TypeInt8, value)
- _node.WorkidIdx = value
- }
- if value, ok := cjc.mutation.ChatID(); ok {
- _spec.SetField(compapijob.FieldChatID, field.TypeString, value)
- _node.ChatID = value
- }
- if value, ok := cjc.mutation.RetryCount(); ok {
- _spec.SetField(compapijob.FieldRetryCount, field.TypeInt8, value)
- _node.RetryCount = value
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.CompapiJob.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.CompapiJobUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (cjc *CompapiJobCreate) OnConflict(opts ...sql.ConflictOption) *CompapiJobUpsertOne {
- cjc.conflict = opts
- return &CompapiJobUpsertOne{
- create: cjc,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.CompapiJob.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (cjc *CompapiJobCreate) OnConflictColumns(columns ...string) *CompapiJobUpsertOne {
- cjc.conflict = append(cjc.conflict, sql.ConflictColumns(columns...))
- return &CompapiJobUpsertOne{
- create: cjc,
- }
- }
- type (
- // CompapiJobUpsertOne is the builder for "upsert"-ing
- // one CompapiJob node.
- CompapiJobUpsertOne struct {
- create *CompapiJobCreate
- }
- // CompapiJobUpsert is the "OnConflict" setter.
- CompapiJobUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *CompapiJobUpsert) SetUpdatedAt(v time.Time) *CompapiJobUpsert {
- u.Set(compapijob.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateUpdatedAt() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldUpdatedAt)
- return u
- }
- // SetDistAt sets the "dist_at" field.
- func (u *CompapiJobUpsert) SetDistAt(v time.Time) *CompapiJobUpsert {
- u.Set(compapijob.FieldDistAt, v)
- return u
- }
- // UpdateDistAt sets the "dist_at" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateDistAt() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldDistAt)
- return u
- }
- // ClearDistAt clears the value of the "dist_at" field.
- func (u *CompapiJobUpsert) ClearDistAt() *CompapiJobUpsert {
- u.SetNull(compapijob.FieldDistAt)
- return u
- }
- // SetDistStatus sets the "dist_status" field.
- func (u *CompapiJobUpsert) SetDistStatus(v int8) *CompapiJobUpsert {
- u.Set(compapijob.FieldDistStatus, v)
- return u
- }
- // UpdateDistStatus sets the "dist_status" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateDistStatus() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldDistStatus)
- return u
- }
- // AddDistStatus adds v to the "dist_status" field.
- func (u *CompapiJobUpsert) AddDistStatus(v int8) *CompapiJobUpsert {
- u.Add(compapijob.FieldDistStatus, v)
- return u
- }
- // ClearDistStatus clears the value of the "dist_status" field.
- func (u *CompapiJobUpsert) ClearDistStatus() *CompapiJobUpsert {
- u.SetNull(compapijob.FieldDistStatus)
- return u
- }
- // SetCallbackStatus sets the "callback_status" field.
- func (u *CompapiJobUpsert) SetCallbackStatus(v int8) *CompapiJobUpsert {
- u.Set(compapijob.FieldCallbackStatus, v)
- return u
- }
- // UpdateCallbackStatus sets the "callback_status" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateCallbackStatus() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldCallbackStatus)
- return u
- }
- // AddCallbackStatus adds v to the "callback_status" field.
- func (u *CompapiJobUpsert) AddCallbackStatus(v int8) *CompapiJobUpsert {
- u.Add(compapijob.FieldCallbackStatus, v)
- return u
- }
- // ClearCallbackStatus clears the value of the "callback_status" field.
- func (u *CompapiJobUpsert) ClearCallbackStatus() *CompapiJobUpsert {
- u.SetNull(compapijob.FieldCallbackStatus)
- return u
- }
- // SetCallbackURL sets the "callback_url" field.
- func (u *CompapiJobUpsert) SetCallbackURL(v string) *CompapiJobUpsert {
- u.Set(compapijob.FieldCallbackURL, v)
- return u
- }
- // UpdateCallbackURL sets the "callback_url" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateCallbackURL() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldCallbackURL)
- return u
- }
- // SetRequestJSON sets the "request_json" field.
- func (u *CompapiJobUpsert) SetRequestJSON(v custom_types.OriginalData) *CompapiJobUpsert {
- u.Set(compapijob.FieldRequestJSON, v)
- return u
- }
- // UpdateRequestJSON sets the "request_json" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateRequestJSON() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldRequestJSON)
- return u
- }
- // SetAuthToken sets the "auth_token" field.
- func (u *CompapiJobUpsert) SetAuthToken(v string) *CompapiJobUpsert {
- u.Set(compapijob.FieldAuthToken, v)
- return u
- }
- // UpdateAuthToken sets the "auth_token" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateAuthToken() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldAuthToken)
- return u
- }
- // SetEventType sets the "event_type" field.
- func (u *CompapiJobUpsert) SetEventType(v string) *CompapiJobUpsert {
- u.Set(compapijob.FieldEventType, v)
- return u
- }
- // UpdateEventType sets the "event_type" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateEventType() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldEventType)
- return u
- }
- // SetWorkidIdx sets the "workid_idx" field.
- func (u *CompapiJobUpsert) SetWorkidIdx(v int8) *CompapiJobUpsert {
- u.Set(compapijob.FieldWorkidIdx, v)
- return u
- }
- // UpdateWorkidIdx sets the "workid_idx" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateWorkidIdx() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldWorkidIdx)
- return u
- }
- // AddWorkidIdx adds v to the "workid_idx" field.
- func (u *CompapiJobUpsert) AddWorkidIdx(v int8) *CompapiJobUpsert {
- u.Add(compapijob.FieldWorkidIdx, v)
- return u
- }
- // ClearWorkidIdx clears the value of the "workid_idx" field.
- func (u *CompapiJobUpsert) ClearWorkidIdx() *CompapiJobUpsert {
- u.SetNull(compapijob.FieldWorkidIdx)
- return u
- }
- // SetChatID sets the "chat_id" field.
- func (u *CompapiJobUpsert) SetChatID(v string) *CompapiJobUpsert {
- u.Set(compapijob.FieldChatID, v)
- return u
- }
- // UpdateChatID sets the "chat_id" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateChatID() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldChatID)
- return u
- }
- // ClearChatID clears the value of the "chat_id" field.
- func (u *CompapiJobUpsert) ClearChatID() *CompapiJobUpsert {
- u.SetNull(compapijob.FieldChatID)
- return u
- }
- // SetRetryCount sets the "retry_count" field.
- func (u *CompapiJobUpsert) SetRetryCount(v int8) *CompapiJobUpsert {
- u.Set(compapijob.FieldRetryCount, v)
- return u
- }
- // UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
- func (u *CompapiJobUpsert) UpdateRetryCount() *CompapiJobUpsert {
- u.SetExcluded(compapijob.FieldRetryCount)
- return u
- }
- // AddRetryCount adds v to the "retry_count" field.
- func (u *CompapiJobUpsert) AddRetryCount(v int8) *CompapiJobUpsert {
- u.Add(compapijob.FieldRetryCount, v)
- return u
- }
- // ClearRetryCount clears the value of the "retry_count" field.
- func (u *CompapiJobUpsert) ClearRetryCount() *CompapiJobUpsert {
- u.SetNull(compapijob.FieldRetryCount)
- 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.CompapiJob.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(compapijob.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *CompapiJobUpsertOne) UpdateNewValues() *CompapiJobUpsertOne {
- 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(compapijob.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(compapijob.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.CompapiJob.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *CompapiJobUpsertOne) Ignore() *CompapiJobUpsertOne {
- 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 *CompapiJobUpsertOne) DoNothing() *CompapiJobUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the CompapiJobCreate.OnConflict
- // documentation for more info.
- func (u *CompapiJobUpsertOne) Update(set func(*CompapiJobUpsert)) *CompapiJobUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&CompapiJobUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *CompapiJobUpsertOne) SetUpdatedAt(v time.Time) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateUpdatedAt() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDistAt sets the "dist_at" field.
- func (u *CompapiJobUpsertOne) SetDistAt(v time.Time) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetDistAt(v)
- })
- }
- // UpdateDistAt sets the "dist_at" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateDistAt() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateDistAt()
- })
- }
- // ClearDistAt clears the value of the "dist_at" field.
- func (u *CompapiJobUpsertOne) ClearDistAt() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearDistAt()
- })
- }
- // SetDistStatus sets the "dist_status" field.
- func (u *CompapiJobUpsertOne) SetDistStatus(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetDistStatus(v)
- })
- }
- // AddDistStatus adds v to the "dist_status" field.
- func (u *CompapiJobUpsertOne) AddDistStatus(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddDistStatus(v)
- })
- }
- // UpdateDistStatus sets the "dist_status" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateDistStatus() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateDistStatus()
- })
- }
- // ClearDistStatus clears the value of the "dist_status" field.
- func (u *CompapiJobUpsertOne) ClearDistStatus() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearDistStatus()
- })
- }
- // SetCallbackStatus sets the "callback_status" field.
- func (u *CompapiJobUpsertOne) SetCallbackStatus(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetCallbackStatus(v)
- })
- }
- // AddCallbackStatus adds v to the "callback_status" field.
- func (u *CompapiJobUpsertOne) AddCallbackStatus(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddCallbackStatus(v)
- })
- }
- // UpdateCallbackStatus sets the "callback_status" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateCallbackStatus() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateCallbackStatus()
- })
- }
- // ClearCallbackStatus clears the value of the "callback_status" field.
- func (u *CompapiJobUpsertOne) ClearCallbackStatus() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearCallbackStatus()
- })
- }
- // SetCallbackURL sets the "callback_url" field.
- func (u *CompapiJobUpsertOne) SetCallbackURL(v string) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetCallbackURL(v)
- })
- }
- // UpdateCallbackURL sets the "callback_url" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateCallbackURL() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateCallbackURL()
- })
- }
- // SetRequestJSON sets the "request_json" field.
- func (u *CompapiJobUpsertOne) SetRequestJSON(v custom_types.OriginalData) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetRequestJSON(v)
- })
- }
- // UpdateRequestJSON sets the "request_json" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateRequestJSON() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateRequestJSON()
- })
- }
- // SetAuthToken sets the "auth_token" field.
- func (u *CompapiJobUpsertOne) SetAuthToken(v string) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetAuthToken(v)
- })
- }
- // UpdateAuthToken sets the "auth_token" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateAuthToken() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateAuthToken()
- })
- }
- // SetEventType sets the "event_type" field.
- func (u *CompapiJobUpsertOne) SetEventType(v string) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetEventType(v)
- })
- }
- // UpdateEventType sets the "event_type" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateEventType() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateEventType()
- })
- }
- // SetWorkidIdx sets the "workid_idx" field.
- func (u *CompapiJobUpsertOne) SetWorkidIdx(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetWorkidIdx(v)
- })
- }
- // AddWorkidIdx adds v to the "workid_idx" field.
- func (u *CompapiJobUpsertOne) AddWorkidIdx(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddWorkidIdx(v)
- })
- }
- // UpdateWorkidIdx sets the "workid_idx" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateWorkidIdx() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateWorkidIdx()
- })
- }
- // ClearWorkidIdx clears the value of the "workid_idx" field.
- func (u *CompapiJobUpsertOne) ClearWorkidIdx() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearWorkidIdx()
- })
- }
- // SetChatID sets the "chat_id" field.
- func (u *CompapiJobUpsertOne) SetChatID(v string) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetChatID(v)
- })
- }
- // UpdateChatID sets the "chat_id" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateChatID() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateChatID()
- })
- }
- // ClearChatID clears the value of the "chat_id" field.
- func (u *CompapiJobUpsertOne) ClearChatID() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearChatID()
- })
- }
- // SetRetryCount sets the "retry_count" field.
- func (u *CompapiJobUpsertOne) SetRetryCount(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetRetryCount(v)
- })
- }
- // AddRetryCount adds v to the "retry_count" field.
- func (u *CompapiJobUpsertOne) AddRetryCount(v int8) *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddRetryCount(v)
- })
- }
- // UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
- func (u *CompapiJobUpsertOne) UpdateRetryCount() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateRetryCount()
- })
- }
- // ClearRetryCount clears the value of the "retry_count" field.
- func (u *CompapiJobUpsertOne) ClearRetryCount() *CompapiJobUpsertOne {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearRetryCount()
- })
- }
- // Exec executes the query.
- func (u *CompapiJobUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for CompapiJobCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *CompapiJobUpsertOne) 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 *CompapiJobUpsertOne) 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 *CompapiJobUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // CompapiJobCreateBulk is the builder for creating many CompapiJob entities in bulk.
- type CompapiJobCreateBulk struct {
- config
- err error
- builders []*CompapiJobCreate
- conflict []sql.ConflictOption
- }
- // Save creates the CompapiJob entities in the database.
- func (cjcb *CompapiJobCreateBulk) Save(ctx context.Context) ([]*CompapiJob, error) {
- if cjcb.err != nil {
- return nil, cjcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(cjcb.builders))
- nodes := make([]*CompapiJob, len(cjcb.builders))
- mutators := make([]Mutator, len(cjcb.builders))
- for i := range cjcb.builders {
- func(i int, root context.Context) {
- builder := cjcb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*CompapiJobMutation)
- 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, cjcb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = cjcb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, cjcb.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, cjcb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (cjcb *CompapiJobCreateBulk) SaveX(ctx context.Context) []*CompapiJob {
- v, err := cjcb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (cjcb *CompapiJobCreateBulk) Exec(ctx context.Context) error {
- _, err := cjcb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (cjcb *CompapiJobCreateBulk) ExecX(ctx context.Context) {
- if err := cjcb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.CompapiJob.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.CompapiJobUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (cjcb *CompapiJobCreateBulk) OnConflict(opts ...sql.ConflictOption) *CompapiJobUpsertBulk {
- cjcb.conflict = opts
- return &CompapiJobUpsertBulk{
- create: cjcb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.CompapiJob.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (cjcb *CompapiJobCreateBulk) OnConflictColumns(columns ...string) *CompapiJobUpsertBulk {
- cjcb.conflict = append(cjcb.conflict, sql.ConflictColumns(columns...))
- return &CompapiJobUpsertBulk{
- create: cjcb,
- }
- }
- // CompapiJobUpsertBulk is the builder for "upsert"-ing
- // a bulk of CompapiJob nodes.
- type CompapiJobUpsertBulk struct {
- create *CompapiJobCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.CompapiJob.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(compapijob.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *CompapiJobUpsertBulk) UpdateNewValues() *CompapiJobUpsertBulk {
- 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(compapijob.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(compapijob.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.CompapiJob.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *CompapiJobUpsertBulk) Ignore() *CompapiJobUpsertBulk {
- 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 *CompapiJobUpsertBulk) DoNothing() *CompapiJobUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the CompapiJobCreateBulk.OnConflict
- // documentation for more info.
- func (u *CompapiJobUpsertBulk) Update(set func(*CompapiJobUpsert)) *CompapiJobUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&CompapiJobUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *CompapiJobUpsertBulk) SetUpdatedAt(v time.Time) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateUpdatedAt() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDistAt sets the "dist_at" field.
- func (u *CompapiJobUpsertBulk) SetDistAt(v time.Time) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetDistAt(v)
- })
- }
- // UpdateDistAt sets the "dist_at" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateDistAt() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateDistAt()
- })
- }
- // ClearDistAt clears the value of the "dist_at" field.
- func (u *CompapiJobUpsertBulk) ClearDistAt() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearDistAt()
- })
- }
- // SetDistStatus sets the "dist_status" field.
- func (u *CompapiJobUpsertBulk) SetDistStatus(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetDistStatus(v)
- })
- }
- // AddDistStatus adds v to the "dist_status" field.
- func (u *CompapiJobUpsertBulk) AddDistStatus(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddDistStatus(v)
- })
- }
- // UpdateDistStatus sets the "dist_status" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateDistStatus() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateDistStatus()
- })
- }
- // ClearDistStatus clears the value of the "dist_status" field.
- func (u *CompapiJobUpsertBulk) ClearDistStatus() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearDistStatus()
- })
- }
- // SetCallbackStatus sets the "callback_status" field.
- func (u *CompapiJobUpsertBulk) SetCallbackStatus(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetCallbackStatus(v)
- })
- }
- // AddCallbackStatus adds v to the "callback_status" field.
- func (u *CompapiJobUpsertBulk) AddCallbackStatus(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddCallbackStatus(v)
- })
- }
- // UpdateCallbackStatus sets the "callback_status" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateCallbackStatus() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateCallbackStatus()
- })
- }
- // ClearCallbackStatus clears the value of the "callback_status" field.
- func (u *CompapiJobUpsertBulk) ClearCallbackStatus() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearCallbackStatus()
- })
- }
- // SetCallbackURL sets the "callback_url" field.
- func (u *CompapiJobUpsertBulk) SetCallbackURL(v string) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetCallbackURL(v)
- })
- }
- // UpdateCallbackURL sets the "callback_url" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateCallbackURL() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateCallbackURL()
- })
- }
- // SetRequestJSON sets the "request_json" field.
- func (u *CompapiJobUpsertBulk) SetRequestJSON(v custom_types.OriginalData) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetRequestJSON(v)
- })
- }
- // UpdateRequestJSON sets the "request_json" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateRequestJSON() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateRequestJSON()
- })
- }
- // SetAuthToken sets the "auth_token" field.
- func (u *CompapiJobUpsertBulk) SetAuthToken(v string) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetAuthToken(v)
- })
- }
- // UpdateAuthToken sets the "auth_token" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateAuthToken() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateAuthToken()
- })
- }
- // SetEventType sets the "event_type" field.
- func (u *CompapiJobUpsertBulk) SetEventType(v string) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetEventType(v)
- })
- }
- // UpdateEventType sets the "event_type" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateEventType() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateEventType()
- })
- }
- // SetWorkidIdx sets the "workid_idx" field.
- func (u *CompapiJobUpsertBulk) SetWorkidIdx(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetWorkidIdx(v)
- })
- }
- // AddWorkidIdx adds v to the "workid_idx" field.
- func (u *CompapiJobUpsertBulk) AddWorkidIdx(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddWorkidIdx(v)
- })
- }
- // UpdateWorkidIdx sets the "workid_idx" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateWorkidIdx() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateWorkidIdx()
- })
- }
- // ClearWorkidIdx clears the value of the "workid_idx" field.
- func (u *CompapiJobUpsertBulk) ClearWorkidIdx() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearWorkidIdx()
- })
- }
- // SetChatID sets the "chat_id" field.
- func (u *CompapiJobUpsertBulk) SetChatID(v string) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetChatID(v)
- })
- }
- // UpdateChatID sets the "chat_id" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateChatID() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateChatID()
- })
- }
- // ClearChatID clears the value of the "chat_id" field.
- func (u *CompapiJobUpsertBulk) ClearChatID() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearChatID()
- })
- }
- // SetRetryCount sets the "retry_count" field.
- func (u *CompapiJobUpsertBulk) SetRetryCount(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.SetRetryCount(v)
- })
- }
- // AddRetryCount adds v to the "retry_count" field.
- func (u *CompapiJobUpsertBulk) AddRetryCount(v int8) *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.AddRetryCount(v)
- })
- }
- // UpdateRetryCount sets the "retry_count" field to the value that was provided on create.
- func (u *CompapiJobUpsertBulk) UpdateRetryCount() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.UpdateRetryCount()
- })
- }
- // ClearRetryCount clears the value of the "retry_count" field.
- func (u *CompapiJobUpsertBulk) ClearRetryCount() *CompapiJobUpsertBulk {
- return u.Update(func(s *CompapiJobUpsert) {
- s.ClearRetryCount()
- })
- }
- // Exec executes the query.
- func (u *CompapiJobUpsertBulk) 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 CompapiJobCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for CompapiJobCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *CompapiJobUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|