12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352 |
- // 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
- }
- // 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
- }
- // 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.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)
- }
- }
- // 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.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"`)}
- }
- 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.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
- }
- 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
- }
- // 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
- }
- // 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()
- })
- }
- // 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()
- })
- }
- // 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()
- })
- }
- // 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()
- })
- }
- // 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)
- }
- }
|