12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/contact"
- "wechat-api/ent/labelrelationship"
- "wechat-api/ent/messagerecords"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // ContactCreate is the builder for creating a Contact entity.
- type ContactCreate struct {
- config
- mutation *ContactMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (cc *ContactCreate) SetCreatedAt(t time.Time) *ContactCreate {
- cc.mutation.SetCreatedAt(t)
- return cc
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCreatedAt(t *time.Time) *ContactCreate {
- if t != nil {
- cc.SetCreatedAt(*t)
- }
- return cc
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (cc *ContactCreate) SetUpdatedAt(t time.Time) *ContactCreate {
- cc.mutation.SetUpdatedAt(t)
- return cc
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableUpdatedAt(t *time.Time) *ContactCreate {
- if t != nil {
- cc.SetUpdatedAt(*t)
- }
- return cc
- }
- // SetStatus sets the "status" field.
- func (cc *ContactCreate) SetStatus(u uint8) *ContactCreate {
- cc.mutation.SetStatus(u)
- return cc
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableStatus(u *uint8) *ContactCreate {
- if u != nil {
- cc.SetStatus(*u)
- }
- return cc
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (cc *ContactCreate) SetDeletedAt(t time.Time) *ContactCreate {
- cc.mutation.SetDeletedAt(t)
- return cc
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableDeletedAt(t *time.Time) *ContactCreate {
- if t != nil {
- cc.SetDeletedAt(*t)
- }
- return cc
- }
- // SetWxWxid sets the "wx_wxid" field.
- func (cc *ContactCreate) SetWxWxid(s string) *ContactCreate {
- cc.mutation.SetWxWxid(s)
- return cc
- }
- // SetNillableWxWxid sets the "wx_wxid" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableWxWxid(s *string) *ContactCreate {
- if s != nil {
- cc.SetWxWxid(*s)
- }
- return cc
- }
- // SetType sets the "type" field.
- func (cc *ContactCreate) SetType(i int) *ContactCreate {
- cc.mutation.SetType(i)
- return cc
- }
- // SetNillableType sets the "type" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableType(i *int) *ContactCreate {
- if i != nil {
- cc.SetType(*i)
- }
- return cc
- }
- // SetWxid sets the "wxid" field.
- func (cc *ContactCreate) SetWxid(s string) *ContactCreate {
- cc.mutation.SetWxid(s)
- return cc
- }
- // SetNillableWxid sets the "wxid" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableWxid(s *string) *ContactCreate {
- if s != nil {
- cc.SetWxid(*s)
- }
- return cc
- }
- // SetAccount sets the "account" field.
- func (cc *ContactCreate) SetAccount(s string) *ContactCreate {
- cc.mutation.SetAccount(s)
- return cc
- }
- // SetNillableAccount sets the "account" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableAccount(s *string) *ContactCreate {
- if s != nil {
- cc.SetAccount(*s)
- }
- return cc
- }
- // SetNickname sets the "nickname" field.
- func (cc *ContactCreate) SetNickname(s string) *ContactCreate {
- cc.mutation.SetNickname(s)
- return cc
- }
- // SetNillableNickname sets the "nickname" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableNickname(s *string) *ContactCreate {
- if s != nil {
- cc.SetNickname(*s)
- }
- return cc
- }
- // SetMarkname sets the "markname" field.
- func (cc *ContactCreate) SetMarkname(s string) *ContactCreate {
- cc.mutation.SetMarkname(s)
- return cc
- }
- // SetNillableMarkname sets the "markname" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableMarkname(s *string) *ContactCreate {
- if s != nil {
- cc.SetMarkname(*s)
- }
- return cc
- }
- // SetHeadimg sets the "headimg" field.
- func (cc *ContactCreate) SetHeadimg(s string) *ContactCreate {
- cc.mutation.SetHeadimg(s)
- return cc
- }
- // SetNillableHeadimg sets the "headimg" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableHeadimg(s *string) *ContactCreate {
- if s != nil {
- cc.SetHeadimg(*s)
- }
- return cc
- }
- // SetSex sets the "sex" field.
- func (cc *ContactCreate) SetSex(i int) *ContactCreate {
- cc.mutation.SetSex(i)
- return cc
- }
- // SetNillableSex sets the "sex" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableSex(i *int) *ContactCreate {
- if i != nil {
- cc.SetSex(*i)
- }
- return cc
- }
- // SetStarrole sets the "starrole" field.
- func (cc *ContactCreate) SetStarrole(s string) *ContactCreate {
- cc.mutation.SetStarrole(s)
- return cc
- }
- // SetNillableStarrole sets the "starrole" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableStarrole(s *string) *ContactCreate {
- if s != nil {
- cc.SetStarrole(*s)
- }
- return cc
- }
- // SetDontseeit sets the "dontseeit" field.
- func (cc *ContactCreate) SetDontseeit(i int) *ContactCreate {
- cc.mutation.SetDontseeit(i)
- return cc
- }
- // SetNillableDontseeit sets the "dontseeit" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableDontseeit(i *int) *ContactCreate {
- if i != nil {
- cc.SetDontseeit(*i)
- }
- return cc
- }
- // SetDontseeme sets the "dontseeme" field.
- func (cc *ContactCreate) SetDontseeme(i int) *ContactCreate {
- cc.mutation.SetDontseeme(i)
- return cc
- }
- // SetNillableDontseeme sets the "dontseeme" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableDontseeme(i *int) *ContactCreate {
- if i != nil {
- cc.SetDontseeme(*i)
- }
- return cc
- }
- // SetLag sets the "lag" field.
- func (cc *ContactCreate) SetLag(s string) *ContactCreate {
- cc.mutation.SetLag(s)
- return cc
- }
- // SetNillableLag sets the "lag" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableLag(s *string) *ContactCreate {
- if s != nil {
- cc.SetLag(*s)
- }
- return cc
- }
- // SetGid sets the "gid" field.
- func (cc *ContactCreate) SetGid(s string) *ContactCreate {
- cc.mutation.SetGid(s)
- return cc
- }
- // SetNillableGid sets the "gid" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableGid(s *string) *ContactCreate {
- if s != nil {
- cc.SetGid(*s)
- }
- return cc
- }
- // SetGname sets the "gname" field.
- func (cc *ContactCreate) SetGname(s string) *ContactCreate {
- cc.mutation.SetGname(s)
- return cc
- }
- // SetNillableGname sets the "gname" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableGname(s *string) *ContactCreate {
- if s != nil {
- cc.SetGname(*s)
- }
- return cc
- }
- // SetV3 sets the "v3" field.
- func (cc *ContactCreate) SetV3(s string) *ContactCreate {
- cc.mutation.SetV3(s)
- return cc
- }
- // SetNillableV3 sets the "v3" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableV3(s *string) *ContactCreate {
- if s != nil {
- cc.SetV3(*s)
- }
- return cc
- }
- // SetOrganizationID sets the "organization_id" field.
- func (cc *ContactCreate) SetOrganizationID(u uint64) *ContactCreate {
- cc.mutation.SetOrganizationID(u)
- return cc
- }
- // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableOrganizationID(u *uint64) *ContactCreate {
- if u != nil {
- cc.SetOrganizationID(*u)
- }
- return cc
- }
- // SetCtype sets the "ctype" field.
- func (cc *ContactCreate) SetCtype(u uint64) *ContactCreate {
- cc.mutation.SetCtype(u)
- return cc
- }
- // SetNillableCtype sets the "ctype" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCtype(u *uint64) *ContactCreate {
- if u != nil {
- cc.SetCtype(*u)
- }
- return cc
- }
- // SetCage sets the "cage" field.
- func (cc *ContactCreate) SetCage(i int) *ContactCreate {
- cc.mutation.SetCage(i)
- return cc
- }
- // SetNillableCage sets the "cage" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCage(i *int) *ContactCreate {
- if i != nil {
- cc.SetCage(*i)
- }
- return cc
- }
- // SetCname sets the "cname" field.
- func (cc *ContactCreate) SetCname(s string) *ContactCreate {
- cc.mutation.SetCname(s)
- return cc
- }
- // SetNillableCname sets the "cname" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCname(s *string) *ContactCreate {
- if s != nil {
- cc.SetCname(*s)
- }
- return cc
- }
- // SetCarea sets the "carea" field.
- func (cc *ContactCreate) SetCarea(s string) *ContactCreate {
- cc.mutation.SetCarea(s)
- return cc
- }
- // SetNillableCarea sets the "carea" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCarea(s *string) *ContactCreate {
- if s != nil {
- cc.SetCarea(*s)
- }
- return cc
- }
- // SetCbirthday sets the "cbirthday" field.
- func (cc *ContactCreate) SetCbirthday(s string) *ContactCreate {
- cc.mutation.SetCbirthday(s)
- return cc
- }
- // SetNillableCbirthday sets the "cbirthday" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCbirthday(s *string) *ContactCreate {
- if s != nil {
- cc.SetCbirthday(*s)
- }
- return cc
- }
- // SetCbirtharea sets the "cbirtharea" field.
- func (cc *ContactCreate) SetCbirtharea(s string) *ContactCreate {
- cc.mutation.SetCbirtharea(s)
- return cc
- }
- // SetNillableCbirtharea sets the "cbirtharea" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCbirtharea(s *string) *ContactCreate {
- if s != nil {
- cc.SetCbirtharea(*s)
- }
- return cc
- }
- // SetCidcardNo sets the "cidcard_no" field.
- func (cc *ContactCreate) SetCidcardNo(s string) *ContactCreate {
- cc.mutation.SetCidcardNo(s)
- return cc
- }
- // SetNillableCidcardNo sets the "cidcard_no" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCidcardNo(s *string) *ContactCreate {
- if s != nil {
- cc.SetCidcardNo(*s)
- }
- return cc
- }
- // SetCtitle sets the "ctitle" field.
- func (cc *ContactCreate) SetCtitle(s string) *ContactCreate {
- cc.mutation.SetCtitle(s)
- return cc
- }
- // SetNillableCtitle sets the "ctitle" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCtitle(s *string) *ContactCreate {
- if s != nil {
- cc.SetCtitle(*s)
- }
- return cc
- }
- // SetCc sets the "cc" field.
- func (cc *ContactCreate) SetCc(s string) *ContactCreate {
- cc.mutation.SetCc(s)
- return cc
- }
- // SetNillableCc sets the "cc" field if the given value is not nil.
- func (cc *ContactCreate) SetNillableCc(s *string) *ContactCreate {
- if s != nil {
- cc.SetCc(*s)
- }
- return cc
- }
- // SetPhone sets the "phone" field.
- func (cc *ContactCreate) SetPhone(s string) *ContactCreate {
- cc.mutation.SetPhone(s)
- return cc
- }
- // SetNillablePhone sets the "phone" field if the given value is not nil.
- func (cc *ContactCreate) SetNillablePhone(s *string) *ContactCreate {
- if s != nil {
- cc.SetPhone(*s)
- }
- return cc
- }
- // SetID sets the "id" field.
- func (cc *ContactCreate) SetID(u uint64) *ContactCreate {
- cc.mutation.SetID(u)
- return cc
- }
- // AddContactRelationshipIDs adds the "contact_relationships" edge to the LabelRelationship entity by IDs.
- func (cc *ContactCreate) AddContactRelationshipIDs(ids ...uint64) *ContactCreate {
- cc.mutation.AddContactRelationshipIDs(ids...)
- return cc
- }
- // AddContactRelationships adds the "contact_relationships" edges to the LabelRelationship entity.
- func (cc *ContactCreate) AddContactRelationships(l ...*LabelRelationship) *ContactCreate {
- ids := make([]uint64, len(l))
- for i := range l {
- ids[i] = l[i].ID
- }
- return cc.AddContactRelationshipIDs(ids...)
- }
- // AddContactMessageIDs adds the "contact_messages" edge to the MessageRecords entity by IDs.
- func (cc *ContactCreate) AddContactMessageIDs(ids ...uint64) *ContactCreate {
- cc.mutation.AddContactMessageIDs(ids...)
- return cc
- }
- // AddContactMessages adds the "contact_messages" edges to the MessageRecords entity.
- func (cc *ContactCreate) AddContactMessages(m ...*MessageRecords) *ContactCreate {
- ids := make([]uint64, len(m))
- for i := range m {
- ids[i] = m[i].ID
- }
- return cc.AddContactMessageIDs(ids...)
- }
- // Mutation returns the ContactMutation object of the builder.
- func (cc *ContactCreate) Mutation() *ContactMutation {
- return cc.mutation
- }
- // Save creates the Contact in the database.
- func (cc *ContactCreate) Save(ctx context.Context) (*Contact, error) {
- if err := cc.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, cc.sqlSave, cc.mutation, cc.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (cc *ContactCreate) SaveX(ctx context.Context) *Contact {
- v, err := cc.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (cc *ContactCreate) Exec(ctx context.Context) error {
- _, err := cc.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (cc *ContactCreate) ExecX(ctx context.Context) {
- if err := cc.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (cc *ContactCreate) defaults() error {
- if _, ok := cc.mutation.CreatedAt(); !ok {
- if contact.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized contact.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := contact.DefaultCreatedAt()
- cc.mutation.SetCreatedAt(v)
- }
- if _, ok := cc.mutation.UpdatedAt(); !ok {
- if contact.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized contact.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := contact.DefaultUpdatedAt()
- cc.mutation.SetUpdatedAt(v)
- }
- if _, ok := cc.mutation.Status(); !ok {
- v := contact.DefaultStatus
- cc.mutation.SetStatus(v)
- }
- if _, ok := cc.mutation.WxWxid(); !ok {
- v := contact.DefaultWxWxid
- cc.mutation.SetWxWxid(v)
- }
- if _, ok := cc.mutation.GetType(); !ok {
- v := contact.DefaultType
- cc.mutation.SetType(v)
- }
- if _, ok := cc.mutation.Wxid(); !ok {
- v := contact.DefaultWxid
- cc.mutation.SetWxid(v)
- }
- if _, ok := cc.mutation.Account(); !ok {
- v := contact.DefaultAccount
- cc.mutation.SetAccount(v)
- }
- if _, ok := cc.mutation.Nickname(); !ok {
- v := contact.DefaultNickname
- cc.mutation.SetNickname(v)
- }
- if _, ok := cc.mutation.Markname(); !ok {
- v := contact.DefaultMarkname
- cc.mutation.SetMarkname(v)
- }
- if _, ok := cc.mutation.Headimg(); !ok {
- v := contact.DefaultHeadimg
- cc.mutation.SetHeadimg(v)
- }
- if _, ok := cc.mutation.Sex(); !ok {
- v := contact.DefaultSex
- cc.mutation.SetSex(v)
- }
- if _, ok := cc.mutation.Starrole(); !ok {
- v := contact.DefaultStarrole
- cc.mutation.SetStarrole(v)
- }
- if _, ok := cc.mutation.Dontseeit(); !ok {
- v := contact.DefaultDontseeit
- cc.mutation.SetDontseeit(v)
- }
- if _, ok := cc.mutation.Dontseeme(); !ok {
- v := contact.DefaultDontseeme
- cc.mutation.SetDontseeme(v)
- }
- if _, ok := cc.mutation.Lag(); !ok {
- v := contact.DefaultLag
- cc.mutation.SetLag(v)
- }
- if _, ok := cc.mutation.Gid(); !ok {
- v := contact.DefaultGid
- cc.mutation.SetGid(v)
- }
- if _, ok := cc.mutation.Gname(); !ok {
- v := contact.DefaultGname
- cc.mutation.SetGname(v)
- }
- if _, ok := cc.mutation.V3(); !ok {
- v := contact.DefaultV3
- cc.mutation.SetV3(v)
- }
- if _, ok := cc.mutation.OrganizationID(); !ok {
- v := contact.DefaultOrganizationID
- cc.mutation.SetOrganizationID(v)
- }
- if _, ok := cc.mutation.Ctype(); !ok {
- v := contact.DefaultCtype
- cc.mutation.SetCtype(v)
- }
- if _, ok := cc.mutation.Cage(); !ok {
- v := contact.DefaultCage
- cc.mutation.SetCage(v)
- }
- if _, ok := cc.mutation.Cname(); !ok {
- v := contact.DefaultCname
- cc.mutation.SetCname(v)
- }
- if _, ok := cc.mutation.Carea(); !ok {
- v := contact.DefaultCarea
- cc.mutation.SetCarea(v)
- }
- if _, ok := cc.mutation.Cbirthday(); !ok {
- v := contact.DefaultCbirthday
- cc.mutation.SetCbirthday(v)
- }
- if _, ok := cc.mutation.Cbirtharea(); !ok {
- v := contact.DefaultCbirtharea
- cc.mutation.SetCbirtharea(v)
- }
- if _, ok := cc.mutation.CidcardNo(); !ok {
- v := contact.DefaultCidcardNo
- cc.mutation.SetCidcardNo(v)
- }
- if _, ok := cc.mutation.Ctitle(); !ok {
- v := contact.DefaultCtitle
- cc.mutation.SetCtitle(v)
- }
- if _, ok := cc.mutation.Cc(); !ok {
- v := contact.DefaultCc
- cc.mutation.SetCc(v)
- }
- if _, ok := cc.mutation.Phone(); !ok {
- v := contact.DefaultPhone
- cc.mutation.SetPhone(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (cc *ContactCreate) check() error {
- if _, ok := cc.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Contact.created_at"`)}
- }
- if _, ok := cc.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Contact.updated_at"`)}
- }
- if _, ok := cc.mutation.WxWxid(); !ok {
- return &ValidationError{Name: "wx_wxid", err: errors.New(`ent: missing required field "Contact.wx_wxid"`)}
- }
- if _, ok := cc.mutation.Wxid(); !ok {
- return &ValidationError{Name: "wxid", err: errors.New(`ent: missing required field "Contact.wxid"`)}
- }
- if _, ok := cc.mutation.Account(); !ok {
- return &ValidationError{Name: "account", err: errors.New(`ent: missing required field "Contact.account"`)}
- }
- if _, ok := cc.mutation.Nickname(); !ok {
- return &ValidationError{Name: "nickname", err: errors.New(`ent: missing required field "Contact.nickname"`)}
- }
- if _, ok := cc.mutation.Markname(); !ok {
- return &ValidationError{Name: "markname", err: errors.New(`ent: missing required field "Contact.markname"`)}
- }
- if _, ok := cc.mutation.Headimg(); !ok {
- return &ValidationError{Name: "headimg", err: errors.New(`ent: missing required field "Contact.headimg"`)}
- }
- if _, ok := cc.mutation.Sex(); !ok {
- return &ValidationError{Name: "sex", err: errors.New(`ent: missing required field "Contact.sex"`)}
- }
- if _, ok := cc.mutation.Starrole(); !ok {
- return &ValidationError{Name: "starrole", err: errors.New(`ent: missing required field "Contact.starrole"`)}
- }
- if _, ok := cc.mutation.Dontseeit(); !ok {
- return &ValidationError{Name: "dontseeit", err: errors.New(`ent: missing required field "Contact.dontseeit"`)}
- }
- if _, ok := cc.mutation.Dontseeme(); !ok {
- return &ValidationError{Name: "dontseeme", err: errors.New(`ent: missing required field "Contact.dontseeme"`)}
- }
- if _, ok := cc.mutation.Lag(); !ok {
- return &ValidationError{Name: "lag", err: errors.New(`ent: missing required field "Contact.lag"`)}
- }
- if _, ok := cc.mutation.Gid(); !ok {
- return &ValidationError{Name: "gid", err: errors.New(`ent: missing required field "Contact.gid"`)}
- }
- if _, ok := cc.mutation.Gname(); !ok {
- return &ValidationError{Name: "gname", err: errors.New(`ent: missing required field "Contact.gname"`)}
- }
- if _, ok := cc.mutation.V3(); !ok {
- return &ValidationError{Name: "v3", err: errors.New(`ent: missing required field "Contact.v3"`)}
- }
- if _, ok := cc.mutation.Ctype(); !ok {
- return &ValidationError{Name: "ctype", err: errors.New(`ent: missing required field "Contact.ctype"`)}
- }
- if _, ok := cc.mutation.Cage(); !ok {
- return &ValidationError{Name: "cage", err: errors.New(`ent: missing required field "Contact.cage"`)}
- }
- if _, ok := cc.mutation.Cname(); !ok {
- return &ValidationError{Name: "cname", err: errors.New(`ent: missing required field "Contact.cname"`)}
- }
- if _, ok := cc.mutation.Carea(); !ok {
- return &ValidationError{Name: "carea", err: errors.New(`ent: missing required field "Contact.carea"`)}
- }
- if _, ok := cc.mutation.Cbirthday(); !ok {
- return &ValidationError{Name: "cbirthday", err: errors.New(`ent: missing required field "Contact.cbirthday"`)}
- }
- if _, ok := cc.mutation.Cbirtharea(); !ok {
- return &ValidationError{Name: "cbirtharea", err: errors.New(`ent: missing required field "Contact.cbirtharea"`)}
- }
- if _, ok := cc.mutation.CidcardNo(); !ok {
- return &ValidationError{Name: "cidcard_no", err: errors.New(`ent: missing required field "Contact.cidcard_no"`)}
- }
- if _, ok := cc.mutation.Ctitle(); !ok {
- return &ValidationError{Name: "ctitle", err: errors.New(`ent: missing required field "Contact.ctitle"`)}
- }
- if _, ok := cc.mutation.Cc(); !ok {
- return &ValidationError{Name: "cc", err: errors.New(`ent: missing required field "Contact.cc"`)}
- }
- if _, ok := cc.mutation.Phone(); !ok {
- return &ValidationError{Name: "phone", err: errors.New(`ent: missing required field "Contact.phone"`)}
- }
- return nil
- }
- func (cc *ContactCreate) sqlSave(ctx context.Context) (*Contact, error) {
- if err := cc.check(); err != nil {
- return nil, err
- }
- _node, _spec := cc.createSpec()
- if err := sqlgraph.CreateNode(ctx, cc.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)
- }
- cc.mutation.id = &_node.ID
- cc.mutation.done = true
- return _node, nil
- }
- func (cc *ContactCreate) createSpec() (*Contact, *sqlgraph.CreateSpec) {
- var (
- _node = &Contact{config: cc.config}
- _spec = sqlgraph.NewCreateSpec(contact.Table, sqlgraph.NewFieldSpec(contact.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = cc.conflict
- if id, ok := cc.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := cc.mutation.CreatedAt(); ok {
- _spec.SetField(contact.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := cc.mutation.UpdatedAt(); ok {
- _spec.SetField(contact.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := cc.mutation.Status(); ok {
- _spec.SetField(contact.FieldStatus, field.TypeUint8, value)
- _node.Status = value
- }
- if value, ok := cc.mutation.DeletedAt(); ok {
- _spec.SetField(contact.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = value
- }
- if value, ok := cc.mutation.WxWxid(); ok {
- _spec.SetField(contact.FieldWxWxid, field.TypeString, value)
- _node.WxWxid = value
- }
- if value, ok := cc.mutation.GetType(); ok {
- _spec.SetField(contact.FieldType, field.TypeInt, value)
- _node.Type = value
- }
- if value, ok := cc.mutation.Wxid(); ok {
- _spec.SetField(contact.FieldWxid, field.TypeString, value)
- _node.Wxid = value
- }
- if value, ok := cc.mutation.Account(); ok {
- _spec.SetField(contact.FieldAccount, field.TypeString, value)
- _node.Account = value
- }
- if value, ok := cc.mutation.Nickname(); ok {
- _spec.SetField(contact.FieldNickname, field.TypeString, value)
- _node.Nickname = value
- }
- if value, ok := cc.mutation.Markname(); ok {
- _spec.SetField(contact.FieldMarkname, field.TypeString, value)
- _node.Markname = value
- }
- if value, ok := cc.mutation.Headimg(); ok {
- _spec.SetField(contact.FieldHeadimg, field.TypeString, value)
- _node.Headimg = value
- }
- if value, ok := cc.mutation.Sex(); ok {
- _spec.SetField(contact.FieldSex, field.TypeInt, value)
- _node.Sex = value
- }
- if value, ok := cc.mutation.Starrole(); ok {
- _spec.SetField(contact.FieldStarrole, field.TypeString, value)
- _node.Starrole = value
- }
- if value, ok := cc.mutation.Dontseeit(); ok {
- _spec.SetField(contact.FieldDontseeit, field.TypeInt, value)
- _node.Dontseeit = value
- }
- if value, ok := cc.mutation.Dontseeme(); ok {
- _spec.SetField(contact.FieldDontseeme, field.TypeInt, value)
- _node.Dontseeme = value
- }
- if value, ok := cc.mutation.Lag(); ok {
- _spec.SetField(contact.FieldLag, field.TypeString, value)
- _node.Lag = value
- }
- if value, ok := cc.mutation.Gid(); ok {
- _spec.SetField(contact.FieldGid, field.TypeString, value)
- _node.Gid = value
- }
- if value, ok := cc.mutation.Gname(); ok {
- _spec.SetField(contact.FieldGname, field.TypeString, value)
- _node.Gname = value
- }
- if value, ok := cc.mutation.V3(); ok {
- _spec.SetField(contact.FieldV3, field.TypeString, value)
- _node.V3 = value
- }
- if value, ok := cc.mutation.OrganizationID(); ok {
- _spec.SetField(contact.FieldOrganizationID, field.TypeUint64, value)
- _node.OrganizationID = value
- }
- if value, ok := cc.mutation.Ctype(); ok {
- _spec.SetField(contact.FieldCtype, field.TypeUint64, value)
- _node.Ctype = value
- }
- if value, ok := cc.mutation.Cage(); ok {
- _spec.SetField(contact.FieldCage, field.TypeInt, value)
- _node.Cage = value
- }
- if value, ok := cc.mutation.Cname(); ok {
- _spec.SetField(contact.FieldCname, field.TypeString, value)
- _node.Cname = value
- }
- if value, ok := cc.mutation.Carea(); ok {
- _spec.SetField(contact.FieldCarea, field.TypeString, value)
- _node.Carea = value
- }
- if value, ok := cc.mutation.Cbirthday(); ok {
- _spec.SetField(contact.FieldCbirthday, field.TypeString, value)
- _node.Cbirthday = value
- }
- if value, ok := cc.mutation.Cbirtharea(); ok {
- _spec.SetField(contact.FieldCbirtharea, field.TypeString, value)
- _node.Cbirtharea = value
- }
- if value, ok := cc.mutation.CidcardNo(); ok {
- _spec.SetField(contact.FieldCidcardNo, field.TypeString, value)
- _node.CidcardNo = value
- }
- if value, ok := cc.mutation.Ctitle(); ok {
- _spec.SetField(contact.FieldCtitle, field.TypeString, value)
- _node.Ctitle = value
- }
- if value, ok := cc.mutation.Cc(); ok {
- _spec.SetField(contact.FieldCc, field.TypeString, value)
- _node.Cc = value
- }
- if value, ok := cc.mutation.Phone(); ok {
- _spec.SetField(contact.FieldPhone, field.TypeString, value)
- _node.Phone = value
- }
- if nodes := cc.mutation.ContactRelationshipsIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: contact.ContactRelationshipsTable,
- Columns: []string{contact.ContactRelationshipsColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(labelrelationship.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := cc.mutation.ContactMessagesIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: contact.ContactMessagesTable,
- Columns: []string{contact.ContactMessagesColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(messagerecords.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Contact.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.ContactUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (cc *ContactCreate) OnConflict(opts ...sql.ConflictOption) *ContactUpsertOne {
- cc.conflict = opts
- return &ContactUpsertOne{
- create: cc,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Contact.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (cc *ContactCreate) OnConflictColumns(columns ...string) *ContactUpsertOne {
- cc.conflict = append(cc.conflict, sql.ConflictColumns(columns...))
- return &ContactUpsertOne{
- create: cc,
- }
- }
- type (
- // ContactUpsertOne is the builder for "upsert"-ing
- // one Contact node.
- ContactUpsertOne struct {
- create *ContactCreate
- }
- // ContactUpsert is the "OnConflict" setter.
- ContactUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *ContactUpsert) SetUpdatedAt(v time.Time) *ContactUpsert {
- u.Set(contact.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateUpdatedAt() *ContactUpsert {
- u.SetExcluded(contact.FieldUpdatedAt)
- return u
- }
- // SetStatus sets the "status" field.
- func (u *ContactUpsert) SetStatus(v uint8) *ContactUpsert {
- u.Set(contact.FieldStatus, v)
- return u
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateStatus() *ContactUpsert {
- u.SetExcluded(contact.FieldStatus)
- return u
- }
- // AddStatus adds v to the "status" field.
- func (u *ContactUpsert) AddStatus(v uint8) *ContactUpsert {
- u.Add(contact.FieldStatus, v)
- return u
- }
- // ClearStatus clears the value of the "status" field.
- func (u *ContactUpsert) ClearStatus() *ContactUpsert {
- u.SetNull(contact.FieldStatus)
- return u
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *ContactUpsert) SetDeletedAt(v time.Time) *ContactUpsert {
- u.Set(contact.FieldDeletedAt, v)
- return u
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateDeletedAt() *ContactUpsert {
- u.SetExcluded(contact.FieldDeletedAt)
- return u
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *ContactUpsert) ClearDeletedAt() *ContactUpsert {
- u.SetNull(contact.FieldDeletedAt)
- return u
- }
- // SetWxWxid sets the "wx_wxid" field.
- func (u *ContactUpsert) SetWxWxid(v string) *ContactUpsert {
- u.Set(contact.FieldWxWxid, v)
- return u
- }
- // UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateWxWxid() *ContactUpsert {
- u.SetExcluded(contact.FieldWxWxid)
- return u
- }
- // SetType sets the "type" field.
- func (u *ContactUpsert) SetType(v int) *ContactUpsert {
- u.Set(contact.FieldType, v)
- return u
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateType() *ContactUpsert {
- u.SetExcluded(contact.FieldType)
- return u
- }
- // AddType adds v to the "type" field.
- func (u *ContactUpsert) AddType(v int) *ContactUpsert {
- u.Add(contact.FieldType, v)
- return u
- }
- // ClearType clears the value of the "type" field.
- func (u *ContactUpsert) ClearType() *ContactUpsert {
- u.SetNull(contact.FieldType)
- return u
- }
- // SetWxid sets the "wxid" field.
- func (u *ContactUpsert) SetWxid(v string) *ContactUpsert {
- u.Set(contact.FieldWxid, v)
- return u
- }
- // UpdateWxid sets the "wxid" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateWxid() *ContactUpsert {
- u.SetExcluded(contact.FieldWxid)
- return u
- }
- // SetAccount sets the "account" field.
- func (u *ContactUpsert) SetAccount(v string) *ContactUpsert {
- u.Set(contact.FieldAccount, v)
- return u
- }
- // UpdateAccount sets the "account" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateAccount() *ContactUpsert {
- u.SetExcluded(contact.FieldAccount)
- return u
- }
- // SetNickname sets the "nickname" field.
- func (u *ContactUpsert) SetNickname(v string) *ContactUpsert {
- u.Set(contact.FieldNickname, v)
- return u
- }
- // UpdateNickname sets the "nickname" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateNickname() *ContactUpsert {
- u.SetExcluded(contact.FieldNickname)
- return u
- }
- // SetMarkname sets the "markname" field.
- func (u *ContactUpsert) SetMarkname(v string) *ContactUpsert {
- u.Set(contact.FieldMarkname, v)
- return u
- }
- // UpdateMarkname sets the "markname" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateMarkname() *ContactUpsert {
- u.SetExcluded(contact.FieldMarkname)
- return u
- }
- // SetHeadimg sets the "headimg" field.
- func (u *ContactUpsert) SetHeadimg(v string) *ContactUpsert {
- u.Set(contact.FieldHeadimg, v)
- return u
- }
- // UpdateHeadimg sets the "headimg" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateHeadimg() *ContactUpsert {
- u.SetExcluded(contact.FieldHeadimg)
- return u
- }
- // SetSex sets the "sex" field.
- func (u *ContactUpsert) SetSex(v int) *ContactUpsert {
- u.Set(contact.FieldSex, v)
- return u
- }
- // UpdateSex sets the "sex" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateSex() *ContactUpsert {
- u.SetExcluded(contact.FieldSex)
- return u
- }
- // AddSex adds v to the "sex" field.
- func (u *ContactUpsert) AddSex(v int) *ContactUpsert {
- u.Add(contact.FieldSex, v)
- return u
- }
- // SetStarrole sets the "starrole" field.
- func (u *ContactUpsert) SetStarrole(v string) *ContactUpsert {
- u.Set(contact.FieldStarrole, v)
- return u
- }
- // UpdateStarrole sets the "starrole" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateStarrole() *ContactUpsert {
- u.SetExcluded(contact.FieldStarrole)
- return u
- }
- // SetDontseeit sets the "dontseeit" field.
- func (u *ContactUpsert) SetDontseeit(v int) *ContactUpsert {
- u.Set(contact.FieldDontseeit, v)
- return u
- }
- // UpdateDontseeit sets the "dontseeit" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateDontseeit() *ContactUpsert {
- u.SetExcluded(contact.FieldDontseeit)
- return u
- }
- // AddDontseeit adds v to the "dontseeit" field.
- func (u *ContactUpsert) AddDontseeit(v int) *ContactUpsert {
- u.Add(contact.FieldDontseeit, v)
- return u
- }
- // SetDontseeme sets the "dontseeme" field.
- func (u *ContactUpsert) SetDontseeme(v int) *ContactUpsert {
- u.Set(contact.FieldDontseeme, v)
- return u
- }
- // UpdateDontseeme sets the "dontseeme" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateDontseeme() *ContactUpsert {
- u.SetExcluded(contact.FieldDontseeme)
- return u
- }
- // AddDontseeme adds v to the "dontseeme" field.
- func (u *ContactUpsert) AddDontseeme(v int) *ContactUpsert {
- u.Add(contact.FieldDontseeme, v)
- return u
- }
- // SetLag sets the "lag" field.
- func (u *ContactUpsert) SetLag(v string) *ContactUpsert {
- u.Set(contact.FieldLag, v)
- return u
- }
- // UpdateLag sets the "lag" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateLag() *ContactUpsert {
- u.SetExcluded(contact.FieldLag)
- return u
- }
- // SetGid sets the "gid" field.
- func (u *ContactUpsert) SetGid(v string) *ContactUpsert {
- u.Set(contact.FieldGid, v)
- return u
- }
- // UpdateGid sets the "gid" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateGid() *ContactUpsert {
- u.SetExcluded(contact.FieldGid)
- return u
- }
- // SetGname sets the "gname" field.
- func (u *ContactUpsert) SetGname(v string) *ContactUpsert {
- u.Set(contact.FieldGname, v)
- return u
- }
- // UpdateGname sets the "gname" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateGname() *ContactUpsert {
- u.SetExcluded(contact.FieldGname)
- return u
- }
- // SetV3 sets the "v3" field.
- func (u *ContactUpsert) SetV3(v string) *ContactUpsert {
- u.Set(contact.FieldV3, v)
- return u
- }
- // UpdateV3 sets the "v3" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateV3() *ContactUpsert {
- u.SetExcluded(contact.FieldV3)
- return u
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *ContactUpsert) SetOrganizationID(v uint64) *ContactUpsert {
- u.Set(contact.FieldOrganizationID, v)
- return u
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateOrganizationID() *ContactUpsert {
- u.SetExcluded(contact.FieldOrganizationID)
- return u
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *ContactUpsert) AddOrganizationID(v uint64) *ContactUpsert {
- u.Add(contact.FieldOrganizationID, v)
- return u
- }
- // ClearOrganizationID clears the value of the "organization_id" field.
- func (u *ContactUpsert) ClearOrganizationID() *ContactUpsert {
- u.SetNull(contact.FieldOrganizationID)
- return u
- }
- // SetCtype sets the "ctype" field.
- func (u *ContactUpsert) SetCtype(v uint64) *ContactUpsert {
- u.Set(contact.FieldCtype, v)
- return u
- }
- // UpdateCtype sets the "ctype" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCtype() *ContactUpsert {
- u.SetExcluded(contact.FieldCtype)
- return u
- }
- // AddCtype adds v to the "ctype" field.
- func (u *ContactUpsert) AddCtype(v uint64) *ContactUpsert {
- u.Add(contact.FieldCtype, v)
- return u
- }
- // SetCage sets the "cage" field.
- func (u *ContactUpsert) SetCage(v int) *ContactUpsert {
- u.Set(contact.FieldCage, v)
- return u
- }
- // UpdateCage sets the "cage" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCage() *ContactUpsert {
- u.SetExcluded(contact.FieldCage)
- return u
- }
- // AddCage adds v to the "cage" field.
- func (u *ContactUpsert) AddCage(v int) *ContactUpsert {
- u.Add(contact.FieldCage, v)
- return u
- }
- // SetCname sets the "cname" field.
- func (u *ContactUpsert) SetCname(v string) *ContactUpsert {
- u.Set(contact.FieldCname, v)
- return u
- }
- // UpdateCname sets the "cname" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCname() *ContactUpsert {
- u.SetExcluded(contact.FieldCname)
- return u
- }
- // SetCarea sets the "carea" field.
- func (u *ContactUpsert) SetCarea(v string) *ContactUpsert {
- u.Set(contact.FieldCarea, v)
- return u
- }
- // UpdateCarea sets the "carea" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCarea() *ContactUpsert {
- u.SetExcluded(contact.FieldCarea)
- return u
- }
- // SetCbirthday sets the "cbirthday" field.
- func (u *ContactUpsert) SetCbirthday(v string) *ContactUpsert {
- u.Set(contact.FieldCbirthday, v)
- return u
- }
- // UpdateCbirthday sets the "cbirthday" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCbirthday() *ContactUpsert {
- u.SetExcluded(contact.FieldCbirthday)
- return u
- }
- // SetCbirtharea sets the "cbirtharea" field.
- func (u *ContactUpsert) SetCbirtharea(v string) *ContactUpsert {
- u.Set(contact.FieldCbirtharea, v)
- return u
- }
- // UpdateCbirtharea sets the "cbirtharea" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCbirtharea() *ContactUpsert {
- u.SetExcluded(contact.FieldCbirtharea)
- return u
- }
- // SetCidcardNo sets the "cidcard_no" field.
- func (u *ContactUpsert) SetCidcardNo(v string) *ContactUpsert {
- u.Set(contact.FieldCidcardNo, v)
- return u
- }
- // UpdateCidcardNo sets the "cidcard_no" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCidcardNo() *ContactUpsert {
- u.SetExcluded(contact.FieldCidcardNo)
- return u
- }
- // SetCtitle sets the "ctitle" field.
- func (u *ContactUpsert) SetCtitle(v string) *ContactUpsert {
- u.Set(contact.FieldCtitle, v)
- return u
- }
- // UpdateCtitle sets the "ctitle" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCtitle() *ContactUpsert {
- u.SetExcluded(contact.FieldCtitle)
- return u
- }
- // SetCc sets the "cc" field.
- func (u *ContactUpsert) SetCc(v string) *ContactUpsert {
- u.Set(contact.FieldCc, v)
- return u
- }
- // UpdateCc sets the "cc" field to the value that was provided on create.
- func (u *ContactUpsert) UpdateCc() *ContactUpsert {
- u.SetExcluded(contact.FieldCc)
- return u
- }
- // SetPhone sets the "phone" field.
- func (u *ContactUpsert) SetPhone(v string) *ContactUpsert {
- u.Set(contact.FieldPhone, v)
- return u
- }
- // UpdatePhone sets the "phone" field to the value that was provided on create.
- func (u *ContactUpsert) UpdatePhone() *ContactUpsert {
- u.SetExcluded(contact.FieldPhone)
- 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.Contact.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(contact.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *ContactUpsertOne) UpdateNewValues() *ContactUpsertOne {
- 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(contact.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(contact.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Contact.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *ContactUpsertOne) Ignore() *ContactUpsertOne {
- 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 *ContactUpsertOne) DoNothing() *ContactUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the ContactCreate.OnConflict
- // documentation for more info.
- func (u *ContactUpsertOne) Update(set func(*ContactUpsert)) *ContactUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&ContactUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *ContactUpsertOne) SetUpdatedAt(v time.Time) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateUpdatedAt() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *ContactUpsertOne) SetStatus(v uint8) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *ContactUpsertOne) AddStatus(v uint8) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateStatus() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *ContactUpsertOne) ClearStatus() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.ClearStatus()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *ContactUpsertOne) SetDeletedAt(v time.Time) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateDeletedAt() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *ContactUpsertOne) ClearDeletedAt() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetWxWxid sets the "wx_wxid" field.
- func (u *ContactUpsertOne) SetWxWxid(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetWxWxid(v)
- })
- }
- // UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateWxWxid() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateWxWxid()
- })
- }
- // SetType sets the "type" field.
- func (u *ContactUpsertOne) SetType(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetType(v)
- })
- }
- // AddType adds v to the "type" field.
- func (u *ContactUpsertOne) AddType(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddType(v)
- })
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateType() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateType()
- })
- }
- // ClearType clears the value of the "type" field.
- func (u *ContactUpsertOne) ClearType() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.ClearType()
- })
- }
- // SetWxid sets the "wxid" field.
- func (u *ContactUpsertOne) SetWxid(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetWxid(v)
- })
- }
- // UpdateWxid sets the "wxid" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateWxid() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateWxid()
- })
- }
- // SetAccount sets the "account" field.
- func (u *ContactUpsertOne) SetAccount(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetAccount(v)
- })
- }
- // UpdateAccount sets the "account" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateAccount() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateAccount()
- })
- }
- // SetNickname sets the "nickname" field.
- func (u *ContactUpsertOne) SetNickname(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetNickname(v)
- })
- }
- // UpdateNickname sets the "nickname" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateNickname() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateNickname()
- })
- }
- // SetMarkname sets the "markname" field.
- func (u *ContactUpsertOne) SetMarkname(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetMarkname(v)
- })
- }
- // UpdateMarkname sets the "markname" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateMarkname() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateMarkname()
- })
- }
- // SetHeadimg sets the "headimg" field.
- func (u *ContactUpsertOne) SetHeadimg(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetHeadimg(v)
- })
- }
- // UpdateHeadimg sets the "headimg" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateHeadimg() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateHeadimg()
- })
- }
- // SetSex sets the "sex" field.
- func (u *ContactUpsertOne) SetSex(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetSex(v)
- })
- }
- // AddSex adds v to the "sex" field.
- func (u *ContactUpsertOne) AddSex(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddSex(v)
- })
- }
- // UpdateSex sets the "sex" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateSex() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateSex()
- })
- }
- // SetStarrole sets the "starrole" field.
- func (u *ContactUpsertOne) SetStarrole(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetStarrole(v)
- })
- }
- // UpdateStarrole sets the "starrole" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateStarrole() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateStarrole()
- })
- }
- // SetDontseeit sets the "dontseeit" field.
- func (u *ContactUpsertOne) SetDontseeit(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetDontseeit(v)
- })
- }
- // AddDontseeit adds v to the "dontseeit" field.
- func (u *ContactUpsertOne) AddDontseeit(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddDontseeit(v)
- })
- }
- // UpdateDontseeit sets the "dontseeit" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateDontseeit() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateDontseeit()
- })
- }
- // SetDontseeme sets the "dontseeme" field.
- func (u *ContactUpsertOne) SetDontseeme(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetDontseeme(v)
- })
- }
- // AddDontseeme adds v to the "dontseeme" field.
- func (u *ContactUpsertOne) AddDontseeme(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddDontseeme(v)
- })
- }
- // UpdateDontseeme sets the "dontseeme" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateDontseeme() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateDontseeme()
- })
- }
- // SetLag sets the "lag" field.
- func (u *ContactUpsertOne) SetLag(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetLag(v)
- })
- }
- // UpdateLag sets the "lag" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateLag() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateLag()
- })
- }
- // SetGid sets the "gid" field.
- func (u *ContactUpsertOne) SetGid(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetGid(v)
- })
- }
- // UpdateGid sets the "gid" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateGid() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateGid()
- })
- }
- // SetGname sets the "gname" field.
- func (u *ContactUpsertOne) SetGname(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetGname(v)
- })
- }
- // UpdateGname sets the "gname" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateGname() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateGname()
- })
- }
- // SetV3 sets the "v3" field.
- func (u *ContactUpsertOne) SetV3(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetV3(v)
- })
- }
- // UpdateV3 sets the "v3" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateV3() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateV3()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *ContactUpsertOne) SetOrganizationID(v uint64) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *ContactUpsertOne) AddOrganizationID(v uint64) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateOrganizationID() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // ClearOrganizationID clears the value of the "organization_id" field.
- func (u *ContactUpsertOne) ClearOrganizationID() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.ClearOrganizationID()
- })
- }
- // SetCtype sets the "ctype" field.
- func (u *ContactUpsertOne) SetCtype(v uint64) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCtype(v)
- })
- }
- // AddCtype adds v to the "ctype" field.
- func (u *ContactUpsertOne) AddCtype(v uint64) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddCtype(v)
- })
- }
- // UpdateCtype sets the "ctype" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCtype() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCtype()
- })
- }
- // SetCage sets the "cage" field.
- func (u *ContactUpsertOne) SetCage(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCage(v)
- })
- }
- // AddCage adds v to the "cage" field.
- func (u *ContactUpsertOne) AddCage(v int) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.AddCage(v)
- })
- }
- // UpdateCage sets the "cage" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCage() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCage()
- })
- }
- // SetCname sets the "cname" field.
- func (u *ContactUpsertOne) SetCname(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCname(v)
- })
- }
- // UpdateCname sets the "cname" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCname() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCname()
- })
- }
- // SetCarea sets the "carea" field.
- func (u *ContactUpsertOne) SetCarea(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCarea(v)
- })
- }
- // UpdateCarea sets the "carea" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCarea() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCarea()
- })
- }
- // SetCbirthday sets the "cbirthday" field.
- func (u *ContactUpsertOne) SetCbirthday(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCbirthday(v)
- })
- }
- // UpdateCbirthday sets the "cbirthday" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCbirthday() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCbirthday()
- })
- }
- // SetCbirtharea sets the "cbirtharea" field.
- func (u *ContactUpsertOne) SetCbirtharea(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCbirtharea(v)
- })
- }
- // UpdateCbirtharea sets the "cbirtharea" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCbirtharea() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCbirtharea()
- })
- }
- // SetCidcardNo sets the "cidcard_no" field.
- func (u *ContactUpsertOne) SetCidcardNo(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCidcardNo(v)
- })
- }
- // UpdateCidcardNo sets the "cidcard_no" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCidcardNo() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCidcardNo()
- })
- }
- // SetCtitle sets the "ctitle" field.
- func (u *ContactUpsertOne) SetCtitle(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCtitle(v)
- })
- }
- // UpdateCtitle sets the "ctitle" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCtitle() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCtitle()
- })
- }
- // SetCc sets the "cc" field.
- func (u *ContactUpsertOne) SetCc(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetCc(v)
- })
- }
- // UpdateCc sets the "cc" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdateCc() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCc()
- })
- }
- // SetPhone sets the "phone" field.
- func (u *ContactUpsertOne) SetPhone(v string) *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.SetPhone(v)
- })
- }
- // UpdatePhone sets the "phone" field to the value that was provided on create.
- func (u *ContactUpsertOne) UpdatePhone() *ContactUpsertOne {
- return u.Update(func(s *ContactUpsert) {
- s.UpdatePhone()
- })
- }
- // Exec executes the query.
- func (u *ContactUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for ContactCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *ContactUpsertOne) 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 *ContactUpsertOne) 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 *ContactUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // ContactCreateBulk is the builder for creating many Contact entities in bulk.
- type ContactCreateBulk struct {
- config
- err error
- builders []*ContactCreate
- conflict []sql.ConflictOption
- }
- // Save creates the Contact entities in the database.
- func (ccb *ContactCreateBulk) Save(ctx context.Context) ([]*Contact, error) {
- if ccb.err != nil {
- return nil, ccb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(ccb.builders))
- nodes := make([]*Contact, len(ccb.builders))
- mutators := make([]Mutator, len(ccb.builders))
- for i := range ccb.builders {
- func(i int, root context.Context) {
- builder := ccb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*ContactMutation)
- 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, ccb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = ccb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, ccb.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, ccb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (ccb *ContactCreateBulk) SaveX(ctx context.Context) []*Contact {
- v, err := ccb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (ccb *ContactCreateBulk) Exec(ctx context.Context) error {
- _, err := ccb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (ccb *ContactCreateBulk) ExecX(ctx context.Context) {
- if err := ccb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Contact.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.ContactUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (ccb *ContactCreateBulk) OnConflict(opts ...sql.ConflictOption) *ContactUpsertBulk {
- ccb.conflict = opts
- return &ContactUpsertBulk{
- create: ccb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Contact.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (ccb *ContactCreateBulk) OnConflictColumns(columns ...string) *ContactUpsertBulk {
- ccb.conflict = append(ccb.conflict, sql.ConflictColumns(columns...))
- return &ContactUpsertBulk{
- create: ccb,
- }
- }
- // ContactUpsertBulk is the builder for "upsert"-ing
- // a bulk of Contact nodes.
- type ContactUpsertBulk struct {
- create *ContactCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.Contact.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(contact.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *ContactUpsertBulk) UpdateNewValues() *ContactUpsertBulk {
- 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(contact.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(contact.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Contact.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *ContactUpsertBulk) Ignore() *ContactUpsertBulk {
- 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 *ContactUpsertBulk) DoNothing() *ContactUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the ContactCreateBulk.OnConflict
- // documentation for more info.
- func (u *ContactUpsertBulk) Update(set func(*ContactUpsert)) *ContactUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&ContactUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *ContactUpsertBulk) SetUpdatedAt(v time.Time) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateUpdatedAt() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *ContactUpsertBulk) SetStatus(v uint8) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *ContactUpsertBulk) AddStatus(v uint8) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateStatus() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *ContactUpsertBulk) ClearStatus() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.ClearStatus()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *ContactUpsertBulk) SetDeletedAt(v time.Time) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateDeletedAt() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *ContactUpsertBulk) ClearDeletedAt() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetWxWxid sets the "wx_wxid" field.
- func (u *ContactUpsertBulk) SetWxWxid(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetWxWxid(v)
- })
- }
- // UpdateWxWxid sets the "wx_wxid" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateWxWxid() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateWxWxid()
- })
- }
- // SetType sets the "type" field.
- func (u *ContactUpsertBulk) SetType(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetType(v)
- })
- }
- // AddType adds v to the "type" field.
- func (u *ContactUpsertBulk) AddType(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddType(v)
- })
- }
- // UpdateType sets the "type" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateType() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateType()
- })
- }
- // ClearType clears the value of the "type" field.
- func (u *ContactUpsertBulk) ClearType() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.ClearType()
- })
- }
- // SetWxid sets the "wxid" field.
- func (u *ContactUpsertBulk) SetWxid(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetWxid(v)
- })
- }
- // UpdateWxid sets the "wxid" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateWxid() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateWxid()
- })
- }
- // SetAccount sets the "account" field.
- func (u *ContactUpsertBulk) SetAccount(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetAccount(v)
- })
- }
- // UpdateAccount sets the "account" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateAccount() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateAccount()
- })
- }
- // SetNickname sets the "nickname" field.
- func (u *ContactUpsertBulk) SetNickname(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetNickname(v)
- })
- }
- // UpdateNickname sets the "nickname" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateNickname() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateNickname()
- })
- }
- // SetMarkname sets the "markname" field.
- func (u *ContactUpsertBulk) SetMarkname(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetMarkname(v)
- })
- }
- // UpdateMarkname sets the "markname" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateMarkname() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateMarkname()
- })
- }
- // SetHeadimg sets the "headimg" field.
- func (u *ContactUpsertBulk) SetHeadimg(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetHeadimg(v)
- })
- }
- // UpdateHeadimg sets the "headimg" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateHeadimg() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateHeadimg()
- })
- }
- // SetSex sets the "sex" field.
- func (u *ContactUpsertBulk) SetSex(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetSex(v)
- })
- }
- // AddSex adds v to the "sex" field.
- func (u *ContactUpsertBulk) AddSex(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddSex(v)
- })
- }
- // UpdateSex sets the "sex" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateSex() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateSex()
- })
- }
- // SetStarrole sets the "starrole" field.
- func (u *ContactUpsertBulk) SetStarrole(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetStarrole(v)
- })
- }
- // UpdateStarrole sets the "starrole" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateStarrole() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateStarrole()
- })
- }
- // SetDontseeit sets the "dontseeit" field.
- func (u *ContactUpsertBulk) SetDontseeit(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetDontseeit(v)
- })
- }
- // AddDontseeit adds v to the "dontseeit" field.
- func (u *ContactUpsertBulk) AddDontseeit(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddDontseeit(v)
- })
- }
- // UpdateDontseeit sets the "dontseeit" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateDontseeit() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateDontseeit()
- })
- }
- // SetDontseeme sets the "dontseeme" field.
- func (u *ContactUpsertBulk) SetDontseeme(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetDontseeme(v)
- })
- }
- // AddDontseeme adds v to the "dontseeme" field.
- func (u *ContactUpsertBulk) AddDontseeme(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddDontseeme(v)
- })
- }
- // UpdateDontseeme sets the "dontseeme" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateDontseeme() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateDontseeme()
- })
- }
- // SetLag sets the "lag" field.
- func (u *ContactUpsertBulk) SetLag(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetLag(v)
- })
- }
- // UpdateLag sets the "lag" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateLag() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateLag()
- })
- }
- // SetGid sets the "gid" field.
- func (u *ContactUpsertBulk) SetGid(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetGid(v)
- })
- }
- // UpdateGid sets the "gid" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateGid() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateGid()
- })
- }
- // SetGname sets the "gname" field.
- func (u *ContactUpsertBulk) SetGname(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetGname(v)
- })
- }
- // UpdateGname sets the "gname" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateGname() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateGname()
- })
- }
- // SetV3 sets the "v3" field.
- func (u *ContactUpsertBulk) SetV3(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetV3(v)
- })
- }
- // UpdateV3 sets the "v3" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateV3() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateV3()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *ContactUpsertBulk) SetOrganizationID(v uint64) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *ContactUpsertBulk) AddOrganizationID(v uint64) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateOrganizationID() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // ClearOrganizationID clears the value of the "organization_id" field.
- func (u *ContactUpsertBulk) ClearOrganizationID() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.ClearOrganizationID()
- })
- }
- // SetCtype sets the "ctype" field.
- func (u *ContactUpsertBulk) SetCtype(v uint64) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCtype(v)
- })
- }
- // AddCtype adds v to the "ctype" field.
- func (u *ContactUpsertBulk) AddCtype(v uint64) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddCtype(v)
- })
- }
- // UpdateCtype sets the "ctype" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCtype() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCtype()
- })
- }
- // SetCage sets the "cage" field.
- func (u *ContactUpsertBulk) SetCage(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCage(v)
- })
- }
- // AddCage adds v to the "cage" field.
- func (u *ContactUpsertBulk) AddCage(v int) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.AddCage(v)
- })
- }
- // UpdateCage sets the "cage" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCage() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCage()
- })
- }
- // SetCname sets the "cname" field.
- func (u *ContactUpsertBulk) SetCname(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCname(v)
- })
- }
- // UpdateCname sets the "cname" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCname() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCname()
- })
- }
- // SetCarea sets the "carea" field.
- func (u *ContactUpsertBulk) SetCarea(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCarea(v)
- })
- }
- // UpdateCarea sets the "carea" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCarea() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCarea()
- })
- }
- // SetCbirthday sets the "cbirthday" field.
- func (u *ContactUpsertBulk) SetCbirthday(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCbirthday(v)
- })
- }
- // UpdateCbirthday sets the "cbirthday" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCbirthday() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCbirthday()
- })
- }
- // SetCbirtharea sets the "cbirtharea" field.
- func (u *ContactUpsertBulk) SetCbirtharea(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCbirtharea(v)
- })
- }
- // UpdateCbirtharea sets the "cbirtharea" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCbirtharea() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCbirtharea()
- })
- }
- // SetCidcardNo sets the "cidcard_no" field.
- func (u *ContactUpsertBulk) SetCidcardNo(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCidcardNo(v)
- })
- }
- // UpdateCidcardNo sets the "cidcard_no" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCidcardNo() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCidcardNo()
- })
- }
- // SetCtitle sets the "ctitle" field.
- func (u *ContactUpsertBulk) SetCtitle(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCtitle(v)
- })
- }
- // UpdateCtitle sets the "ctitle" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCtitle() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCtitle()
- })
- }
- // SetCc sets the "cc" field.
- func (u *ContactUpsertBulk) SetCc(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetCc(v)
- })
- }
- // UpdateCc sets the "cc" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdateCc() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdateCc()
- })
- }
- // SetPhone sets the "phone" field.
- func (u *ContactUpsertBulk) SetPhone(v string) *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.SetPhone(v)
- })
- }
- // UpdatePhone sets the "phone" field to the value that was provided on create.
- func (u *ContactUpsertBulk) UpdatePhone() *ContactUpsertBulk {
- return u.Update(func(s *ContactUpsert) {
- s.UpdatePhone()
- })
- }
- // Exec executes the query.
- func (u *ContactUpsertBulk) 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 ContactCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for ContactCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *ContactUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|