1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "wechat-api/ent/addwechatfriendlog"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // AddWechatFriendLogCreate is the builder for creating a AddWechatFriendLog entity.
- type AddWechatFriendLogCreate struct {
- config
- mutation *AddWechatFriendLogMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetOwnerWxID sets the "owner_wx_id" field.
- func (awflc *AddWechatFriendLogCreate) SetOwnerWxID(s string) *AddWechatFriendLogCreate {
- awflc.mutation.SetOwnerWxID(s)
- return awflc
- }
- // SetNillableOwnerWxID sets the "owner_wx_id" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableOwnerWxID(s *string) *AddWechatFriendLogCreate {
- if s != nil {
- awflc.SetOwnerWxID(*s)
- }
- return awflc
- }
- // SetOwnerWxType sets the "owner_wx_type" field.
- func (awflc *AddWechatFriendLogCreate) SetOwnerWxType(i int) *AddWechatFriendLogCreate {
- awflc.mutation.SetOwnerWxType(i)
- return awflc
- }
- // SetNillableOwnerWxType sets the "owner_wx_type" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableOwnerWxType(i *int) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetOwnerWxType(*i)
- }
- return awflc
- }
- // SetFindContent sets the "find_content" field.
- func (awflc *AddWechatFriendLogCreate) SetFindContent(s string) *AddWechatFriendLogCreate {
- awflc.mutation.SetFindContent(s)
- return awflc
- }
- // SetNillableFindContent sets the "find_content" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableFindContent(s *string) *AddWechatFriendLogCreate {
- if s != nil {
- awflc.SetFindContent(*s)
- }
- return awflc
- }
- // SetMessage sets the "message" field.
- func (awflc *AddWechatFriendLogCreate) SetMessage(s string) *AddWechatFriendLogCreate {
- awflc.mutation.SetMessage(s)
- return awflc
- }
- // SetNillableMessage sets the "message" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableMessage(s *string) *AddWechatFriendLogCreate {
- if s != nil {
- awflc.SetMessage(*s)
- }
- return awflc
- }
- // SetFindRequest sets the "find_request" field.
- func (awflc *AddWechatFriendLogCreate) SetFindRequest(m map[string]interface{}) *AddWechatFriendLogCreate {
- awflc.mutation.SetFindRequest(m)
- return awflc
- }
- // SetFindResult sets the "find_result" field.
- func (awflc *AddWechatFriendLogCreate) SetFindResult(m map[string]interface{}) *AddWechatFriendLogCreate {
- awflc.mutation.SetFindResult(m)
- return awflc
- }
- // SetIsCanAdd sets the "is_can_add" field.
- func (awflc *AddWechatFriendLogCreate) SetIsCanAdd(i int) *AddWechatFriendLogCreate {
- awflc.mutation.SetIsCanAdd(i)
- return awflc
- }
- // SetNillableIsCanAdd sets the "is_can_add" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableIsCanAdd(i *int) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetIsCanAdd(*i)
- }
- return awflc
- }
- // SetTaskCount sets the "task_count" field.
- func (awflc *AddWechatFriendLogCreate) SetTaskCount(i int) *AddWechatFriendLogCreate {
- awflc.mutation.SetTaskCount(i)
- return awflc
- }
- // SetNillableTaskCount sets the "task_count" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableTaskCount(i *int) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetTaskCount(*i)
- }
- return awflc
- }
- // SetTaskID sets the "task_id" field.
- func (awflc *AddWechatFriendLogCreate) SetTaskID(i int64) *AddWechatFriendLogCreate {
- awflc.mutation.SetTaskID(i)
- return awflc
- }
- // SetNillableTaskID sets the "task_id" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableTaskID(i *int64) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetTaskID(*i)
- }
- return awflc
- }
- // SetAddRequest sets the "add_request" field.
- func (awflc *AddWechatFriendLogCreate) SetAddRequest(m map[string]interface{}) *AddWechatFriendLogCreate {
- awflc.mutation.SetAddRequest(m)
- return awflc
- }
- // SetAddResult sets the "add_result" field.
- func (awflc *AddWechatFriendLogCreate) SetAddResult(m map[string]interface{}) *AddWechatFriendLogCreate {
- awflc.mutation.SetAddResult(m)
- return awflc
- }
- // SetCreatedAt sets the "created_at" field.
- func (awflc *AddWechatFriendLogCreate) SetCreatedAt(i int64) *AddWechatFriendLogCreate {
- awflc.mutation.SetCreatedAt(i)
- return awflc
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableCreatedAt(i *int64) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetCreatedAt(*i)
- }
- return awflc
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (awflc *AddWechatFriendLogCreate) SetUpdatedAt(i int64) *AddWechatFriendLogCreate {
- awflc.mutation.SetUpdatedAt(i)
- return awflc
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableUpdatedAt(i *int64) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetUpdatedAt(*i)
- }
- return awflc
- }
- // SetSource sets the "source" field.
- func (awflc *AddWechatFriendLogCreate) SetSource(i int) *AddWechatFriendLogCreate {
- awflc.mutation.SetSource(i)
- return awflc
- }
- // SetNillableSource sets the "source" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableSource(i *int) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetSource(*i)
- }
- return awflc
- }
- // SetNickName sets the "nick_name" field.
- func (awflc *AddWechatFriendLogCreate) SetNickName(s string) *AddWechatFriendLogCreate {
- awflc.mutation.SetNickName(s)
- return awflc
- }
- // SetNillableNickName sets the "nick_name" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableNickName(s *string) *AddWechatFriendLogCreate {
- if s != nil {
- awflc.SetNickName(*s)
- }
- return awflc
- }
- // SetAvatar sets the "avatar" field.
- func (awflc *AddWechatFriendLogCreate) SetAvatar(s string) *AddWechatFriendLogCreate {
- awflc.mutation.SetAvatar(s)
- return awflc
- }
- // SetNillableAvatar sets the "avatar" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableAvatar(s *string) *AddWechatFriendLogCreate {
- if s != nil {
- awflc.SetAvatar(*s)
- }
- return awflc
- }
- // SetOrganizationID sets the "organization_id" field.
- func (awflc *AddWechatFriendLogCreate) SetOrganizationID(i int64) *AddWechatFriendLogCreate {
- awflc.mutation.SetOrganizationID(i)
- return awflc
- }
- // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
- func (awflc *AddWechatFriendLogCreate) SetNillableOrganizationID(i *int64) *AddWechatFriendLogCreate {
- if i != nil {
- awflc.SetOrganizationID(*i)
- }
- return awflc
- }
- // SetID sets the "id" field.
- func (awflc *AddWechatFriendLogCreate) SetID(i int64) *AddWechatFriendLogCreate {
- awflc.mutation.SetID(i)
- return awflc
- }
- // Mutation returns the AddWechatFriendLogMutation object of the builder.
- func (awflc *AddWechatFriendLogCreate) Mutation() *AddWechatFriendLogMutation {
- return awflc.mutation
- }
- // Save creates the AddWechatFriendLog in the database.
- func (awflc *AddWechatFriendLogCreate) Save(ctx context.Context) (*AddWechatFriendLog, error) {
- awflc.defaults()
- return withHooks(ctx, awflc.sqlSave, awflc.mutation, awflc.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (awflc *AddWechatFriendLogCreate) SaveX(ctx context.Context) *AddWechatFriendLog {
- v, err := awflc.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (awflc *AddWechatFriendLogCreate) Exec(ctx context.Context) error {
- _, err := awflc.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (awflc *AddWechatFriendLogCreate) ExecX(ctx context.Context) {
- if err := awflc.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (awflc *AddWechatFriendLogCreate) defaults() {
- if _, ok := awflc.mutation.OwnerWxID(); !ok {
- v := addwechatfriendlog.DefaultOwnerWxID
- awflc.mutation.SetOwnerWxID(v)
- }
- if _, ok := awflc.mutation.OwnerWxType(); !ok {
- v := addwechatfriendlog.DefaultOwnerWxType
- awflc.mutation.SetOwnerWxType(v)
- }
- if _, ok := awflc.mutation.FindContent(); !ok {
- v := addwechatfriendlog.DefaultFindContent
- awflc.mutation.SetFindContent(v)
- }
- if _, ok := awflc.mutation.Message(); !ok {
- v := addwechatfriendlog.DefaultMessage
- awflc.mutation.SetMessage(v)
- }
- if _, ok := awflc.mutation.IsCanAdd(); !ok {
- v := addwechatfriendlog.DefaultIsCanAdd
- awflc.mutation.SetIsCanAdd(v)
- }
- if _, ok := awflc.mutation.TaskCount(); !ok {
- v := addwechatfriendlog.DefaultTaskCount
- awflc.mutation.SetTaskCount(v)
- }
- if _, ok := awflc.mutation.TaskID(); !ok {
- v := addwechatfriendlog.DefaultTaskID
- awflc.mutation.SetTaskID(v)
- }
- if _, ok := awflc.mutation.CreatedAt(); !ok {
- v := addwechatfriendlog.DefaultCreatedAt()
- awflc.mutation.SetCreatedAt(v)
- }
- if _, ok := awflc.mutation.UpdatedAt(); !ok {
- v := addwechatfriendlog.DefaultUpdatedAt()
- awflc.mutation.SetUpdatedAt(v)
- }
- if _, ok := awflc.mutation.Source(); !ok {
- v := addwechatfriendlog.DefaultSource
- awflc.mutation.SetSource(v)
- }
- if _, ok := awflc.mutation.NickName(); !ok {
- v := addwechatfriendlog.DefaultNickName
- awflc.mutation.SetNickName(v)
- }
- if _, ok := awflc.mutation.Avatar(); !ok {
- v := addwechatfriendlog.DefaultAvatar
- awflc.mutation.SetAvatar(v)
- }
- if _, ok := awflc.mutation.OrganizationID(); !ok {
- v := addwechatfriendlog.DefaultOrganizationID
- awflc.mutation.SetOrganizationID(v)
- }
- }
- // check runs all checks and user-defined validators on the builder.
- func (awflc *AddWechatFriendLogCreate) check() error {
- if _, ok := awflc.mutation.OwnerWxID(); !ok {
- return &ValidationError{Name: "owner_wx_id", err: errors.New(`ent: missing required field "AddWechatFriendLog.owner_wx_id"`)}
- }
- if v, ok := awflc.mutation.OwnerWxID(); ok {
- if err := addwechatfriendlog.OwnerWxIDValidator(v); err != nil {
- return &ValidationError{Name: "owner_wx_id", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.owner_wx_id": %w`, err)}
- }
- }
- if _, ok := awflc.mutation.OwnerWxType(); !ok {
- return &ValidationError{Name: "owner_wx_type", err: errors.New(`ent: missing required field "AddWechatFriendLog.owner_wx_type"`)}
- }
- if _, ok := awflc.mutation.FindContent(); !ok {
- return &ValidationError{Name: "find_content", err: errors.New(`ent: missing required field "AddWechatFriendLog.find_content"`)}
- }
- if v, ok := awflc.mutation.FindContent(); ok {
- if err := addwechatfriendlog.FindContentValidator(v); err != nil {
- return &ValidationError{Name: "find_content", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.find_content": %w`, err)}
- }
- }
- if _, ok := awflc.mutation.Message(); !ok {
- return &ValidationError{Name: "message", err: errors.New(`ent: missing required field "AddWechatFriendLog.message"`)}
- }
- if v, ok := awflc.mutation.Message(); ok {
- if err := addwechatfriendlog.MessageValidator(v); err != nil {
- return &ValidationError{Name: "message", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.message": %w`, err)}
- }
- }
- if _, ok := awflc.mutation.IsCanAdd(); !ok {
- return &ValidationError{Name: "is_can_add", err: errors.New(`ent: missing required field "AddWechatFriendLog.is_can_add"`)}
- }
- if _, ok := awflc.mutation.TaskCount(); !ok {
- return &ValidationError{Name: "task_count", err: errors.New(`ent: missing required field "AddWechatFriendLog.task_count"`)}
- }
- if _, ok := awflc.mutation.TaskID(); !ok {
- return &ValidationError{Name: "task_id", err: errors.New(`ent: missing required field "AddWechatFriendLog.task_id"`)}
- }
- if _, ok := awflc.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "AddWechatFriendLog.created_at"`)}
- }
- if _, ok := awflc.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AddWechatFriendLog.updated_at"`)}
- }
- if _, ok := awflc.mutation.Source(); !ok {
- return &ValidationError{Name: "source", err: errors.New(`ent: missing required field "AddWechatFriendLog.source"`)}
- }
- if _, ok := awflc.mutation.NickName(); !ok {
- return &ValidationError{Name: "nick_name", err: errors.New(`ent: missing required field "AddWechatFriendLog.nick_name"`)}
- }
- if v, ok := awflc.mutation.NickName(); ok {
- if err := addwechatfriendlog.NickNameValidator(v); err != nil {
- return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.nick_name": %w`, err)}
- }
- }
- if _, ok := awflc.mutation.Avatar(); !ok {
- return &ValidationError{Name: "avatar", err: errors.New(`ent: missing required field "AddWechatFriendLog.avatar"`)}
- }
- if v, ok := awflc.mutation.Avatar(); ok {
- if err := addwechatfriendlog.AvatarValidator(v); err != nil {
- return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.avatar": %w`, err)}
- }
- }
- if _, ok := awflc.mutation.OrganizationID(); !ok {
- return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "AddWechatFriendLog.organization_id"`)}
- }
- return nil
- }
- func (awflc *AddWechatFriendLogCreate) sqlSave(ctx context.Context) (*AddWechatFriendLog, error) {
- if err := awflc.check(); err != nil {
- return nil, err
- }
- _node, _spec := awflc.createSpec()
- if err := sqlgraph.CreateNode(ctx, awflc.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 = int64(id)
- }
- awflc.mutation.id = &_node.ID
- awflc.mutation.done = true
- return _node, nil
- }
- func (awflc *AddWechatFriendLogCreate) createSpec() (*AddWechatFriendLog, *sqlgraph.CreateSpec) {
- var (
- _node = &AddWechatFriendLog{config: awflc.config}
- _spec = sqlgraph.NewCreateSpec(addwechatfriendlog.Table, sqlgraph.NewFieldSpec(addwechatfriendlog.FieldID, field.TypeInt64))
- )
- _spec.OnConflict = awflc.conflict
- if id, ok := awflc.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := awflc.mutation.OwnerWxID(); ok {
- _spec.SetField(addwechatfriendlog.FieldOwnerWxID, field.TypeString, value)
- _node.OwnerWxID = value
- }
- if value, ok := awflc.mutation.OwnerWxType(); ok {
- _spec.SetField(addwechatfriendlog.FieldOwnerWxType, field.TypeInt, value)
- _node.OwnerWxType = value
- }
- if value, ok := awflc.mutation.FindContent(); ok {
- _spec.SetField(addwechatfriendlog.FieldFindContent, field.TypeString, value)
- _node.FindContent = value
- }
- if value, ok := awflc.mutation.Message(); ok {
- _spec.SetField(addwechatfriendlog.FieldMessage, field.TypeString, value)
- _node.Message = value
- }
- if value, ok := awflc.mutation.FindRequest(); ok {
- _spec.SetField(addwechatfriendlog.FieldFindRequest, field.TypeJSON, value)
- _node.FindRequest = value
- }
- if value, ok := awflc.mutation.FindResult(); ok {
- _spec.SetField(addwechatfriendlog.FieldFindResult, field.TypeJSON, value)
- _node.FindResult = value
- }
- if value, ok := awflc.mutation.IsCanAdd(); ok {
- _spec.SetField(addwechatfriendlog.FieldIsCanAdd, field.TypeInt, value)
- _node.IsCanAdd = value
- }
- if value, ok := awflc.mutation.TaskCount(); ok {
- _spec.SetField(addwechatfriendlog.FieldTaskCount, field.TypeInt, value)
- _node.TaskCount = value
- }
- if value, ok := awflc.mutation.TaskID(); ok {
- _spec.SetField(addwechatfriendlog.FieldTaskID, field.TypeInt64, value)
- _node.TaskID = value
- }
- if value, ok := awflc.mutation.AddRequest(); ok {
- _spec.SetField(addwechatfriendlog.FieldAddRequest, field.TypeJSON, value)
- _node.AddRequest = value
- }
- if value, ok := awflc.mutation.AddResult(); ok {
- _spec.SetField(addwechatfriendlog.FieldAddResult, field.TypeJSON, value)
- _node.AddResult = value
- }
- if value, ok := awflc.mutation.CreatedAt(); ok {
- _spec.SetField(addwechatfriendlog.FieldCreatedAt, field.TypeInt64, value)
- _node.CreatedAt = value
- }
- if value, ok := awflc.mutation.UpdatedAt(); ok {
- _spec.SetField(addwechatfriendlog.FieldUpdatedAt, field.TypeInt64, value)
- _node.UpdatedAt = value
- }
- if value, ok := awflc.mutation.Source(); ok {
- _spec.SetField(addwechatfriendlog.FieldSource, field.TypeInt, value)
- _node.Source = value
- }
- if value, ok := awflc.mutation.NickName(); ok {
- _spec.SetField(addwechatfriendlog.FieldNickName, field.TypeString, value)
- _node.NickName = value
- }
- if value, ok := awflc.mutation.Avatar(); ok {
- _spec.SetField(addwechatfriendlog.FieldAvatar, field.TypeString, value)
- _node.Avatar = value
- }
- if value, ok := awflc.mutation.OrganizationID(); ok {
- _spec.SetField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
- _node.OrganizationID = value
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.AddWechatFriendLog.Create().
- // SetOwnerWxID(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.AddWechatFriendLogUpsert) {
- // SetOwnerWxID(v+v).
- // }).
- // Exec(ctx)
- func (awflc *AddWechatFriendLogCreate) OnConflict(opts ...sql.ConflictOption) *AddWechatFriendLogUpsertOne {
- awflc.conflict = opts
- return &AddWechatFriendLogUpsertOne{
- create: awflc,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.AddWechatFriendLog.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (awflc *AddWechatFriendLogCreate) OnConflictColumns(columns ...string) *AddWechatFriendLogUpsertOne {
- awflc.conflict = append(awflc.conflict, sql.ConflictColumns(columns...))
- return &AddWechatFriendLogUpsertOne{
- create: awflc,
- }
- }
- type (
- // AddWechatFriendLogUpsertOne is the builder for "upsert"-ing
- // one AddWechatFriendLog node.
- AddWechatFriendLogUpsertOne struct {
- create *AddWechatFriendLogCreate
- }
- // AddWechatFriendLogUpsert is the "OnConflict" setter.
- AddWechatFriendLogUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetOwnerWxID sets the "owner_wx_id" field.
- func (u *AddWechatFriendLogUpsert) SetOwnerWxID(v string) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldOwnerWxID, v)
- return u
- }
- // UpdateOwnerWxID sets the "owner_wx_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateOwnerWxID() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldOwnerWxID)
- return u
- }
- // SetOwnerWxType sets the "owner_wx_type" field.
- func (u *AddWechatFriendLogUpsert) SetOwnerWxType(v int) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldOwnerWxType, v)
- return u
- }
- // UpdateOwnerWxType sets the "owner_wx_type" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateOwnerWxType() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldOwnerWxType)
- return u
- }
- // AddOwnerWxType adds v to the "owner_wx_type" field.
- func (u *AddWechatFriendLogUpsert) AddOwnerWxType(v int) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.FieldOwnerWxType, v)
- return u
- }
- // SetFindContent sets the "find_content" field.
- func (u *AddWechatFriendLogUpsert) SetFindContent(v string) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldFindContent, v)
- return u
- }
- // UpdateFindContent sets the "find_content" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateFindContent() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldFindContent)
- return u
- }
- // SetMessage sets the "message" field.
- func (u *AddWechatFriendLogUpsert) SetMessage(v string) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldMessage, v)
- return u
- }
- // UpdateMessage sets the "message" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateMessage() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldMessage)
- return u
- }
- // SetFindRequest sets the "find_request" field.
- func (u *AddWechatFriendLogUpsert) SetFindRequest(v map[string]interface{}) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldFindRequest, v)
- return u
- }
- // UpdateFindRequest sets the "find_request" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateFindRequest() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldFindRequest)
- return u
- }
- // ClearFindRequest clears the value of the "find_request" field.
- func (u *AddWechatFriendLogUpsert) ClearFindRequest() *AddWechatFriendLogUpsert {
- u.SetNull(addwechatfriendlog.FieldFindRequest)
- return u
- }
- // SetFindResult sets the "find_result" field.
- func (u *AddWechatFriendLogUpsert) SetFindResult(v map[string]interface{}) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldFindResult, v)
- return u
- }
- // UpdateFindResult sets the "find_result" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateFindResult() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldFindResult)
- return u
- }
- // ClearFindResult clears the value of the "find_result" field.
- func (u *AddWechatFriendLogUpsert) ClearFindResult() *AddWechatFriendLogUpsert {
- u.SetNull(addwechatfriendlog.FieldFindResult)
- return u
- }
- // SetIsCanAdd sets the "is_can_add" field.
- func (u *AddWechatFriendLogUpsert) SetIsCanAdd(v int) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldIsCanAdd, v)
- return u
- }
- // UpdateIsCanAdd sets the "is_can_add" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateIsCanAdd() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldIsCanAdd)
- return u
- }
- // AddIsCanAdd adds v to the "is_can_add" field.
- func (u *AddWechatFriendLogUpsert) AddIsCanAdd(v int) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.FieldIsCanAdd, v)
- return u
- }
- // SetTaskCount sets the "task_count" field.
- func (u *AddWechatFriendLogUpsert) SetTaskCount(v int) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldTaskCount, v)
- return u
- }
- // UpdateTaskCount sets the "task_count" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateTaskCount() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldTaskCount)
- return u
- }
- // AddTaskCount adds v to the "task_count" field.
- func (u *AddWechatFriendLogUpsert) AddTaskCount(v int) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.FieldTaskCount, v)
- return u
- }
- // SetTaskID sets the "task_id" field.
- func (u *AddWechatFriendLogUpsert) SetTaskID(v int64) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldTaskID, v)
- return u
- }
- // UpdateTaskID sets the "task_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateTaskID() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldTaskID)
- return u
- }
- // AddTaskID adds v to the "task_id" field.
- func (u *AddWechatFriendLogUpsert) AddTaskID(v int64) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.FieldTaskID, v)
- return u
- }
- // SetAddRequest sets the "add_request" field.
- func (u *AddWechatFriendLogUpsert) SetAddRequest(v map[string]interface{}) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldAddRequest, v)
- return u
- }
- // UpdateAddRequest sets the "add_request" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateAddRequest() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldAddRequest)
- return u
- }
- // ClearAddRequest clears the value of the "add_request" field.
- func (u *AddWechatFriendLogUpsert) ClearAddRequest() *AddWechatFriendLogUpsert {
- u.SetNull(addwechatfriendlog.FieldAddRequest)
- return u
- }
- // SetAddResult sets the "add_result" field.
- func (u *AddWechatFriendLogUpsert) SetAddResult(v map[string]interface{}) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldAddResult, v)
- return u
- }
- // UpdateAddResult sets the "add_result" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateAddResult() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldAddResult)
- return u
- }
- // ClearAddResult clears the value of the "add_result" field.
- func (u *AddWechatFriendLogUpsert) ClearAddResult() *AddWechatFriendLogUpsert {
- u.SetNull(addwechatfriendlog.FieldAddResult)
- return u
- }
- // SetCreatedAt sets the "created_at" field.
- func (u *AddWechatFriendLogUpsert) SetCreatedAt(v int64) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldCreatedAt, v)
- return u
- }
- // UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateCreatedAt() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldCreatedAt)
- return u
- }
- // AddCreatedAt adds v to the "created_at" field.
- func (u *AddWechatFriendLogUpsert) AddCreatedAt(v int64) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.FieldCreatedAt, v)
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AddWechatFriendLogUpsert) SetUpdatedAt(v int64) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateUpdatedAt() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldUpdatedAt)
- return u
- }
- // AddUpdatedAt adds v to the "updated_at" field.
- func (u *AddWechatFriendLogUpsert) AddUpdatedAt(v int64) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.FieldUpdatedAt, v)
- return u
- }
- // SetSource sets the "source" field.
- func (u *AddWechatFriendLogUpsert) SetSource(v int) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldSource, v)
- return u
- }
- // UpdateSource sets the "source" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateSource() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldSource)
- return u
- }
- // AddSource adds v to the "source" field.
- func (u *AddWechatFriendLogUpsert) AddSource(v int) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.FieldSource, v)
- return u
- }
- // SetNickName sets the "nick_name" field.
- func (u *AddWechatFriendLogUpsert) SetNickName(v string) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldNickName, v)
- return u
- }
- // UpdateNickName sets the "nick_name" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateNickName() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldNickName)
- return u
- }
- // SetAvatar sets the "avatar" field.
- func (u *AddWechatFriendLogUpsert) SetAvatar(v string) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldAvatar, v)
- return u
- }
- // UpdateAvatar sets the "avatar" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateAvatar() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldAvatar)
- return u
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *AddWechatFriendLogUpsert) SetOrganizationID(v int64) *AddWechatFriendLogUpsert {
- u.Set(addwechatfriendlog.FieldOrganizationID, v)
- return u
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsert) UpdateOrganizationID() *AddWechatFriendLogUpsert {
- u.SetExcluded(addwechatfriendlog.FieldOrganizationID)
- return u
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *AddWechatFriendLogUpsert) AddOrganizationID(v int64) *AddWechatFriendLogUpsert {
- u.Add(addwechatfriendlog.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.AddWechatFriendLog.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(addwechatfriendlog.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *AddWechatFriendLogUpsertOne) UpdateNewValues() *AddWechatFriendLogUpsertOne {
- 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(addwechatfriendlog.FieldID)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.AddWechatFriendLog.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *AddWechatFriendLogUpsertOne) Ignore() *AddWechatFriendLogUpsertOne {
- 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 *AddWechatFriendLogUpsertOne) DoNothing() *AddWechatFriendLogUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the AddWechatFriendLogCreate.OnConflict
- // documentation for more info.
- func (u *AddWechatFriendLogUpsertOne) Update(set func(*AddWechatFriendLogUpsert)) *AddWechatFriendLogUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&AddWechatFriendLogUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetOwnerWxID sets the "owner_wx_id" field.
- func (u *AddWechatFriendLogUpsertOne) SetOwnerWxID(v string) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetOwnerWxID(v)
- })
- }
- // UpdateOwnerWxID sets the "owner_wx_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateOwnerWxID() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateOwnerWxID()
- })
- }
- // SetOwnerWxType sets the "owner_wx_type" field.
- func (u *AddWechatFriendLogUpsertOne) SetOwnerWxType(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetOwnerWxType(v)
- })
- }
- // AddOwnerWxType adds v to the "owner_wx_type" field.
- func (u *AddWechatFriendLogUpsertOne) AddOwnerWxType(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddOwnerWxType(v)
- })
- }
- // UpdateOwnerWxType sets the "owner_wx_type" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateOwnerWxType() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateOwnerWxType()
- })
- }
- // SetFindContent sets the "find_content" field.
- func (u *AddWechatFriendLogUpsertOne) SetFindContent(v string) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetFindContent(v)
- })
- }
- // UpdateFindContent sets the "find_content" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateFindContent() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateFindContent()
- })
- }
- // SetMessage sets the "message" field.
- func (u *AddWechatFriendLogUpsertOne) SetMessage(v string) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetMessage(v)
- })
- }
- // UpdateMessage sets the "message" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateMessage() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateMessage()
- })
- }
- // SetFindRequest sets the "find_request" field.
- func (u *AddWechatFriendLogUpsertOne) SetFindRequest(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetFindRequest(v)
- })
- }
- // UpdateFindRequest sets the "find_request" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateFindRequest() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateFindRequest()
- })
- }
- // ClearFindRequest clears the value of the "find_request" field.
- func (u *AddWechatFriendLogUpsertOne) ClearFindRequest() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearFindRequest()
- })
- }
- // SetFindResult sets the "find_result" field.
- func (u *AddWechatFriendLogUpsertOne) SetFindResult(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetFindResult(v)
- })
- }
- // UpdateFindResult sets the "find_result" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateFindResult() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateFindResult()
- })
- }
- // ClearFindResult clears the value of the "find_result" field.
- func (u *AddWechatFriendLogUpsertOne) ClearFindResult() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearFindResult()
- })
- }
- // SetIsCanAdd sets the "is_can_add" field.
- func (u *AddWechatFriendLogUpsertOne) SetIsCanAdd(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetIsCanAdd(v)
- })
- }
- // AddIsCanAdd adds v to the "is_can_add" field.
- func (u *AddWechatFriendLogUpsertOne) AddIsCanAdd(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddIsCanAdd(v)
- })
- }
- // UpdateIsCanAdd sets the "is_can_add" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateIsCanAdd() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateIsCanAdd()
- })
- }
- // SetTaskCount sets the "task_count" field.
- func (u *AddWechatFriendLogUpsertOne) SetTaskCount(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetTaskCount(v)
- })
- }
- // AddTaskCount adds v to the "task_count" field.
- func (u *AddWechatFriendLogUpsertOne) AddTaskCount(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddTaskCount(v)
- })
- }
- // UpdateTaskCount sets the "task_count" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateTaskCount() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateTaskCount()
- })
- }
- // SetTaskID sets the "task_id" field.
- func (u *AddWechatFriendLogUpsertOne) SetTaskID(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetTaskID(v)
- })
- }
- // AddTaskID adds v to the "task_id" field.
- func (u *AddWechatFriendLogUpsertOne) AddTaskID(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddTaskID(v)
- })
- }
- // UpdateTaskID sets the "task_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateTaskID() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateTaskID()
- })
- }
- // SetAddRequest sets the "add_request" field.
- func (u *AddWechatFriendLogUpsertOne) SetAddRequest(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetAddRequest(v)
- })
- }
- // UpdateAddRequest sets the "add_request" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateAddRequest() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateAddRequest()
- })
- }
- // ClearAddRequest clears the value of the "add_request" field.
- func (u *AddWechatFriendLogUpsertOne) ClearAddRequest() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearAddRequest()
- })
- }
- // SetAddResult sets the "add_result" field.
- func (u *AddWechatFriendLogUpsertOne) SetAddResult(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetAddResult(v)
- })
- }
- // UpdateAddResult sets the "add_result" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateAddResult() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateAddResult()
- })
- }
- // ClearAddResult clears the value of the "add_result" field.
- func (u *AddWechatFriendLogUpsertOne) ClearAddResult() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearAddResult()
- })
- }
- // SetCreatedAt sets the "created_at" field.
- func (u *AddWechatFriendLogUpsertOne) SetCreatedAt(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetCreatedAt(v)
- })
- }
- // AddCreatedAt adds v to the "created_at" field.
- func (u *AddWechatFriendLogUpsertOne) AddCreatedAt(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddCreatedAt(v)
- })
- }
- // UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateCreatedAt() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateCreatedAt()
- })
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AddWechatFriendLogUpsertOne) SetUpdatedAt(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // AddUpdatedAt adds v to the "updated_at" field.
- func (u *AddWechatFriendLogUpsertOne) AddUpdatedAt(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateUpdatedAt() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetSource sets the "source" field.
- func (u *AddWechatFriendLogUpsertOne) SetSource(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetSource(v)
- })
- }
- // AddSource adds v to the "source" field.
- func (u *AddWechatFriendLogUpsertOne) AddSource(v int) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddSource(v)
- })
- }
- // UpdateSource sets the "source" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateSource() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateSource()
- })
- }
- // SetNickName sets the "nick_name" field.
- func (u *AddWechatFriendLogUpsertOne) SetNickName(v string) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetNickName(v)
- })
- }
- // UpdateNickName sets the "nick_name" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateNickName() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateNickName()
- })
- }
- // SetAvatar sets the "avatar" field.
- func (u *AddWechatFriendLogUpsertOne) SetAvatar(v string) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetAvatar(v)
- })
- }
- // UpdateAvatar sets the "avatar" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateAvatar() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateAvatar()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *AddWechatFriendLogUpsertOne) SetOrganizationID(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *AddWechatFriendLogUpsertOne) AddOrganizationID(v int64) *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertOne) UpdateOrganizationID() *AddWechatFriendLogUpsertOne {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // Exec executes the query.
- func (u *AddWechatFriendLogUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for AddWechatFriendLogCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *AddWechatFriendLogUpsertOne) 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 *AddWechatFriendLogUpsertOne) ID(ctx context.Context) (id int64, 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 *AddWechatFriendLogUpsertOne) IDX(ctx context.Context) int64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // AddWechatFriendLogCreateBulk is the builder for creating many AddWechatFriendLog entities in bulk.
- type AddWechatFriendLogCreateBulk struct {
- config
- err error
- builders []*AddWechatFriendLogCreate
- conflict []sql.ConflictOption
- }
- // Save creates the AddWechatFriendLog entities in the database.
- func (awflcb *AddWechatFriendLogCreateBulk) Save(ctx context.Context) ([]*AddWechatFriendLog, error) {
- if awflcb.err != nil {
- return nil, awflcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(awflcb.builders))
- nodes := make([]*AddWechatFriendLog, len(awflcb.builders))
- mutators := make([]Mutator, len(awflcb.builders))
- for i := range awflcb.builders {
- func(i int, root context.Context) {
- builder := awflcb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*AddWechatFriendLogMutation)
- 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, awflcb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = awflcb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, awflcb.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 = int64(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, awflcb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (awflcb *AddWechatFriendLogCreateBulk) SaveX(ctx context.Context) []*AddWechatFriendLog {
- v, err := awflcb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (awflcb *AddWechatFriendLogCreateBulk) Exec(ctx context.Context) error {
- _, err := awflcb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (awflcb *AddWechatFriendLogCreateBulk) ExecX(ctx context.Context) {
- if err := awflcb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.AddWechatFriendLog.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.AddWechatFriendLogUpsert) {
- // SetOwnerWxID(v+v).
- // }).
- // Exec(ctx)
- func (awflcb *AddWechatFriendLogCreateBulk) OnConflict(opts ...sql.ConflictOption) *AddWechatFriendLogUpsertBulk {
- awflcb.conflict = opts
- return &AddWechatFriendLogUpsertBulk{
- create: awflcb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.AddWechatFriendLog.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (awflcb *AddWechatFriendLogCreateBulk) OnConflictColumns(columns ...string) *AddWechatFriendLogUpsertBulk {
- awflcb.conflict = append(awflcb.conflict, sql.ConflictColumns(columns...))
- return &AddWechatFriendLogUpsertBulk{
- create: awflcb,
- }
- }
- // AddWechatFriendLogUpsertBulk is the builder for "upsert"-ing
- // a bulk of AddWechatFriendLog nodes.
- type AddWechatFriendLogUpsertBulk struct {
- create *AddWechatFriendLogCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.AddWechatFriendLog.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(addwechatfriendlog.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *AddWechatFriendLogUpsertBulk) UpdateNewValues() *AddWechatFriendLogUpsertBulk {
- 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(addwechatfriendlog.FieldID)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.AddWechatFriendLog.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *AddWechatFriendLogUpsertBulk) Ignore() *AddWechatFriendLogUpsertBulk {
- 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 *AddWechatFriendLogUpsertBulk) DoNothing() *AddWechatFriendLogUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the AddWechatFriendLogCreateBulk.OnConflict
- // documentation for more info.
- func (u *AddWechatFriendLogUpsertBulk) Update(set func(*AddWechatFriendLogUpsert)) *AddWechatFriendLogUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&AddWechatFriendLogUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetOwnerWxID sets the "owner_wx_id" field.
- func (u *AddWechatFriendLogUpsertBulk) SetOwnerWxID(v string) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetOwnerWxID(v)
- })
- }
- // UpdateOwnerWxID sets the "owner_wx_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateOwnerWxID() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateOwnerWxID()
- })
- }
- // SetOwnerWxType sets the "owner_wx_type" field.
- func (u *AddWechatFriendLogUpsertBulk) SetOwnerWxType(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetOwnerWxType(v)
- })
- }
- // AddOwnerWxType adds v to the "owner_wx_type" field.
- func (u *AddWechatFriendLogUpsertBulk) AddOwnerWxType(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddOwnerWxType(v)
- })
- }
- // UpdateOwnerWxType sets the "owner_wx_type" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateOwnerWxType() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateOwnerWxType()
- })
- }
- // SetFindContent sets the "find_content" field.
- func (u *AddWechatFriendLogUpsertBulk) SetFindContent(v string) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetFindContent(v)
- })
- }
- // UpdateFindContent sets the "find_content" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateFindContent() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateFindContent()
- })
- }
- // SetMessage sets the "message" field.
- func (u *AddWechatFriendLogUpsertBulk) SetMessage(v string) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetMessage(v)
- })
- }
- // UpdateMessage sets the "message" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateMessage() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateMessage()
- })
- }
- // SetFindRequest sets the "find_request" field.
- func (u *AddWechatFriendLogUpsertBulk) SetFindRequest(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetFindRequest(v)
- })
- }
- // UpdateFindRequest sets the "find_request" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateFindRequest() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateFindRequest()
- })
- }
- // ClearFindRequest clears the value of the "find_request" field.
- func (u *AddWechatFriendLogUpsertBulk) ClearFindRequest() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearFindRequest()
- })
- }
- // SetFindResult sets the "find_result" field.
- func (u *AddWechatFriendLogUpsertBulk) SetFindResult(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetFindResult(v)
- })
- }
- // UpdateFindResult sets the "find_result" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateFindResult() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateFindResult()
- })
- }
- // ClearFindResult clears the value of the "find_result" field.
- func (u *AddWechatFriendLogUpsertBulk) ClearFindResult() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearFindResult()
- })
- }
- // SetIsCanAdd sets the "is_can_add" field.
- func (u *AddWechatFriendLogUpsertBulk) SetIsCanAdd(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetIsCanAdd(v)
- })
- }
- // AddIsCanAdd adds v to the "is_can_add" field.
- func (u *AddWechatFriendLogUpsertBulk) AddIsCanAdd(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddIsCanAdd(v)
- })
- }
- // UpdateIsCanAdd sets the "is_can_add" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateIsCanAdd() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateIsCanAdd()
- })
- }
- // SetTaskCount sets the "task_count" field.
- func (u *AddWechatFriendLogUpsertBulk) SetTaskCount(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetTaskCount(v)
- })
- }
- // AddTaskCount adds v to the "task_count" field.
- func (u *AddWechatFriendLogUpsertBulk) AddTaskCount(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddTaskCount(v)
- })
- }
- // UpdateTaskCount sets the "task_count" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateTaskCount() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateTaskCount()
- })
- }
- // SetTaskID sets the "task_id" field.
- func (u *AddWechatFriendLogUpsertBulk) SetTaskID(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetTaskID(v)
- })
- }
- // AddTaskID adds v to the "task_id" field.
- func (u *AddWechatFriendLogUpsertBulk) AddTaskID(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddTaskID(v)
- })
- }
- // UpdateTaskID sets the "task_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateTaskID() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateTaskID()
- })
- }
- // SetAddRequest sets the "add_request" field.
- func (u *AddWechatFriendLogUpsertBulk) SetAddRequest(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetAddRequest(v)
- })
- }
- // UpdateAddRequest sets the "add_request" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateAddRequest() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateAddRequest()
- })
- }
- // ClearAddRequest clears the value of the "add_request" field.
- func (u *AddWechatFriendLogUpsertBulk) ClearAddRequest() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearAddRequest()
- })
- }
- // SetAddResult sets the "add_result" field.
- func (u *AddWechatFriendLogUpsertBulk) SetAddResult(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetAddResult(v)
- })
- }
- // UpdateAddResult sets the "add_result" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateAddResult() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateAddResult()
- })
- }
- // ClearAddResult clears the value of the "add_result" field.
- func (u *AddWechatFriendLogUpsertBulk) ClearAddResult() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.ClearAddResult()
- })
- }
- // SetCreatedAt sets the "created_at" field.
- func (u *AddWechatFriendLogUpsertBulk) SetCreatedAt(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetCreatedAt(v)
- })
- }
- // AddCreatedAt adds v to the "created_at" field.
- func (u *AddWechatFriendLogUpsertBulk) AddCreatedAt(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddCreatedAt(v)
- })
- }
- // UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateCreatedAt() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateCreatedAt()
- })
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AddWechatFriendLogUpsertBulk) SetUpdatedAt(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // AddUpdatedAt adds v to the "updated_at" field.
- func (u *AddWechatFriendLogUpsertBulk) AddUpdatedAt(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateUpdatedAt() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetSource sets the "source" field.
- func (u *AddWechatFriendLogUpsertBulk) SetSource(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetSource(v)
- })
- }
- // AddSource adds v to the "source" field.
- func (u *AddWechatFriendLogUpsertBulk) AddSource(v int) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddSource(v)
- })
- }
- // UpdateSource sets the "source" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateSource() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateSource()
- })
- }
- // SetNickName sets the "nick_name" field.
- func (u *AddWechatFriendLogUpsertBulk) SetNickName(v string) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetNickName(v)
- })
- }
- // UpdateNickName sets the "nick_name" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateNickName() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateNickName()
- })
- }
- // SetAvatar sets the "avatar" field.
- func (u *AddWechatFriendLogUpsertBulk) SetAvatar(v string) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetAvatar(v)
- })
- }
- // UpdateAvatar sets the "avatar" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateAvatar() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateAvatar()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *AddWechatFriendLogUpsertBulk) SetOrganizationID(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *AddWechatFriendLogUpsertBulk) AddOrganizationID(v int64) *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *AddWechatFriendLogUpsertBulk) UpdateOrganizationID() *AddWechatFriendLogUpsertBulk {
- return u.Update(func(s *AddWechatFriendLogUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // Exec executes the query.
- func (u *AddWechatFriendLogUpsertBulk) 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 AddWechatFriendLogCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for AddWechatFriendLogCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *AddWechatFriendLogUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|