addwechatfriendlog_update.go 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. // Code generated by ent, DO NOT EDIT.
  2. package ent
  3. import (
  4. "context"
  5. "errors"
  6. "fmt"
  7. "wechat-api/ent/addwechatfriendlog"
  8. "wechat-api/ent/predicate"
  9. "entgo.io/ent/dialect/sql"
  10. "entgo.io/ent/dialect/sql/sqlgraph"
  11. "entgo.io/ent/schema/field"
  12. )
  13. // AddWechatFriendLogUpdate is the builder for updating AddWechatFriendLog entities.
  14. type AddWechatFriendLogUpdate struct {
  15. config
  16. hooks []Hook
  17. mutation *AddWechatFriendLogMutation
  18. }
  19. // Where appends a list predicates to the AddWechatFriendLogUpdate builder.
  20. func (awflu *AddWechatFriendLogUpdate) Where(ps ...predicate.AddWechatFriendLog) *AddWechatFriendLogUpdate {
  21. awflu.mutation.Where(ps...)
  22. return awflu
  23. }
  24. // SetOwnerWxID sets the "owner_wx_id" field.
  25. func (awflu *AddWechatFriendLogUpdate) SetOwnerWxID(s string) *AddWechatFriendLogUpdate {
  26. awflu.mutation.SetOwnerWxID(s)
  27. return awflu
  28. }
  29. // SetNillableOwnerWxID sets the "owner_wx_id" field if the given value is not nil.
  30. func (awflu *AddWechatFriendLogUpdate) SetNillableOwnerWxID(s *string) *AddWechatFriendLogUpdate {
  31. if s != nil {
  32. awflu.SetOwnerWxID(*s)
  33. }
  34. return awflu
  35. }
  36. // SetOwnerWxType sets the "owner_wx_type" field.
  37. func (awflu *AddWechatFriendLogUpdate) SetOwnerWxType(i int) *AddWechatFriendLogUpdate {
  38. awflu.mutation.ResetOwnerWxType()
  39. awflu.mutation.SetOwnerWxType(i)
  40. return awflu
  41. }
  42. // SetNillableOwnerWxType sets the "owner_wx_type" field if the given value is not nil.
  43. func (awflu *AddWechatFriendLogUpdate) SetNillableOwnerWxType(i *int) *AddWechatFriendLogUpdate {
  44. if i != nil {
  45. awflu.SetOwnerWxType(*i)
  46. }
  47. return awflu
  48. }
  49. // AddOwnerWxType adds i to the "owner_wx_type" field.
  50. func (awflu *AddWechatFriendLogUpdate) AddOwnerWxType(i int) *AddWechatFriendLogUpdate {
  51. awflu.mutation.AddOwnerWxType(i)
  52. return awflu
  53. }
  54. // SetFindContent sets the "find_content" field.
  55. func (awflu *AddWechatFriendLogUpdate) SetFindContent(s string) *AddWechatFriendLogUpdate {
  56. awflu.mutation.SetFindContent(s)
  57. return awflu
  58. }
  59. // SetNillableFindContent sets the "find_content" field if the given value is not nil.
  60. func (awflu *AddWechatFriendLogUpdate) SetNillableFindContent(s *string) *AddWechatFriendLogUpdate {
  61. if s != nil {
  62. awflu.SetFindContent(*s)
  63. }
  64. return awflu
  65. }
  66. // SetMessage sets the "message" field.
  67. func (awflu *AddWechatFriendLogUpdate) SetMessage(s string) *AddWechatFriendLogUpdate {
  68. awflu.mutation.SetMessage(s)
  69. return awflu
  70. }
  71. // SetNillableMessage sets the "message" field if the given value is not nil.
  72. func (awflu *AddWechatFriendLogUpdate) SetNillableMessage(s *string) *AddWechatFriendLogUpdate {
  73. if s != nil {
  74. awflu.SetMessage(*s)
  75. }
  76. return awflu
  77. }
  78. // SetFindRequest sets the "find_request" field.
  79. func (awflu *AddWechatFriendLogUpdate) SetFindRequest(m map[string]interface{}) *AddWechatFriendLogUpdate {
  80. awflu.mutation.SetFindRequest(m)
  81. return awflu
  82. }
  83. // ClearFindRequest clears the value of the "find_request" field.
  84. func (awflu *AddWechatFriendLogUpdate) ClearFindRequest() *AddWechatFriendLogUpdate {
  85. awflu.mutation.ClearFindRequest()
  86. return awflu
  87. }
  88. // SetFindResult sets the "find_result" field.
  89. func (awflu *AddWechatFriendLogUpdate) SetFindResult(m map[string]interface{}) *AddWechatFriendLogUpdate {
  90. awflu.mutation.SetFindResult(m)
  91. return awflu
  92. }
  93. // ClearFindResult clears the value of the "find_result" field.
  94. func (awflu *AddWechatFriendLogUpdate) ClearFindResult() *AddWechatFriendLogUpdate {
  95. awflu.mutation.ClearFindResult()
  96. return awflu
  97. }
  98. // SetIsCanAdd sets the "is_can_add" field.
  99. func (awflu *AddWechatFriendLogUpdate) SetIsCanAdd(i int) *AddWechatFriendLogUpdate {
  100. awflu.mutation.ResetIsCanAdd()
  101. awflu.mutation.SetIsCanAdd(i)
  102. return awflu
  103. }
  104. // SetNillableIsCanAdd sets the "is_can_add" field if the given value is not nil.
  105. func (awflu *AddWechatFriendLogUpdate) SetNillableIsCanAdd(i *int) *AddWechatFriendLogUpdate {
  106. if i != nil {
  107. awflu.SetIsCanAdd(*i)
  108. }
  109. return awflu
  110. }
  111. // AddIsCanAdd adds i to the "is_can_add" field.
  112. func (awflu *AddWechatFriendLogUpdate) AddIsCanAdd(i int) *AddWechatFriendLogUpdate {
  113. awflu.mutation.AddIsCanAdd(i)
  114. return awflu
  115. }
  116. // SetTaskCount sets the "task_count" field.
  117. func (awflu *AddWechatFriendLogUpdate) SetTaskCount(i int) *AddWechatFriendLogUpdate {
  118. awflu.mutation.ResetTaskCount()
  119. awflu.mutation.SetTaskCount(i)
  120. return awflu
  121. }
  122. // SetNillableTaskCount sets the "task_count" field if the given value is not nil.
  123. func (awflu *AddWechatFriendLogUpdate) SetNillableTaskCount(i *int) *AddWechatFriendLogUpdate {
  124. if i != nil {
  125. awflu.SetTaskCount(*i)
  126. }
  127. return awflu
  128. }
  129. // AddTaskCount adds i to the "task_count" field.
  130. func (awflu *AddWechatFriendLogUpdate) AddTaskCount(i int) *AddWechatFriendLogUpdate {
  131. awflu.mutation.AddTaskCount(i)
  132. return awflu
  133. }
  134. // SetTaskID sets the "task_id" field.
  135. func (awflu *AddWechatFriendLogUpdate) SetTaskID(i int64) *AddWechatFriendLogUpdate {
  136. awflu.mutation.ResetTaskID()
  137. awflu.mutation.SetTaskID(i)
  138. return awflu
  139. }
  140. // SetNillableTaskID sets the "task_id" field if the given value is not nil.
  141. func (awflu *AddWechatFriendLogUpdate) SetNillableTaskID(i *int64) *AddWechatFriendLogUpdate {
  142. if i != nil {
  143. awflu.SetTaskID(*i)
  144. }
  145. return awflu
  146. }
  147. // AddTaskID adds i to the "task_id" field.
  148. func (awflu *AddWechatFriendLogUpdate) AddTaskID(i int64) *AddWechatFriendLogUpdate {
  149. awflu.mutation.AddTaskID(i)
  150. return awflu
  151. }
  152. // SetAddRequest sets the "add_request" field.
  153. func (awflu *AddWechatFriendLogUpdate) SetAddRequest(m map[string]interface{}) *AddWechatFriendLogUpdate {
  154. awflu.mutation.SetAddRequest(m)
  155. return awflu
  156. }
  157. // ClearAddRequest clears the value of the "add_request" field.
  158. func (awflu *AddWechatFriendLogUpdate) ClearAddRequest() *AddWechatFriendLogUpdate {
  159. awflu.mutation.ClearAddRequest()
  160. return awflu
  161. }
  162. // SetAddResult sets the "add_result" field.
  163. func (awflu *AddWechatFriendLogUpdate) SetAddResult(m map[string]interface{}) *AddWechatFriendLogUpdate {
  164. awflu.mutation.SetAddResult(m)
  165. return awflu
  166. }
  167. // ClearAddResult clears the value of the "add_result" field.
  168. func (awflu *AddWechatFriendLogUpdate) ClearAddResult() *AddWechatFriendLogUpdate {
  169. awflu.mutation.ClearAddResult()
  170. return awflu
  171. }
  172. // SetCreatedAt sets the "created_at" field.
  173. func (awflu *AddWechatFriendLogUpdate) SetCreatedAt(i int64) *AddWechatFriendLogUpdate {
  174. awflu.mutation.ResetCreatedAt()
  175. awflu.mutation.SetCreatedAt(i)
  176. return awflu
  177. }
  178. // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
  179. func (awflu *AddWechatFriendLogUpdate) SetNillableCreatedAt(i *int64) *AddWechatFriendLogUpdate {
  180. if i != nil {
  181. awflu.SetCreatedAt(*i)
  182. }
  183. return awflu
  184. }
  185. // AddCreatedAt adds i to the "created_at" field.
  186. func (awflu *AddWechatFriendLogUpdate) AddCreatedAt(i int64) *AddWechatFriendLogUpdate {
  187. awflu.mutation.AddCreatedAt(i)
  188. return awflu
  189. }
  190. // SetUpdatedAt sets the "updated_at" field.
  191. func (awflu *AddWechatFriendLogUpdate) SetUpdatedAt(i int64) *AddWechatFriendLogUpdate {
  192. awflu.mutation.ResetUpdatedAt()
  193. awflu.mutation.SetUpdatedAt(i)
  194. return awflu
  195. }
  196. // AddUpdatedAt adds i to the "updated_at" field.
  197. func (awflu *AddWechatFriendLogUpdate) AddUpdatedAt(i int64) *AddWechatFriendLogUpdate {
  198. awflu.mutation.AddUpdatedAt(i)
  199. return awflu
  200. }
  201. // SetSource sets the "source" field.
  202. func (awflu *AddWechatFriendLogUpdate) SetSource(i int) *AddWechatFriendLogUpdate {
  203. awflu.mutation.ResetSource()
  204. awflu.mutation.SetSource(i)
  205. return awflu
  206. }
  207. // SetNillableSource sets the "source" field if the given value is not nil.
  208. func (awflu *AddWechatFriendLogUpdate) SetNillableSource(i *int) *AddWechatFriendLogUpdate {
  209. if i != nil {
  210. awflu.SetSource(*i)
  211. }
  212. return awflu
  213. }
  214. // AddSource adds i to the "source" field.
  215. func (awflu *AddWechatFriendLogUpdate) AddSource(i int) *AddWechatFriendLogUpdate {
  216. awflu.mutation.AddSource(i)
  217. return awflu
  218. }
  219. // SetNickName sets the "nick_name" field.
  220. func (awflu *AddWechatFriendLogUpdate) SetNickName(s string) *AddWechatFriendLogUpdate {
  221. awflu.mutation.SetNickName(s)
  222. return awflu
  223. }
  224. // SetNillableNickName sets the "nick_name" field if the given value is not nil.
  225. func (awflu *AddWechatFriendLogUpdate) SetNillableNickName(s *string) *AddWechatFriendLogUpdate {
  226. if s != nil {
  227. awflu.SetNickName(*s)
  228. }
  229. return awflu
  230. }
  231. // SetAvatar sets the "avatar" field.
  232. func (awflu *AddWechatFriendLogUpdate) SetAvatar(s string) *AddWechatFriendLogUpdate {
  233. awflu.mutation.SetAvatar(s)
  234. return awflu
  235. }
  236. // SetNillableAvatar sets the "avatar" field if the given value is not nil.
  237. func (awflu *AddWechatFriendLogUpdate) SetNillableAvatar(s *string) *AddWechatFriendLogUpdate {
  238. if s != nil {
  239. awflu.SetAvatar(*s)
  240. }
  241. return awflu
  242. }
  243. // SetOrganizationID sets the "organization_id" field.
  244. func (awflu *AddWechatFriendLogUpdate) SetOrganizationID(i int64) *AddWechatFriendLogUpdate {
  245. awflu.mutation.ResetOrganizationID()
  246. awflu.mutation.SetOrganizationID(i)
  247. return awflu
  248. }
  249. // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
  250. func (awflu *AddWechatFriendLogUpdate) SetNillableOrganizationID(i *int64) *AddWechatFriendLogUpdate {
  251. if i != nil {
  252. awflu.SetOrganizationID(*i)
  253. }
  254. return awflu
  255. }
  256. // AddOrganizationID adds i to the "organization_id" field.
  257. func (awflu *AddWechatFriendLogUpdate) AddOrganizationID(i int64) *AddWechatFriendLogUpdate {
  258. awflu.mutation.AddOrganizationID(i)
  259. return awflu
  260. }
  261. // Mutation returns the AddWechatFriendLogMutation object of the builder.
  262. func (awflu *AddWechatFriendLogUpdate) Mutation() *AddWechatFriendLogMutation {
  263. return awflu.mutation
  264. }
  265. // Save executes the query and returns the number of nodes affected by the update operation.
  266. func (awflu *AddWechatFriendLogUpdate) Save(ctx context.Context) (int, error) {
  267. awflu.defaults()
  268. return withHooks(ctx, awflu.sqlSave, awflu.mutation, awflu.hooks)
  269. }
  270. // SaveX is like Save, but panics if an error occurs.
  271. func (awflu *AddWechatFriendLogUpdate) SaveX(ctx context.Context) int {
  272. affected, err := awflu.Save(ctx)
  273. if err != nil {
  274. panic(err)
  275. }
  276. return affected
  277. }
  278. // Exec executes the query.
  279. func (awflu *AddWechatFriendLogUpdate) Exec(ctx context.Context) error {
  280. _, err := awflu.Save(ctx)
  281. return err
  282. }
  283. // ExecX is like Exec, but panics if an error occurs.
  284. func (awflu *AddWechatFriendLogUpdate) ExecX(ctx context.Context) {
  285. if err := awflu.Exec(ctx); err != nil {
  286. panic(err)
  287. }
  288. }
  289. // defaults sets the default values of the builder before save.
  290. func (awflu *AddWechatFriendLogUpdate) defaults() {
  291. if _, ok := awflu.mutation.UpdatedAt(); !ok {
  292. v := addwechatfriendlog.UpdateDefaultUpdatedAt()
  293. awflu.mutation.SetUpdatedAt(v)
  294. }
  295. }
  296. // check runs all checks and user-defined validators on the builder.
  297. func (awflu *AddWechatFriendLogUpdate) check() error {
  298. if v, ok := awflu.mutation.OwnerWxID(); ok {
  299. if err := addwechatfriendlog.OwnerWxIDValidator(v); err != nil {
  300. return &ValidationError{Name: "owner_wx_id", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.owner_wx_id": %w`, err)}
  301. }
  302. }
  303. if v, ok := awflu.mutation.FindContent(); ok {
  304. if err := addwechatfriendlog.FindContentValidator(v); err != nil {
  305. return &ValidationError{Name: "find_content", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.find_content": %w`, err)}
  306. }
  307. }
  308. if v, ok := awflu.mutation.Message(); ok {
  309. if err := addwechatfriendlog.MessageValidator(v); err != nil {
  310. return &ValidationError{Name: "message", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.message": %w`, err)}
  311. }
  312. }
  313. if v, ok := awflu.mutation.NickName(); ok {
  314. if err := addwechatfriendlog.NickNameValidator(v); err != nil {
  315. return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.nick_name": %w`, err)}
  316. }
  317. }
  318. if v, ok := awflu.mutation.Avatar(); ok {
  319. if err := addwechatfriendlog.AvatarValidator(v); err != nil {
  320. return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.avatar": %w`, err)}
  321. }
  322. }
  323. return nil
  324. }
  325. func (awflu *AddWechatFriendLogUpdate) sqlSave(ctx context.Context) (n int, err error) {
  326. if err := awflu.check(); err != nil {
  327. return n, err
  328. }
  329. _spec := sqlgraph.NewUpdateSpec(addwechatfriendlog.Table, addwechatfriendlog.Columns, sqlgraph.NewFieldSpec(addwechatfriendlog.FieldID, field.TypeInt64))
  330. if ps := awflu.mutation.predicates; len(ps) > 0 {
  331. _spec.Predicate = func(selector *sql.Selector) {
  332. for i := range ps {
  333. ps[i](selector)
  334. }
  335. }
  336. }
  337. if value, ok := awflu.mutation.OwnerWxID(); ok {
  338. _spec.SetField(addwechatfriendlog.FieldOwnerWxID, field.TypeString, value)
  339. }
  340. if value, ok := awflu.mutation.OwnerWxType(); ok {
  341. _spec.SetField(addwechatfriendlog.FieldOwnerWxType, field.TypeInt, value)
  342. }
  343. if value, ok := awflu.mutation.AddedOwnerWxType(); ok {
  344. _spec.AddField(addwechatfriendlog.FieldOwnerWxType, field.TypeInt, value)
  345. }
  346. if value, ok := awflu.mutation.FindContent(); ok {
  347. _spec.SetField(addwechatfriendlog.FieldFindContent, field.TypeString, value)
  348. }
  349. if value, ok := awflu.mutation.Message(); ok {
  350. _spec.SetField(addwechatfriendlog.FieldMessage, field.TypeString, value)
  351. }
  352. if value, ok := awflu.mutation.FindRequest(); ok {
  353. _spec.SetField(addwechatfriendlog.FieldFindRequest, field.TypeJSON, value)
  354. }
  355. if awflu.mutation.FindRequestCleared() {
  356. _spec.ClearField(addwechatfriendlog.FieldFindRequest, field.TypeJSON)
  357. }
  358. if value, ok := awflu.mutation.FindResult(); ok {
  359. _spec.SetField(addwechatfriendlog.FieldFindResult, field.TypeJSON, value)
  360. }
  361. if awflu.mutation.FindResultCleared() {
  362. _spec.ClearField(addwechatfriendlog.FieldFindResult, field.TypeJSON)
  363. }
  364. if value, ok := awflu.mutation.IsCanAdd(); ok {
  365. _spec.SetField(addwechatfriendlog.FieldIsCanAdd, field.TypeInt, value)
  366. }
  367. if value, ok := awflu.mutation.AddedIsCanAdd(); ok {
  368. _spec.AddField(addwechatfriendlog.FieldIsCanAdd, field.TypeInt, value)
  369. }
  370. if value, ok := awflu.mutation.TaskCount(); ok {
  371. _spec.SetField(addwechatfriendlog.FieldTaskCount, field.TypeInt, value)
  372. }
  373. if value, ok := awflu.mutation.AddedTaskCount(); ok {
  374. _spec.AddField(addwechatfriendlog.FieldTaskCount, field.TypeInt, value)
  375. }
  376. if value, ok := awflu.mutation.TaskID(); ok {
  377. _spec.SetField(addwechatfriendlog.FieldTaskID, field.TypeInt64, value)
  378. }
  379. if value, ok := awflu.mutation.AddedTaskID(); ok {
  380. _spec.AddField(addwechatfriendlog.FieldTaskID, field.TypeInt64, value)
  381. }
  382. if value, ok := awflu.mutation.AddRequest(); ok {
  383. _spec.SetField(addwechatfriendlog.FieldAddRequest, field.TypeJSON, value)
  384. }
  385. if awflu.mutation.AddRequestCleared() {
  386. _spec.ClearField(addwechatfriendlog.FieldAddRequest, field.TypeJSON)
  387. }
  388. if value, ok := awflu.mutation.AddResult(); ok {
  389. _spec.SetField(addwechatfriendlog.FieldAddResult, field.TypeJSON, value)
  390. }
  391. if awflu.mutation.AddResultCleared() {
  392. _spec.ClearField(addwechatfriendlog.FieldAddResult, field.TypeJSON)
  393. }
  394. if value, ok := awflu.mutation.CreatedAt(); ok {
  395. _spec.SetField(addwechatfriendlog.FieldCreatedAt, field.TypeInt64, value)
  396. }
  397. if value, ok := awflu.mutation.AddedCreatedAt(); ok {
  398. _spec.AddField(addwechatfriendlog.FieldCreatedAt, field.TypeInt64, value)
  399. }
  400. if value, ok := awflu.mutation.UpdatedAt(); ok {
  401. _spec.SetField(addwechatfriendlog.FieldUpdatedAt, field.TypeInt64, value)
  402. }
  403. if value, ok := awflu.mutation.AddedUpdatedAt(); ok {
  404. _spec.AddField(addwechatfriendlog.FieldUpdatedAt, field.TypeInt64, value)
  405. }
  406. if value, ok := awflu.mutation.Source(); ok {
  407. _spec.SetField(addwechatfriendlog.FieldSource, field.TypeInt, value)
  408. }
  409. if value, ok := awflu.mutation.AddedSource(); ok {
  410. _spec.AddField(addwechatfriendlog.FieldSource, field.TypeInt, value)
  411. }
  412. if value, ok := awflu.mutation.NickName(); ok {
  413. _spec.SetField(addwechatfriendlog.FieldNickName, field.TypeString, value)
  414. }
  415. if value, ok := awflu.mutation.Avatar(); ok {
  416. _spec.SetField(addwechatfriendlog.FieldAvatar, field.TypeString, value)
  417. }
  418. if value, ok := awflu.mutation.OrganizationID(); ok {
  419. _spec.SetField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
  420. }
  421. if value, ok := awflu.mutation.AddedOrganizationID(); ok {
  422. _spec.AddField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
  423. }
  424. if n, err = sqlgraph.UpdateNodes(ctx, awflu.driver, _spec); err != nil {
  425. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  426. err = &NotFoundError{addwechatfriendlog.Label}
  427. } else if sqlgraph.IsConstraintError(err) {
  428. err = &ConstraintError{msg: err.Error(), wrap: err}
  429. }
  430. return 0, err
  431. }
  432. awflu.mutation.done = true
  433. return n, nil
  434. }
  435. // AddWechatFriendLogUpdateOne is the builder for updating a single AddWechatFriendLog entity.
  436. type AddWechatFriendLogUpdateOne struct {
  437. config
  438. fields []string
  439. hooks []Hook
  440. mutation *AddWechatFriendLogMutation
  441. }
  442. // SetOwnerWxID sets the "owner_wx_id" field.
  443. func (awfluo *AddWechatFriendLogUpdateOne) SetOwnerWxID(s string) *AddWechatFriendLogUpdateOne {
  444. awfluo.mutation.SetOwnerWxID(s)
  445. return awfluo
  446. }
  447. // SetNillableOwnerWxID sets the "owner_wx_id" field if the given value is not nil.
  448. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableOwnerWxID(s *string) *AddWechatFriendLogUpdateOne {
  449. if s != nil {
  450. awfluo.SetOwnerWxID(*s)
  451. }
  452. return awfluo
  453. }
  454. // SetOwnerWxType sets the "owner_wx_type" field.
  455. func (awfluo *AddWechatFriendLogUpdateOne) SetOwnerWxType(i int) *AddWechatFriendLogUpdateOne {
  456. awfluo.mutation.ResetOwnerWxType()
  457. awfluo.mutation.SetOwnerWxType(i)
  458. return awfluo
  459. }
  460. // SetNillableOwnerWxType sets the "owner_wx_type" field if the given value is not nil.
  461. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableOwnerWxType(i *int) *AddWechatFriendLogUpdateOne {
  462. if i != nil {
  463. awfluo.SetOwnerWxType(*i)
  464. }
  465. return awfluo
  466. }
  467. // AddOwnerWxType adds i to the "owner_wx_type" field.
  468. func (awfluo *AddWechatFriendLogUpdateOne) AddOwnerWxType(i int) *AddWechatFriendLogUpdateOne {
  469. awfluo.mutation.AddOwnerWxType(i)
  470. return awfluo
  471. }
  472. // SetFindContent sets the "find_content" field.
  473. func (awfluo *AddWechatFriendLogUpdateOne) SetFindContent(s string) *AddWechatFriendLogUpdateOne {
  474. awfluo.mutation.SetFindContent(s)
  475. return awfluo
  476. }
  477. // SetNillableFindContent sets the "find_content" field if the given value is not nil.
  478. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableFindContent(s *string) *AddWechatFriendLogUpdateOne {
  479. if s != nil {
  480. awfluo.SetFindContent(*s)
  481. }
  482. return awfluo
  483. }
  484. // SetMessage sets the "message" field.
  485. func (awfluo *AddWechatFriendLogUpdateOne) SetMessage(s string) *AddWechatFriendLogUpdateOne {
  486. awfluo.mutation.SetMessage(s)
  487. return awfluo
  488. }
  489. // SetNillableMessage sets the "message" field if the given value is not nil.
  490. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableMessage(s *string) *AddWechatFriendLogUpdateOne {
  491. if s != nil {
  492. awfluo.SetMessage(*s)
  493. }
  494. return awfluo
  495. }
  496. // SetFindRequest sets the "find_request" field.
  497. func (awfluo *AddWechatFriendLogUpdateOne) SetFindRequest(m map[string]interface{}) *AddWechatFriendLogUpdateOne {
  498. awfluo.mutation.SetFindRequest(m)
  499. return awfluo
  500. }
  501. // ClearFindRequest clears the value of the "find_request" field.
  502. func (awfluo *AddWechatFriendLogUpdateOne) ClearFindRequest() *AddWechatFriendLogUpdateOne {
  503. awfluo.mutation.ClearFindRequest()
  504. return awfluo
  505. }
  506. // SetFindResult sets the "find_result" field.
  507. func (awfluo *AddWechatFriendLogUpdateOne) SetFindResult(m map[string]interface{}) *AddWechatFriendLogUpdateOne {
  508. awfluo.mutation.SetFindResult(m)
  509. return awfluo
  510. }
  511. // ClearFindResult clears the value of the "find_result" field.
  512. func (awfluo *AddWechatFriendLogUpdateOne) ClearFindResult() *AddWechatFriendLogUpdateOne {
  513. awfluo.mutation.ClearFindResult()
  514. return awfluo
  515. }
  516. // SetIsCanAdd sets the "is_can_add" field.
  517. func (awfluo *AddWechatFriendLogUpdateOne) SetIsCanAdd(i int) *AddWechatFriendLogUpdateOne {
  518. awfluo.mutation.ResetIsCanAdd()
  519. awfluo.mutation.SetIsCanAdd(i)
  520. return awfluo
  521. }
  522. // SetNillableIsCanAdd sets the "is_can_add" field if the given value is not nil.
  523. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableIsCanAdd(i *int) *AddWechatFriendLogUpdateOne {
  524. if i != nil {
  525. awfluo.SetIsCanAdd(*i)
  526. }
  527. return awfluo
  528. }
  529. // AddIsCanAdd adds i to the "is_can_add" field.
  530. func (awfluo *AddWechatFriendLogUpdateOne) AddIsCanAdd(i int) *AddWechatFriendLogUpdateOne {
  531. awfluo.mutation.AddIsCanAdd(i)
  532. return awfluo
  533. }
  534. // SetTaskCount sets the "task_count" field.
  535. func (awfluo *AddWechatFriendLogUpdateOne) SetTaskCount(i int) *AddWechatFriendLogUpdateOne {
  536. awfluo.mutation.ResetTaskCount()
  537. awfluo.mutation.SetTaskCount(i)
  538. return awfluo
  539. }
  540. // SetNillableTaskCount sets the "task_count" field if the given value is not nil.
  541. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableTaskCount(i *int) *AddWechatFriendLogUpdateOne {
  542. if i != nil {
  543. awfluo.SetTaskCount(*i)
  544. }
  545. return awfluo
  546. }
  547. // AddTaskCount adds i to the "task_count" field.
  548. func (awfluo *AddWechatFriendLogUpdateOne) AddTaskCount(i int) *AddWechatFriendLogUpdateOne {
  549. awfluo.mutation.AddTaskCount(i)
  550. return awfluo
  551. }
  552. // SetTaskID sets the "task_id" field.
  553. func (awfluo *AddWechatFriendLogUpdateOne) SetTaskID(i int64) *AddWechatFriendLogUpdateOne {
  554. awfluo.mutation.ResetTaskID()
  555. awfluo.mutation.SetTaskID(i)
  556. return awfluo
  557. }
  558. // SetNillableTaskID sets the "task_id" field if the given value is not nil.
  559. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableTaskID(i *int64) *AddWechatFriendLogUpdateOne {
  560. if i != nil {
  561. awfluo.SetTaskID(*i)
  562. }
  563. return awfluo
  564. }
  565. // AddTaskID adds i to the "task_id" field.
  566. func (awfluo *AddWechatFriendLogUpdateOne) AddTaskID(i int64) *AddWechatFriendLogUpdateOne {
  567. awfluo.mutation.AddTaskID(i)
  568. return awfluo
  569. }
  570. // SetAddRequest sets the "add_request" field.
  571. func (awfluo *AddWechatFriendLogUpdateOne) SetAddRequest(m map[string]interface{}) *AddWechatFriendLogUpdateOne {
  572. awfluo.mutation.SetAddRequest(m)
  573. return awfluo
  574. }
  575. // ClearAddRequest clears the value of the "add_request" field.
  576. func (awfluo *AddWechatFriendLogUpdateOne) ClearAddRequest() *AddWechatFriendLogUpdateOne {
  577. awfluo.mutation.ClearAddRequest()
  578. return awfluo
  579. }
  580. // SetAddResult sets the "add_result" field.
  581. func (awfluo *AddWechatFriendLogUpdateOne) SetAddResult(m map[string]interface{}) *AddWechatFriendLogUpdateOne {
  582. awfluo.mutation.SetAddResult(m)
  583. return awfluo
  584. }
  585. // ClearAddResult clears the value of the "add_result" field.
  586. func (awfluo *AddWechatFriendLogUpdateOne) ClearAddResult() *AddWechatFriendLogUpdateOne {
  587. awfluo.mutation.ClearAddResult()
  588. return awfluo
  589. }
  590. // SetCreatedAt sets the "created_at" field.
  591. func (awfluo *AddWechatFriendLogUpdateOne) SetCreatedAt(i int64) *AddWechatFriendLogUpdateOne {
  592. awfluo.mutation.ResetCreatedAt()
  593. awfluo.mutation.SetCreatedAt(i)
  594. return awfluo
  595. }
  596. // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
  597. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableCreatedAt(i *int64) *AddWechatFriendLogUpdateOne {
  598. if i != nil {
  599. awfluo.SetCreatedAt(*i)
  600. }
  601. return awfluo
  602. }
  603. // AddCreatedAt adds i to the "created_at" field.
  604. func (awfluo *AddWechatFriendLogUpdateOne) AddCreatedAt(i int64) *AddWechatFriendLogUpdateOne {
  605. awfluo.mutation.AddCreatedAt(i)
  606. return awfluo
  607. }
  608. // SetUpdatedAt sets the "updated_at" field.
  609. func (awfluo *AddWechatFriendLogUpdateOne) SetUpdatedAt(i int64) *AddWechatFriendLogUpdateOne {
  610. awfluo.mutation.ResetUpdatedAt()
  611. awfluo.mutation.SetUpdatedAt(i)
  612. return awfluo
  613. }
  614. // AddUpdatedAt adds i to the "updated_at" field.
  615. func (awfluo *AddWechatFriendLogUpdateOne) AddUpdatedAt(i int64) *AddWechatFriendLogUpdateOne {
  616. awfluo.mutation.AddUpdatedAt(i)
  617. return awfluo
  618. }
  619. // SetSource sets the "source" field.
  620. func (awfluo *AddWechatFriendLogUpdateOne) SetSource(i int) *AddWechatFriendLogUpdateOne {
  621. awfluo.mutation.ResetSource()
  622. awfluo.mutation.SetSource(i)
  623. return awfluo
  624. }
  625. // SetNillableSource sets the "source" field if the given value is not nil.
  626. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableSource(i *int) *AddWechatFriendLogUpdateOne {
  627. if i != nil {
  628. awfluo.SetSource(*i)
  629. }
  630. return awfluo
  631. }
  632. // AddSource adds i to the "source" field.
  633. func (awfluo *AddWechatFriendLogUpdateOne) AddSource(i int) *AddWechatFriendLogUpdateOne {
  634. awfluo.mutation.AddSource(i)
  635. return awfluo
  636. }
  637. // SetNickName sets the "nick_name" field.
  638. func (awfluo *AddWechatFriendLogUpdateOne) SetNickName(s string) *AddWechatFriendLogUpdateOne {
  639. awfluo.mutation.SetNickName(s)
  640. return awfluo
  641. }
  642. // SetNillableNickName sets the "nick_name" field if the given value is not nil.
  643. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableNickName(s *string) *AddWechatFriendLogUpdateOne {
  644. if s != nil {
  645. awfluo.SetNickName(*s)
  646. }
  647. return awfluo
  648. }
  649. // SetAvatar sets the "avatar" field.
  650. func (awfluo *AddWechatFriendLogUpdateOne) SetAvatar(s string) *AddWechatFriendLogUpdateOne {
  651. awfluo.mutation.SetAvatar(s)
  652. return awfluo
  653. }
  654. // SetNillableAvatar sets the "avatar" field if the given value is not nil.
  655. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableAvatar(s *string) *AddWechatFriendLogUpdateOne {
  656. if s != nil {
  657. awfluo.SetAvatar(*s)
  658. }
  659. return awfluo
  660. }
  661. // SetOrganizationID sets the "organization_id" field.
  662. func (awfluo *AddWechatFriendLogUpdateOne) SetOrganizationID(i int64) *AddWechatFriendLogUpdateOne {
  663. awfluo.mutation.ResetOrganizationID()
  664. awfluo.mutation.SetOrganizationID(i)
  665. return awfluo
  666. }
  667. // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
  668. func (awfluo *AddWechatFriendLogUpdateOne) SetNillableOrganizationID(i *int64) *AddWechatFriendLogUpdateOne {
  669. if i != nil {
  670. awfluo.SetOrganizationID(*i)
  671. }
  672. return awfluo
  673. }
  674. // AddOrganizationID adds i to the "organization_id" field.
  675. func (awfluo *AddWechatFriendLogUpdateOne) AddOrganizationID(i int64) *AddWechatFriendLogUpdateOne {
  676. awfluo.mutation.AddOrganizationID(i)
  677. return awfluo
  678. }
  679. // Mutation returns the AddWechatFriendLogMutation object of the builder.
  680. func (awfluo *AddWechatFriendLogUpdateOne) Mutation() *AddWechatFriendLogMutation {
  681. return awfluo.mutation
  682. }
  683. // Where appends a list predicates to the AddWechatFriendLogUpdate builder.
  684. func (awfluo *AddWechatFriendLogUpdateOne) Where(ps ...predicate.AddWechatFriendLog) *AddWechatFriendLogUpdateOne {
  685. awfluo.mutation.Where(ps...)
  686. return awfluo
  687. }
  688. // Select allows selecting one or more fields (columns) of the returned entity.
  689. // The default is selecting all fields defined in the entity schema.
  690. func (awfluo *AddWechatFriendLogUpdateOne) Select(field string, fields ...string) *AddWechatFriendLogUpdateOne {
  691. awfluo.fields = append([]string{field}, fields...)
  692. return awfluo
  693. }
  694. // Save executes the query and returns the updated AddWechatFriendLog entity.
  695. func (awfluo *AddWechatFriendLogUpdateOne) Save(ctx context.Context) (*AddWechatFriendLog, error) {
  696. awfluo.defaults()
  697. return withHooks(ctx, awfluo.sqlSave, awfluo.mutation, awfluo.hooks)
  698. }
  699. // SaveX is like Save, but panics if an error occurs.
  700. func (awfluo *AddWechatFriendLogUpdateOne) SaveX(ctx context.Context) *AddWechatFriendLog {
  701. node, err := awfluo.Save(ctx)
  702. if err != nil {
  703. panic(err)
  704. }
  705. return node
  706. }
  707. // Exec executes the query on the entity.
  708. func (awfluo *AddWechatFriendLogUpdateOne) Exec(ctx context.Context) error {
  709. _, err := awfluo.Save(ctx)
  710. return err
  711. }
  712. // ExecX is like Exec, but panics if an error occurs.
  713. func (awfluo *AddWechatFriendLogUpdateOne) ExecX(ctx context.Context) {
  714. if err := awfluo.Exec(ctx); err != nil {
  715. panic(err)
  716. }
  717. }
  718. // defaults sets the default values of the builder before save.
  719. func (awfluo *AddWechatFriendLogUpdateOne) defaults() {
  720. if _, ok := awfluo.mutation.UpdatedAt(); !ok {
  721. v := addwechatfriendlog.UpdateDefaultUpdatedAt()
  722. awfluo.mutation.SetUpdatedAt(v)
  723. }
  724. }
  725. // check runs all checks and user-defined validators on the builder.
  726. func (awfluo *AddWechatFriendLogUpdateOne) check() error {
  727. if v, ok := awfluo.mutation.OwnerWxID(); ok {
  728. if err := addwechatfriendlog.OwnerWxIDValidator(v); err != nil {
  729. return &ValidationError{Name: "owner_wx_id", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.owner_wx_id": %w`, err)}
  730. }
  731. }
  732. if v, ok := awfluo.mutation.FindContent(); ok {
  733. if err := addwechatfriendlog.FindContentValidator(v); err != nil {
  734. return &ValidationError{Name: "find_content", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.find_content": %w`, err)}
  735. }
  736. }
  737. if v, ok := awfluo.mutation.Message(); ok {
  738. if err := addwechatfriendlog.MessageValidator(v); err != nil {
  739. return &ValidationError{Name: "message", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.message": %w`, err)}
  740. }
  741. }
  742. if v, ok := awfluo.mutation.NickName(); ok {
  743. if err := addwechatfriendlog.NickNameValidator(v); err != nil {
  744. return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.nick_name": %w`, err)}
  745. }
  746. }
  747. if v, ok := awfluo.mutation.Avatar(); ok {
  748. if err := addwechatfriendlog.AvatarValidator(v); err != nil {
  749. return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.avatar": %w`, err)}
  750. }
  751. }
  752. return nil
  753. }
  754. func (awfluo *AddWechatFriendLogUpdateOne) sqlSave(ctx context.Context) (_node *AddWechatFriendLog, err error) {
  755. if err := awfluo.check(); err != nil {
  756. return _node, err
  757. }
  758. _spec := sqlgraph.NewUpdateSpec(addwechatfriendlog.Table, addwechatfriendlog.Columns, sqlgraph.NewFieldSpec(addwechatfriendlog.FieldID, field.TypeInt64))
  759. id, ok := awfluo.mutation.ID()
  760. if !ok {
  761. return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AddWechatFriendLog.id" for update`)}
  762. }
  763. _spec.Node.ID.Value = id
  764. if fields := awfluo.fields; len(fields) > 0 {
  765. _spec.Node.Columns = make([]string, 0, len(fields))
  766. _spec.Node.Columns = append(_spec.Node.Columns, addwechatfriendlog.FieldID)
  767. for _, f := range fields {
  768. if !addwechatfriendlog.ValidColumn(f) {
  769. return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
  770. }
  771. if f != addwechatfriendlog.FieldID {
  772. _spec.Node.Columns = append(_spec.Node.Columns, f)
  773. }
  774. }
  775. }
  776. if ps := awfluo.mutation.predicates; len(ps) > 0 {
  777. _spec.Predicate = func(selector *sql.Selector) {
  778. for i := range ps {
  779. ps[i](selector)
  780. }
  781. }
  782. }
  783. if value, ok := awfluo.mutation.OwnerWxID(); ok {
  784. _spec.SetField(addwechatfriendlog.FieldOwnerWxID, field.TypeString, value)
  785. }
  786. if value, ok := awfluo.mutation.OwnerWxType(); ok {
  787. _spec.SetField(addwechatfriendlog.FieldOwnerWxType, field.TypeInt, value)
  788. }
  789. if value, ok := awfluo.mutation.AddedOwnerWxType(); ok {
  790. _spec.AddField(addwechatfriendlog.FieldOwnerWxType, field.TypeInt, value)
  791. }
  792. if value, ok := awfluo.mutation.FindContent(); ok {
  793. _spec.SetField(addwechatfriendlog.FieldFindContent, field.TypeString, value)
  794. }
  795. if value, ok := awfluo.mutation.Message(); ok {
  796. _spec.SetField(addwechatfriendlog.FieldMessage, field.TypeString, value)
  797. }
  798. if value, ok := awfluo.mutation.FindRequest(); ok {
  799. _spec.SetField(addwechatfriendlog.FieldFindRequest, field.TypeJSON, value)
  800. }
  801. if awfluo.mutation.FindRequestCleared() {
  802. _spec.ClearField(addwechatfriendlog.FieldFindRequest, field.TypeJSON)
  803. }
  804. if value, ok := awfluo.mutation.FindResult(); ok {
  805. _spec.SetField(addwechatfriendlog.FieldFindResult, field.TypeJSON, value)
  806. }
  807. if awfluo.mutation.FindResultCleared() {
  808. _spec.ClearField(addwechatfriendlog.FieldFindResult, field.TypeJSON)
  809. }
  810. if value, ok := awfluo.mutation.IsCanAdd(); ok {
  811. _spec.SetField(addwechatfriendlog.FieldIsCanAdd, field.TypeInt, value)
  812. }
  813. if value, ok := awfluo.mutation.AddedIsCanAdd(); ok {
  814. _spec.AddField(addwechatfriendlog.FieldIsCanAdd, field.TypeInt, value)
  815. }
  816. if value, ok := awfluo.mutation.TaskCount(); ok {
  817. _spec.SetField(addwechatfriendlog.FieldTaskCount, field.TypeInt, value)
  818. }
  819. if value, ok := awfluo.mutation.AddedTaskCount(); ok {
  820. _spec.AddField(addwechatfriendlog.FieldTaskCount, field.TypeInt, value)
  821. }
  822. if value, ok := awfluo.mutation.TaskID(); ok {
  823. _spec.SetField(addwechatfriendlog.FieldTaskID, field.TypeInt64, value)
  824. }
  825. if value, ok := awfluo.mutation.AddedTaskID(); ok {
  826. _spec.AddField(addwechatfriendlog.FieldTaskID, field.TypeInt64, value)
  827. }
  828. if value, ok := awfluo.mutation.AddRequest(); ok {
  829. _spec.SetField(addwechatfriendlog.FieldAddRequest, field.TypeJSON, value)
  830. }
  831. if awfluo.mutation.AddRequestCleared() {
  832. _spec.ClearField(addwechatfriendlog.FieldAddRequest, field.TypeJSON)
  833. }
  834. if value, ok := awfluo.mutation.AddResult(); ok {
  835. _spec.SetField(addwechatfriendlog.FieldAddResult, field.TypeJSON, value)
  836. }
  837. if awfluo.mutation.AddResultCleared() {
  838. _spec.ClearField(addwechatfriendlog.FieldAddResult, field.TypeJSON)
  839. }
  840. if value, ok := awfluo.mutation.CreatedAt(); ok {
  841. _spec.SetField(addwechatfriendlog.FieldCreatedAt, field.TypeInt64, value)
  842. }
  843. if value, ok := awfluo.mutation.AddedCreatedAt(); ok {
  844. _spec.AddField(addwechatfriendlog.FieldCreatedAt, field.TypeInt64, value)
  845. }
  846. if value, ok := awfluo.mutation.UpdatedAt(); ok {
  847. _spec.SetField(addwechatfriendlog.FieldUpdatedAt, field.TypeInt64, value)
  848. }
  849. if value, ok := awfluo.mutation.AddedUpdatedAt(); ok {
  850. _spec.AddField(addwechatfriendlog.FieldUpdatedAt, field.TypeInt64, value)
  851. }
  852. if value, ok := awfluo.mutation.Source(); ok {
  853. _spec.SetField(addwechatfriendlog.FieldSource, field.TypeInt, value)
  854. }
  855. if value, ok := awfluo.mutation.AddedSource(); ok {
  856. _spec.AddField(addwechatfriendlog.FieldSource, field.TypeInt, value)
  857. }
  858. if value, ok := awfluo.mutation.NickName(); ok {
  859. _spec.SetField(addwechatfriendlog.FieldNickName, field.TypeString, value)
  860. }
  861. if value, ok := awfluo.mutation.Avatar(); ok {
  862. _spec.SetField(addwechatfriendlog.FieldAvatar, field.TypeString, value)
  863. }
  864. if value, ok := awfluo.mutation.OrganizationID(); ok {
  865. _spec.SetField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
  866. }
  867. if value, ok := awfluo.mutation.AddedOrganizationID(); ok {
  868. _spec.AddField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
  869. }
  870. _node = &AddWechatFriendLog{config: awfluo.config}
  871. _spec.Assign = _node.assignValues
  872. _spec.ScanValues = _node.scanValues
  873. if err = sqlgraph.UpdateNode(ctx, awfluo.driver, _spec); err != nil {
  874. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  875. err = &NotFoundError{addwechatfriendlog.Label}
  876. } else if sqlgraph.IsConstraintError(err) {
  877. err = &ConstraintError{msg: err.Error(), wrap: err}
  878. }
  879. return nil, err
  880. }
  881. awfluo.mutation.done = true
  882. return _node, nil
  883. }