12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/batchmsg"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // BatchMsgCreate is the builder for creating a BatchMsg entity.
- type BatchMsgCreate struct {
- config
- mutation *BatchMsgMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (bmc *BatchMsgCreate) SetCreatedAt(t time.Time) *BatchMsgCreate {
- bmc.mutation.SetCreatedAt(t)
- return bmc
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableCreatedAt(t *time.Time) *BatchMsgCreate {
- if t != nil {
- bmc.SetCreatedAt(*t)
- }
- return bmc
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (bmc *BatchMsgCreate) SetUpdatedAt(t time.Time) *BatchMsgCreate {
- bmc.mutation.SetUpdatedAt(t)
- return bmc
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableUpdatedAt(t *time.Time) *BatchMsgCreate {
- if t != nil {
- bmc.SetUpdatedAt(*t)
- }
- return bmc
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (bmc *BatchMsgCreate) SetDeletedAt(t time.Time) *BatchMsgCreate {
- bmc.mutation.SetDeletedAt(t)
- return bmc
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableDeletedAt(t *time.Time) *BatchMsgCreate {
- if t != nil {
- bmc.SetDeletedAt(*t)
- }
- return bmc
- }
- // SetStatus sets the "status" field.
- func (bmc *BatchMsgCreate) SetStatus(u uint8) *BatchMsgCreate {
- bmc.mutation.SetStatus(u)
- return bmc
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableStatus(u *uint8) *BatchMsgCreate {
- if u != nil {
- bmc.SetStatus(*u)
- }
- return bmc
- }
- // SetBatchNo sets the "batch_no" field.
- func (bmc *BatchMsgCreate) SetBatchNo(s string) *BatchMsgCreate {
- bmc.mutation.SetBatchNo(s)
- return bmc
- }
- // SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableBatchNo(s *string) *BatchMsgCreate {
- if s != nil {
- bmc.SetBatchNo(*s)
- }
- return bmc
- }
- // SetTaskName sets the "task_name" field.
- func (bmc *BatchMsgCreate) SetTaskName(s string) *BatchMsgCreate {
- bmc.mutation.SetTaskName(s)
- return bmc
- }
- // SetNillableTaskName sets the "task_name" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableTaskName(s *string) *BatchMsgCreate {
- if s != nil {
- bmc.SetTaskName(*s)
- }
- return bmc
- }
- // SetFromwxid sets the "fromwxid" field.
- func (bmc *BatchMsgCreate) SetFromwxid(s string) *BatchMsgCreate {
- bmc.mutation.SetFromwxid(s)
- return bmc
- }
- // SetNillableFromwxid sets the "fromwxid" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableFromwxid(s *string) *BatchMsgCreate {
- if s != nil {
- bmc.SetFromwxid(*s)
- }
- return bmc
- }
- // SetMsg sets the "msg" field.
- func (bmc *BatchMsgCreate) SetMsg(s string) *BatchMsgCreate {
- bmc.mutation.SetMsg(s)
- return bmc
- }
- // SetNillableMsg sets the "msg" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableMsg(s *string) *BatchMsgCreate {
- if s != nil {
- bmc.SetMsg(*s)
- }
- return bmc
- }
- // SetTag sets the "tag" field.
- func (bmc *BatchMsgCreate) SetTag(s string) *BatchMsgCreate {
- bmc.mutation.SetTag(s)
- return bmc
- }
- // SetNillableTag sets the "tag" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableTag(s *string) *BatchMsgCreate {
- if s != nil {
- bmc.SetTag(*s)
- }
- return bmc
- }
- // SetTagids sets the "tagids" field.
- func (bmc *BatchMsgCreate) SetTagids(s string) *BatchMsgCreate {
- bmc.mutation.SetTagids(s)
- return bmc
- }
- // SetNillableTagids sets the "tagids" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableTagids(s *string) *BatchMsgCreate {
- if s != nil {
- bmc.SetTagids(*s)
- }
- return bmc
- }
- // SetTotal sets the "total" field.
- func (bmc *BatchMsgCreate) SetTotal(i int32) *BatchMsgCreate {
- bmc.mutation.SetTotal(i)
- return bmc
- }
- // SetNillableTotal sets the "total" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableTotal(i *int32) *BatchMsgCreate {
- if i != nil {
- bmc.SetTotal(*i)
- }
- return bmc
- }
- // SetSuccess sets the "success" field.
- func (bmc *BatchMsgCreate) SetSuccess(i int32) *BatchMsgCreate {
- bmc.mutation.SetSuccess(i)
- return bmc
- }
- // SetNillableSuccess sets the "success" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableSuccess(i *int32) *BatchMsgCreate {
- if i != nil {
- bmc.SetSuccess(*i)
- }
- return bmc
- }
- // SetFail sets the "fail" field.
- func (bmc *BatchMsgCreate) SetFail(i int32) *BatchMsgCreate {
- bmc.mutation.SetFail(i)
- return bmc
- }
- // SetNillableFail sets the "fail" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableFail(i *int32) *BatchMsgCreate {
- if i != nil {
- bmc.SetFail(*i)
- }
- return bmc
- }
- // SetStartTime sets the "start_time" field.
- func (bmc *BatchMsgCreate) SetStartTime(t time.Time) *BatchMsgCreate {
- bmc.mutation.SetStartTime(t)
- return bmc
- }
- // SetNillableStartTime sets the "start_time" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableStartTime(t *time.Time) *BatchMsgCreate {
- if t != nil {
- bmc.SetStartTime(*t)
- }
- return bmc
- }
- // SetStopTime sets the "stop_time" field.
- func (bmc *BatchMsgCreate) SetStopTime(t time.Time) *BatchMsgCreate {
- bmc.mutation.SetStopTime(t)
- return bmc
- }
- // SetNillableStopTime sets the "stop_time" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableStopTime(t *time.Time) *BatchMsgCreate {
- if t != nil {
- bmc.SetStopTime(*t)
- }
- return bmc
- }
- // SetSendTime sets the "send_time" field.
- func (bmc *BatchMsgCreate) SetSendTime(t time.Time) *BatchMsgCreate {
- bmc.mutation.SetSendTime(t)
- return bmc
- }
- // SetNillableSendTime sets the "send_time" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableSendTime(t *time.Time) *BatchMsgCreate {
- if t != nil {
- bmc.SetSendTime(*t)
- }
- return bmc
- }
- // SetType sets the "type" field.
- func (bmc *BatchMsgCreate) SetType(i int32) *BatchMsgCreate {
- bmc.mutation.SetType(i)
- return bmc
- }
- // SetNillableType sets the "type" field if the given value is not nil.
- func (bmc *BatchMsgCreate) SetNillableType(i *int32) *BatchMsgCreate {
- if i != nil {
- bmc.SetType(*i)
- }
- return bmc
- }
- // SetOrganizationID sets the "organization_id" field.
- func (bmc *BatchMsgCreate) SetOrganizationID(u uint64) *BatchMsgCreate {
- bmc.mutation.SetOrganizationID(u)
- return bmc
- }
- // SetID sets the "id" field.
- func (bmc *BatchMsgCreate) SetID(u uint64) *BatchMsgCreate {
- bmc.mutation.SetID(u)
- return bmc
- }
- // Mutation returns the BatchMsgMutation object of the builder.
- func (bmc *BatchMsgCreate) Mutation() *BatchMsgMutation {
- return bmc.mutation
- }
- // Save creates the BatchMsg in the database.
- func (bmc *BatchMsgCreate) Save(ctx context.Context) (*BatchMsg, error) {
- if err := bmc.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, bmc.sqlSave, bmc.mutation, bmc.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (bmc *BatchMsgCreate) SaveX(ctx context.Context) *BatchMsg {
- v, err := bmc.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (bmc *BatchMsgCreate) Exec(ctx context.Context) error {
- _, err := bmc.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (bmc *BatchMsgCreate) ExecX(ctx context.Context) {
- if err := bmc.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (bmc *BatchMsgCreate) defaults() error {
- if _, ok := bmc.mutation.CreatedAt(); !ok {
- if batchmsg.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized batchmsg.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := batchmsg.DefaultCreatedAt()
- bmc.mutation.SetCreatedAt(v)
- }
- if _, ok := bmc.mutation.UpdatedAt(); !ok {
- if batchmsg.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized batchmsg.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := batchmsg.DefaultUpdatedAt()
- bmc.mutation.SetUpdatedAt(v)
- }
- if _, ok := bmc.mutation.TaskName(); !ok {
- v := batchmsg.DefaultTaskName
- bmc.mutation.SetTaskName(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (bmc *BatchMsgCreate) check() error {
- if _, ok := bmc.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "BatchMsg.created_at"`)}
- }
- if _, ok := bmc.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "BatchMsg.updated_at"`)}
- }
- if _, ok := bmc.mutation.OrganizationID(); !ok {
- return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "BatchMsg.organization_id"`)}
- }
- if v, ok := bmc.mutation.OrganizationID(); ok {
- if err := batchmsg.OrganizationIDValidator(v); err != nil {
- return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "BatchMsg.organization_id": %w`, err)}
- }
- }
- return nil
- }
- func (bmc *BatchMsgCreate) sqlSave(ctx context.Context) (*BatchMsg, error) {
- if err := bmc.check(); err != nil {
- return nil, err
- }
- _node, _spec := bmc.createSpec()
- if err := sqlgraph.CreateNode(ctx, bmc.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)
- }
- bmc.mutation.id = &_node.ID
- bmc.mutation.done = true
- return _node, nil
- }
- func (bmc *BatchMsgCreate) createSpec() (*BatchMsg, *sqlgraph.CreateSpec) {
- var (
- _node = &BatchMsg{config: bmc.config}
- _spec = sqlgraph.NewCreateSpec(batchmsg.Table, sqlgraph.NewFieldSpec(batchmsg.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = bmc.conflict
- if id, ok := bmc.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := bmc.mutation.CreatedAt(); ok {
- _spec.SetField(batchmsg.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := bmc.mutation.UpdatedAt(); ok {
- _spec.SetField(batchmsg.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := bmc.mutation.DeletedAt(); ok {
- _spec.SetField(batchmsg.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = value
- }
- if value, ok := bmc.mutation.Status(); ok {
- _spec.SetField(batchmsg.FieldStatus, field.TypeUint8, value)
- _node.Status = value
- }
- if value, ok := bmc.mutation.BatchNo(); ok {
- _spec.SetField(batchmsg.FieldBatchNo, field.TypeString, value)
- _node.BatchNo = value
- }
- if value, ok := bmc.mutation.TaskName(); ok {
- _spec.SetField(batchmsg.FieldTaskName, field.TypeString, value)
- _node.TaskName = value
- }
- if value, ok := bmc.mutation.Fromwxid(); ok {
- _spec.SetField(batchmsg.FieldFromwxid, field.TypeString, value)
- _node.Fromwxid = value
- }
- if value, ok := bmc.mutation.Msg(); ok {
- _spec.SetField(batchmsg.FieldMsg, field.TypeString, value)
- _node.Msg = value
- }
- if value, ok := bmc.mutation.Tag(); ok {
- _spec.SetField(batchmsg.FieldTag, field.TypeString, value)
- _node.Tag = value
- }
- if value, ok := bmc.mutation.Tagids(); ok {
- _spec.SetField(batchmsg.FieldTagids, field.TypeString, value)
- _node.Tagids = value
- }
- if value, ok := bmc.mutation.Total(); ok {
- _spec.SetField(batchmsg.FieldTotal, field.TypeInt32, value)
- _node.Total = value
- }
- if value, ok := bmc.mutation.Success(); ok {
- _spec.SetField(batchmsg.FieldSuccess, field.TypeInt32, value)
- _node.Success = value
- }
- if value, ok := bmc.mutation.Fail(); ok {
- _spec.SetField(batchmsg.FieldFail, field.TypeInt32, value)
- _node.Fail = value
- }
- if value, ok := bmc.mutation.StartTime(); ok {
- _spec.SetField(batchmsg.FieldStartTime, field.TypeTime, value)
- _node.StartTime = value
- }
- if value, ok := bmc.mutation.StopTime(); ok {
- _spec.SetField(batchmsg.FieldStopTime, field.TypeTime, value)
- _node.StopTime = value
- }
- if value, ok := bmc.mutation.SendTime(); ok {
- _spec.SetField(batchmsg.FieldSendTime, field.TypeTime, value)
- _node.SendTime = value
- }
- if value, ok := bmc.mutation.GetType(); ok {
- _spec.SetField(batchmsg.FieldType, field.TypeInt32, value)
- _node.Type = value
- }
- if value, ok := bmc.mutation.OrganizationID(); ok {
- _spec.SetField(batchmsg.FieldOrganizationID, field.TypeUint64, value)
- _node.OrganizationID = value
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.BatchMsg.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.BatchMsgUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (bmc *BatchMsgCreate) OnConflict(opts ...sql.ConflictOption) *BatchMsgUpsertOne {
- bmc.conflict = opts
- return &BatchMsgUpsertOne{
- create: bmc,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.BatchMsg.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (bmc *BatchMsgCreate) OnConflictColumns(columns ...string) *BatchMsgUpsertOne {
- bmc.conflict = append(bmc.conflict, sql.ConflictColumns(columns...))
- return &BatchMsgUpsertOne{
- create: bmc,
- }
- }
- type (
- // BatchMsgUpsertOne is the builder for "upsert"-ing
- // one BatchMsg node.
- BatchMsgUpsertOne struct {
- create *BatchMsgCreate
- }
- // BatchMsgUpsert is the "OnConflict" setter.
- BatchMsgUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *BatchMsgUpsert) SetUpdatedAt(v time.Time) *BatchMsgUpsert {
- u.Set(batchmsg.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateUpdatedAt() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldUpdatedAt)
- return u
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *BatchMsgUpsert) SetDeletedAt(v time.Time) *BatchMsgUpsert {
- u.Set(batchmsg.FieldDeletedAt, v)
- return u
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateDeletedAt() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldDeletedAt)
- return u
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *BatchMsgUpsert) ClearDeletedAt() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldDeletedAt)
- return u
- }
- // SetStatus sets the "status" field.
- func (u *BatchMsgUpsert) SetStatus(v uint8) *BatchMsgUpsert {
- u.Set(batchmsg.FieldStatus, v)
- return u
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateStatus() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldStatus)
- return u
- }
- // AddStatus adds v to the "status" field.
- func (u *BatchMsgUpsert) AddStatus(v uint8) *BatchMsgUpsert {
- u.Add(batchmsg.FieldStatus, v)
- return u
- }
- // ClearStatus clears the value of the "status" field.
- func (u *BatchMsgUpsert) ClearStatus() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldStatus)
- return u
- }
- // SetBatchNo sets the "batch_no" field.
- func (u *BatchMsgUpsert) SetBatchNo(v string) *BatchMsgUpsert {
- u.Set(batchmsg.FieldBatchNo, v)
- return u
- }
- // UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateBatchNo() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldBatchNo)
- return u
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (u *BatchMsgUpsert) ClearBatchNo() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldBatchNo)
- return u
- }
- // SetTaskName sets the "task_name" field.
- func (u *BatchMsgUpsert) SetTaskName(v string) *BatchMsgUpsert {
- u.Set(batchmsg.FieldTaskName, v)
- return u
- }
- // UpdateTaskName sets the "task_name" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateTaskName() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldTaskName)
- return u
- }
- // ClearTaskName clears the value of the "task_name" field.
- func (u *BatchMsgUpsert) ClearTaskName() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldTaskName)
- return u
- }
- // SetFromwxid sets the "fromwxid" field.
- func (u *BatchMsgUpsert) SetFromwxid(v string) *BatchMsgUpsert {
- u.Set(batchmsg.FieldFromwxid, v)
- return u
- }
- // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateFromwxid() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldFromwxid)
- return u
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (u *BatchMsgUpsert) ClearFromwxid() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldFromwxid)
- return u
- }
- // SetMsg sets the "msg" field.
- func (u *BatchMsgUpsert) SetMsg(v string) *BatchMsgUpsert {
- u.Set(batchmsg.FieldMsg, v)
- return u
- }
- // UpdateMsg sets the "msg" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateMsg() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldMsg)
- return u
- }
- // ClearMsg clears the value of the "msg" field.
- func (u *BatchMsgUpsert) ClearMsg() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldMsg)
- return u
- }
- // SetTag sets the "tag" field.
- func (u *BatchMsgUpsert) SetTag(v string) *BatchMsgUpsert {
- u.Set(batchmsg.FieldTag, v)
- return u
- }
- // UpdateTag sets the "tag" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateTag() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldTag)
- return u
- }
- // ClearTag clears the value of the "tag" field.
- func (u *BatchMsgUpsert) ClearTag() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldTag)
- return u
- }
- // SetTagids sets the "tagids" field.
- func (u *BatchMsgUpsert) SetTagids(v string) *BatchMsgUpsert {
- u.Set(batchmsg.FieldTagids, v)
- return u
- }
- // UpdateTagids sets the "tagids" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateTagids() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldTagids)
- return u
- }
- // ClearTagids clears the value of the "tagids" field.
- func (u *BatchMsgUpsert) ClearTagids() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldTagids)
- return u
- }
- // SetTotal sets the "total" field.
- func (u *BatchMsgUpsert) SetTotal(v int32) *BatchMsgUpsert {
- u.Set(batchmsg.FieldTotal, v)
- return u
- }
- // UpdateTotal sets the "total" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateTotal() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldTotal)
- return u
- }
- // AddTotal adds v to the "total" field.
- func (u *BatchMsgUpsert) AddTotal(v int32) *BatchMsgUpsert {
- u.Add(batchmsg.FieldTotal, v)
- return u
- }
- // ClearTotal clears the value of the "total" field.
- func (u *BatchMsgUpsert) ClearTotal() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldTotal)
- return u
- }
- // SetSuccess sets the "success" field.
- func (u *BatchMsgUpsert) SetSuccess(v int32) *BatchMsgUpsert {
- u.Set(batchmsg.FieldSuccess, v)
- return u
- }
- // UpdateSuccess sets the "success" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateSuccess() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldSuccess)
- return u
- }
- // AddSuccess adds v to the "success" field.
- func (u *BatchMsgUpsert) AddSuccess(v int32) *BatchMsgUpsert {
- u.Add(batchmsg.FieldSuccess, v)
- return u
- }
- // ClearSuccess clears the value of the "success" field.
- func (u *BatchMsgUpsert) ClearSuccess() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldSuccess)
- return u
- }
- // SetFail sets the "fail" field.
- func (u *BatchMsgUpsert) SetFail(v int32) *BatchMsgUpsert {
- u.Set(batchmsg.FieldFail, v)
- return u
- }
- // UpdateFail sets the "fail" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateFail() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldFail)
- return u
- }
- // AddFail adds v to the "fail" field.
- func (u *BatchMsgUpsert) AddFail(v int32) *BatchMsgUpsert {
- u.Add(batchmsg.FieldFail, v)
- return u
- }
- // ClearFail clears the value of the "fail" field.
- func (u *BatchMsgUpsert) ClearFail() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldFail)
- return u
- }
- // SetStartTime sets the "start_time" field.
- func (u *BatchMsgUpsert) SetStartTime(v time.Time) *BatchMsgUpsert {
- u.Set(batchmsg.FieldStartTime, v)
- return u
- }
- // UpdateStartTime sets the "start_time" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateStartTime() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldStartTime)
- return u
- }
- // ClearStartTime clears the value of the "start_time" field.
- func (u *BatchMsgUpsert) ClearStartTime() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldStartTime)
- return u
- }
- // SetStopTime sets the "stop_time" field.
- func (u *BatchMsgUpsert) SetStopTime(v time.Time) *BatchMsgUpsert {
- u.Set(batchmsg.FieldStopTime, v)
- return u
- }
- // UpdateStopTime sets the "stop_time" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateStopTime() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldStopTime)
- return u
- }
- // ClearStopTime clears the value of the "stop_time" field.
- func (u *BatchMsgUpsert) ClearStopTime() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldStopTime)
- return u
- }
- // SetSendTime sets the "send_time" field.
- func (u *BatchMsgUpsert) SetSendTime(v time.Time) *BatchMsgUpsert {
- u.Set(batchmsg.FieldSendTime, v)
- return u
- }
- // UpdateSendTime sets the "send_time" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateSendTime() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldSendTime)
- return u
- }
- // ClearSendTime clears the value of the "send_time" field.
- func (u *BatchMsgUpsert) ClearSendTime() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldSendTime)
- return u
- }
- // SetType sets the "type" field.
- func (u *BatchMsgUpsert) SetType(v int32) *BatchMsgUpsert {
- u.Set(batchmsg.FieldType, v)
- return u
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateType() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldType)
- return u
- }
- // AddType adds v to the "type" field.
- func (u *BatchMsgUpsert) AddType(v int32) *BatchMsgUpsert {
- u.Add(batchmsg.FieldType, v)
- return u
- }
- // ClearType clears the value of the "type" field.
- func (u *BatchMsgUpsert) ClearType() *BatchMsgUpsert {
- u.SetNull(batchmsg.FieldType)
- return u
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *BatchMsgUpsert) SetOrganizationID(v uint64) *BatchMsgUpsert {
- u.Set(batchmsg.FieldOrganizationID, v)
- return u
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *BatchMsgUpsert) UpdateOrganizationID() *BatchMsgUpsert {
- u.SetExcluded(batchmsg.FieldOrganizationID)
- return u
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *BatchMsgUpsert) AddOrganizationID(v uint64) *BatchMsgUpsert {
- u.Add(batchmsg.FieldOrganizationID, v)
- 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.BatchMsg.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(batchmsg.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *BatchMsgUpsertOne) UpdateNewValues() *BatchMsgUpsertOne {
- 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(batchmsg.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(batchmsg.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.BatchMsg.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *BatchMsgUpsertOne) Ignore() *BatchMsgUpsertOne {
- 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 *BatchMsgUpsertOne) DoNothing() *BatchMsgUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the BatchMsgCreate.OnConflict
- // documentation for more info.
- func (u *BatchMsgUpsertOne) Update(set func(*BatchMsgUpsert)) *BatchMsgUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&BatchMsgUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *BatchMsgUpsertOne) SetUpdatedAt(v time.Time) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateUpdatedAt() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *BatchMsgUpsertOne) SetDeletedAt(v time.Time) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateDeletedAt() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *BatchMsgUpsertOne) ClearDeletedAt() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *BatchMsgUpsertOne) SetStatus(v uint8) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *BatchMsgUpsertOne) AddStatus(v uint8) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateStatus() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *BatchMsgUpsertOne) ClearStatus() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearStatus()
- })
- }
- // SetBatchNo sets the "batch_no" field.
- func (u *BatchMsgUpsertOne) SetBatchNo(v string) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetBatchNo(v)
- })
- }
- // UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateBatchNo() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateBatchNo()
- })
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (u *BatchMsgUpsertOne) ClearBatchNo() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearBatchNo()
- })
- }
- // SetTaskName sets the "task_name" field.
- func (u *BatchMsgUpsertOne) SetTaskName(v string) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTaskName(v)
- })
- }
- // UpdateTaskName sets the "task_name" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateTaskName() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTaskName()
- })
- }
- // ClearTaskName clears the value of the "task_name" field.
- func (u *BatchMsgUpsertOne) ClearTaskName() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTaskName()
- })
- }
- // SetFromwxid sets the "fromwxid" field.
- func (u *BatchMsgUpsertOne) SetFromwxid(v string) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetFromwxid(v)
- })
- }
- // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateFromwxid() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateFromwxid()
- })
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (u *BatchMsgUpsertOne) ClearFromwxid() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearFromwxid()
- })
- }
- // SetMsg sets the "msg" field.
- func (u *BatchMsgUpsertOne) SetMsg(v string) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetMsg(v)
- })
- }
- // UpdateMsg sets the "msg" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateMsg() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateMsg()
- })
- }
- // ClearMsg clears the value of the "msg" field.
- func (u *BatchMsgUpsertOne) ClearMsg() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearMsg()
- })
- }
- // SetTag sets the "tag" field.
- func (u *BatchMsgUpsertOne) SetTag(v string) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTag(v)
- })
- }
- // UpdateTag sets the "tag" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateTag() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTag()
- })
- }
- // ClearTag clears the value of the "tag" field.
- func (u *BatchMsgUpsertOne) ClearTag() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTag()
- })
- }
- // SetTagids sets the "tagids" field.
- func (u *BatchMsgUpsertOne) SetTagids(v string) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTagids(v)
- })
- }
- // UpdateTagids sets the "tagids" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateTagids() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTagids()
- })
- }
- // ClearTagids clears the value of the "tagids" field.
- func (u *BatchMsgUpsertOne) ClearTagids() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTagids()
- })
- }
- // SetTotal sets the "total" field.
- func (u *BatchMsgUpsertOne) SetTotal(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTotal(v)
- })
- }
- // AddTotal adds v to the "total" field.
- func (u *BatchMsgUpsertOne) AddTotal(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddTotal(v)
- })
- }
- // UpdateTotal sets the "total" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateTotal() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTotal()
- })
- }
- // ClearTotal clears the value of the "total" field.
- func (u *BatchMsgUpsertOne) ClearTotal() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTotal()
- })
- }
- // SetSuccess sets the "success" field.
- func (u *BatchMsgUpsertOne) SetSuccess(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetSuccess(v)
- })
- }
- // AddSuccess adds v to the "success" field.
- func (u *BatchMsgUpsertOne) AddSuccess(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddSuccess(v)
- })
- }
- // UpdateSuccess sets the "success" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateSuccess() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateSuccess()
- })
- }
- // ClearSuccess clears the value of the "success" field.
- func (u *BatchMsgUpsertOne) ClearSuccess() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearSuccess()
- })
- }
- // SetFail sets the "fail" field.
- func (u *BatchMsgUpsertOne) SetFail(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetFail(v)
- })
- }
- // AddFail adds v to the "fail" field.
- func (u *BatchMsgUpsertOne) AddFail(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddFail(v)
- })
- }
- // UpdateFail sets the "fail" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateFail() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateFail()
- })
- }
- // ClearFail clears the value of the "fail" field.
- func (u *BatchMsgUpsertOne) ClearFail() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearFail()
- })
- }
- // SetStartTime sets the "start_time" field.
- func (u *BatchMsgUpsertOne) SetStartTime(v time.Time) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetStartTime(v)
- })
- }
- // UpdateStartTime sets the "start_time" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateStartTime() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateStartTime()
- })
- }
- // ClearStartTime clears the value of the "start_time" field.
- func (u *BatchMsgUpsertOne) ClearStartTime() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearStartTime()
- })
- }
- // SetStopTime sets the "stop_time" field.
- func (u *BatchMsgUpsertOne) SetStopTime(v time.Time) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetStopTime(v)
- })
- }
- // UpdateStopTime sets the "stop_time" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateStopTime() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateStopTime()
- })
- }
- // ClearStopTime clears the value of the "stop_time" field.
- func (u *BatchMsgUpsertOne) ClearStopTime() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearStopTime()
- })
- }
- // SetSendTime sets the "send_time" field.
- func (u *BatchMsgUpsertOne) SetSendTime(v time.Time) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetSendTime(v)
- })
- }
- // UpdateSendTime sets the "send_time" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateSendTime() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateSendTime()
- })
- }
- // ClearSendTime clears the value of the "send_time" field.
- func (u *BatchMsgUpsertOne) ClearSendTime() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearSendTime()
- })
- }
- // SetType sets the "type" field.
- func (u *BatchMsgUpsertOne) SetType(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetType(v)
- })
- }
- // AddType adds v to the "type" field.
- func (u *BatchMsgUpsertOne) AddType(v int32) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddType(v)
- })
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateType() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateType()
- })
- }
- // ClearType clears the value of the "type" field.
- func (u *BatchMsgUpsertOne) ClearType() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearType()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *BatchMsgUpsertOne) SetOrganizationID(v uint64) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *BatchMsgUpsertOne) AddOrganizationID(v uint64) *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *BatchMsgUpsertOne) UpdateOrganizationID() *BatchMsgUpsertOne {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // Exec executes the query.
- func (u *BatchMsgUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for BatchMsgCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *BatchMsgUpsertOne) 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 *BatchMsgUpsertOne) 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 *BatchMsgUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // BatchMsgCreateBulk is the builder for creating many BatchMsg entities in bulk.
- type BatchMsgCreateBulk struct {
- config
- err error
- builders []*BatchMsgCreate
- conflict []sql.ConflictOption
- }
- // Save creates the BatchMsg entities in the database.
- func (bmcb *BatchMsgCreateBulk) Save(ctx context.Context) ([]*BatchMsg, error) {
- if bmcb.err != nil {
- return nil, bmcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(bmcb.builders))
- nodes := make([]*BatchMsg, len(bmcb.builders))
- mutators := make([]Mutator, len(bmcb.builders))
- for i := range bmcb.builders {
- func(i int, root context.Context) {
- builder := bmcb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*BatchMsgMutation)
- 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, bmcb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = bmcb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, bmcb.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, bmcb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (bmcb *BatchMsgCreateBulk) SaveX(ctx context.Context) []*BatchMsg {
- v, err := bmcb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (bmcb *BatchMsgCreateBulk) Exec(ctx context.Context) error {
- _, err := bmcb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (bmcb *BatchMsgCreateBulk) ExecX(ctx context.Context) {
- if err := bmcb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.BatchMsg.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.BatchMsgUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (bmcb *BatchMsgCreateBulk) OnConflict(opts ...sql.ConflictOption) *BatchMsgUpsertBulk {
- bmcb.conflict = opts
- return &BatchMsgUpsertBulk{
- create: bmcb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.BatchMsg.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (bmcb *BatchMsgCreateBulk) OnConflictColumns(columns ...string) *BatchMsgUpsertBulk {
- bmcb.conflict = append(bmcb.conflict, sql.ConflictColumns(columns...))
- return &BatchMsgUpsertBulk{
- create: bmcb,
- }
- }
- // BatchMsgUpsertBulk is the builder for "upsert"-ing
- // a bulk of BatchMsg nodes.
- type BatchMsgUpsertBulk struct {
- create *BatchMsgCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.BatchMsg.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(batchmsg.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *BatchMsgUpsertBulk) UpdateNewValues() *BatchMsgUpsertBulk {
- 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(batchmsg.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(batchmsg.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.BatchMsg.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *BatchMsgUpsertBulk) Ignore() *BatchMsgUpsertBulk {
- 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 *BatchMsgUpsertBulk) DoNothing() *BatchMsgUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the BatchMsgCreateBulk.OnConflict
- // documentation for more info.
- func (u *BatchMsgUpsertBulk) Update(set func(*BatchMsgUpsert)) *BatchMsgUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&BatchMsgUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *BatchMsgUpsertBulk) SetUpdatedAt(v time.Time) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateUpdatedAt() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *BatchMsgUpsertBulk) SetDeletedAt(v time.Time) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateDeletedAt() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *BatchMsgUpsertBulk) ClearDeletedAt() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *BatchMsgUpsertBulk) SetStatus(v uint8) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *BatchMsgUpsertBulk) AddStatus(v uint8) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateStatus() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *BatchMsgUpsertBulk) ClearStatus() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearStatus()
- })
- }
- // SetBatchNo sets the "batch_no" field.
- func (u *BatchMsgUpsertBulk) SetBatchNo(v string) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetBatchNo(v)
- })
- }
- // UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateBatchNo() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateBatchNo()
- })
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (u *BatchMsgUpsertBulk) ClearBatchNo() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearBatchNo()
- })
- }
- // SetTaskName sets the "task_name" field.
- func (u *BatchMsgUpsertBulk) SetTaskName(v string) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTaskName(v)
- })
- }
- // UpdateTaskName sets the "task_name" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateTaskName() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTaskName()
- })
- }
- // ClearTaskName clears the value of the "task_name" field.
- func (u *BatchMsgUpsertBulk) ClearTaskName() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTaskName()
- })
- }
- // SetFromwxid sets the "fromwxid" field.
- func (u *BatchMsgUpsertBulk) SetFromwxid(v string) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetFromwxid(v)
- })
- }
- // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateFromwxid() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateFromwxid()
- })
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (u *BatchMsgUpsertBulk) ClearFromwxid() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearFromwxid()
- })
- }
- // SetMsg sets the "msg" field.
- func (u *BatchMsgUpsertBulk) SetMsg(v string) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetMsg(v)
- })
- }
- // UpdateMsg sets the "msg" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateMsg() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateMsg()
- })
- }
- // ClearMsg clears the value of the "msg" field.
- func (u *BatchMsgUpsertBulk) ClearMsg() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearMsg()
- })
- }
- // SetTag sets the "tag" field.
- func (u *BatchMsgUpsertBulk) SetTag(v string) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTag(v)
- })
- }
- // UpdateTag sets the "tag" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateTag() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTag()
- })
- }
- // ClearTag clears the value of the "tag" field.
- func (u *BatchMsgUpsertBulk) ClearTag() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTag()
- })
- }
- // SetTagids sets the "tagids" field.
- func (u *BatchMsgUpsertBulk) SetTagids(v string) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTagids(v)
- })
- }
- // UpdateTagids sets the "tagids" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateTagids() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTagids()
- })
- }
- // ClearTagids clears the value of the "tagids" field.
- func (u *BatchMsgUpsertBulk) ClearTagids() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTagids()
- })
- }
- // SetTotal sets the "total" field.
- func (u *BatchMsgUpsertBulk) SetTotal(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetTotal(v)
- })
- }
- // AddTotal adds v to the "total" field.
- func (u *BatchMsgUpsertBulk) AddTotal(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddTotal(v)
- })
- }
- // UpdateTotal sets the "total" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateTotal() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateTotal()
- })
- }
- // ClearTotal clears the value of the "total" field.
- func (u *BatchMsgUpsertBulk) ClearTotal() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearTotal()
- })
- }
- // SetSuccess sets the "success" field.
- func (u *BatchMsgUpsertBulk) SetSuccess(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetSuccess(v)
- })
- }
- // AddSuccess adds v to the "success" field.
- func (u *BatchMsgUpsertBulk) AddSuccess(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddSuccess(v)
- })
- }
- // UpdateSuccess sets the "success" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateSuccess() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateSuccess()
- })
- }
- // ClearSuccess clears the value of the "success" field.
- func (u *BatchMsgUpsertBulk) ClearSuccess() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearSuccess()
- })
- }
- // SetFail sets the "fail" field.
- func (u *BatchMsgUpsertBulk) SetFail(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetFail(v)
- })
- }
- // AddFail adds v to the "fail" field.
- func (u *BatchMsgUpsertBulk) AddFail(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddFail(v)
- })
- }
- // UpdateFail sets the "fail" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateFail() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateFail()
- })
- }
- // ClearFail clears the value of the "fail" field.
- func (u *BatchMsgUpsertBulk) ClearFail() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearFail()
- })
- }
- // SetStartTime sets the "start_time" field.
- func (u *BatchMsgUpsertBulk) SetStartTime(v time.Time) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetStartTime(v)
- })
- }
- // UpdateStartTime sets the "start_time" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateStartTime() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateStartTime()
- })
- }
- // ClearStartTime clears the value of the "start_time" field.
- func (u *BatchMsgUpsertBulk) ClearStartTime() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearStartTime()
- })
- }
- // SetStopTime sets the "stop_time" field.
- func (u *BatchMsgUpsertBulk) SetStopTime(v time.Time) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetStopTime(v)
- })
- }
- // UpdateStopTime sets the "stop_time" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateStopTime() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateStopTime()
- })
- }
- // ClearStopTime clears the value of the "stop_time" field.
- func (u *BatchMsgUpsertBulk) ClearStopTime() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearStopTime()
- })
- }
- // SetSendTime sets the "send_time" field.
- func (u *BatchMsgUpsertBulk) SetSendTime(v time.Time) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetSendTime(v)
- })
- }
- // UpdateSendTime sets the "send_time" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateSendTime() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateSendTime()
- })
- }
- // ClearSendTime clears the value of the "send_time" field.
- func (u *BatchMsgUpsertBulk) ClearSendTime() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearSendTime()
- })
- }
- // SetType sets the "type" field.
- func (u *BatchMsgUpsertBulk) SetType(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetType(v)
- })
- }
- // AddType adds v to the "type" field.
- func (u *BatchMsgUpsertBulk) AddType(v int32) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddType(v)
- })
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateType() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateType()
- })
- }
- // ClearType clears the value of the "type" field.
- func (u *BatchMsgUpsertBulk) ClearType() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.ClearType()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *BatchMsgUpsertBulk) SetOrganizationID(v uint64) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *BatchMsgUpsertBulk) AddOrganizationID(v uint64) *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *BatchMsgUpsertBulk) UpdateOrganizationID() *BatchMsgUpsertBulk {
- return u.Update(func(s *BatchMsgUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // Exec executes the query.
- func (u *BatchMsgUpsertBulk) 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 BatchMsgCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for BatchMsgCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *BatchMsgUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|