addwechatfriendlog_create.go 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815
  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. "entgo.io/ent/dialect/sql"
  9. "entgo.io/ent/dialect/sql/sqlgraph"
  10. "entgo.io/ent/schema/field"
  11. )
  12. // AddWechatFriendLogCreate is the builder for creating a AddWechatFriendLog entity.
  13. type AddWechatFriendLogCreate struct {
  14. config
  15. mutation *AddWechatFriendLogMutation
  16. hooks []Hook
  17. conflict []sql.ConflictOption
  18. }
  19. // SetOwnerWxID sets the "owner_wx_id" field.
  20. func (awflc *AddWechatFriendLogCreate) SetOwnerWxID(s string) *AddWechatFriendLogCreate {
  21. awflc.mutation.SetOwnerWxID(s)
  22. return awflc
  23. }
  24. // SetNillableOwnerWxID sets the "owner_wx_id" field if the given value is not nil.
  25. func (awflc *AddWechatFriendLogCreate) SetNillableOwnerWxID(s *string) *AddWechatFriendLogCreate {
  26. if s != nil {
  27. awflc.SetOwnerWxID(*s)
  28. }
  29. return awflc
  30. }
  31. // SetOwnerWxType sets the "owner_wx_type" field.
  32. func (awflc *AddWechatFriendLogCreate) SetOwnerWxType(i int) *AddWechatFriendLogCreate {
  33. awflc.mutation.SetOwnerWxType(i)
  34. return awflc
  35. }
  36. // SetNillableOwnerWxType sets the "owner_wx_type" field if the given value is not nil.
  37. func (awflc *AddWechatFriendLogCreate) SetNillableOwnerWxType(i *int) *AddWechatFriendLogCreate {
  38. if i != nil {
  39. awflc.SetOwnerWxType(*i)
  40. }
  41. return awflc
  42. }
  43. // SetFindContent sets the "find_content" field.
  44. func (awflc *AddWechatFriendLogCreate) SetFindContent(s string) *AddWechatFriendLogCreate {
  45. awflc.mutation.SetFindContent(s)
  46. return awflc
  47. }
  48. // SetNillableFindContent sets the "find_content" field if the given value is not nil.
  49. func (awflc *AddWechatFriendLogCreate) SetNillableFindContent(s *string) *AddWechatFriendLogCreate {
  50. if s != nil {
  51. awflc.SetFindContent(*s)
  52. }
  53. return awflc
  54. }
  55. // SetMessage sets the "message" field.
  56. func (awflc *AddWechatFriendLogCreate) SetMessage(s string) *AddWechatFriendLogCreate {
  57. awflc.mutation.SetMessage(s)
  58. return awflc
  59. }
  60. // SetNillableMessage sets the "message" field if the given value is not nil.
  61. func (awflc *AddWechatFriendLogCreate) SetNillableMessage(s *string) *AddWechatFriendLogCreate {
  62. if s != nil {
  63. awflc.SetMessage(*s)
  64. }
  65. return awflc
  66. }
  67. // SetFindRequest sets the "find_request" field.
  68. func (awflc *AddWechatFriendLogCreate) SetFindRequest(m map[string]interface{}) *AddWechatFriendLogCreate {
  69. awflc.mutation.SetFindRequest(m)
  70. return awflc
  71. }
  72. // SetFindResult sets the "find_result" field.
  73. func (awflc *AddWechatFriendLogCreate) SetFindResult(m map[string]interface{}) *AddWechatFriendLogCreate {
  74. awflc.mutation.SetFindResult(m)
  75. return awflc
  76. }
  77. // SetIsCanAdd sets the "is_can_add" field.
  78. func (awflc *AddWechatFriendLogCreate) SetIsCanAdd(i int) *AddWechatFriendLogCreate {
  79. awflc.mutation.SetIsCanAdd(i)
  80. return awflc
  81. }
  82. // SetNillableIsCanAdd sets the "is_can_add" field if the given value is not nil.
  83. func (awflc *AddWechatFriendLogCreate) SetNillableIsCanAdd(i *int) *AddWechatFriendLogCreate {
  84. if i != nil {
  85. awflc.SetIsCanAdd(*i)
  86. }
  87. return awflc
  88. }
  89. // SetTaskCount sets the "task_count" field.
  90. func (awflc *AddWechatFriendLogCreate) SetTaskCount(i int) *AddWechatFriendLogCreate {
  91. awflc.mutation.SetTaskCount(i)
  92. return awflc
  93. }
  94. // SetNillableTaskCount sets the "task_count" field if the given value is not nil.
  95. func (awflc *AddWechatFriendLogCreate) SetNillableTaskCount(i *int) *AddWechatFriendLogCreate {
  96. if i != nil {
  97. awflc.SetTaskCount(*i)
  98. }
  99. return awflc
  100. }
  101. // SetTaskID sets the "task_id" field.
  102. func (awflc *AddWechatFriendLogCreate) SetTaskID(i int64) *AddWechatFriendLogCreate {
  103. awflc.mutation.SetTaskID(i)
  104. return awflc
  105. }
  106. // SetNillableTaskID sets the "task_id" field if the given value is not nil.
  107. func (awflc *AddWechatFriendLogCreate) SetNillableTaskID(i *int64) *AddWechatFriendLogCreate {
  108. if i != nil {
  109. awflc.SetTaskID(*i)
  110. }
  111. return awflc
  112. }
  113. // SetAddRequest sets the "add_request" field.
  114. func (awflc *AddWechatFriendLogCreate) SetAddRequest(m map[string]interface{}) *AddWechatFriendLogCreate {
  115. awflc.mutation.SetAddRequest(m)
  116. return awflc
  117. }
  118. // SetAddResult sets the "add_result" field.
  119. func (awflc *AddWechatFriendLogCreate) SetAddResult(m map[string]interface{}) *AddWechatFriendLogCreate {
  120. awflc.mutation.SetAddResult(m)
  121. return awflc
  122. }
  123. // SetCreatedAt sets the "created_at" field.
  124. func (awflc *AddWechatFriendLogCreate) SetCreatedAt(i int64) *AddWechatFriendLogCreate {
  125. awflc.mutation.SetCreatedAt(i)
  126. return awflc
  127. }
  128. // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
  129. func (awflc *AddWechatFriendLogCreate) SetNillableCreatedAt(i *int64) *AddWechatFriendLogCreate {
  130. if i != nil {
  131. awflc.SetCreatedAt(*i)
  132. }
  133. return awflc
  134. }
  135. // SetUpdatedAt sets the "updated_at" field.
  136. func (awflc *AddWechatFriendLogCreate) SetUpdatedAt(i int64) *AddWechatFriendLogCreate {
  137. awflc.mutation.SetUpdatedAt(i)
  138. return awflc
  139. }
  140. // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
  141. func (awflc *AddWechatFriendLogCreate) SetNillableUpdatedAt(i *int64) *AddWechatFriendLogCreate {
  142. if i != nil {
  143. awflc.SetUpdatedAt(*i)
  144. }
  145. return awflc
  146. }
  147. // SetSource sets the "source" field.
  148. func (awflc *AddWechatFriendLogCreate) SetSource(i int) *AddWechatFriendLogCreate {
  149. awflc.mutation.SetSource(i)
  150. return awflc
  151. }
  152. // SetNillableSource sets the "source" field if the given value is not nil.
  153. func (awflc *AddWechatFriendLogCreate) SetNillableSource(i *int) *AddWechatFriendLogCreate {
  154. if i != nil {
  155. awflc.SetSource(*i)
  156. }
  157. return awflc
  158. }
  159. // SetNickName sets the "nick_name" field.
  160. func (awflc *AddWechatFriendLogCreate) SetNickName(s string) *AddWechatFriendLogCreate {
  161. awflc.mutation.SetNickName(s)
  162. return awflc
  163. }
  164. // SetNillableNickName sets the "nick_name" field if the given value is not nil.
  165. func (awflc *AddWechatFriendLogCreate) SetNillableNickName(s *string) *AddWechatFriendLogCreate {
  166. if s != nil {
  167. awflc.SetNickName(*s)
  168. }
  169. return awflc
  170. }
  171. // SetAvatar sets the "avatar" field.
  172. func (awflc *AddWechatFriendLogCreate) SetAvatar(s string) *AddWechatFriendLogCreate {
  173. awflc.mutation.SetAvatar(s)
  174. return awflc
  175. }
  176. // SetNillableAvatar sets the "avatar" field if the given value is not nil.
  177. func (awflc *AddWechatFriendLogCreate) SetNillableAvatar(s *string) *AddWechatFriendLogCreate {
  178. if s != nil {
  179. awflc.SetAvatar(*s)
  180. }
  181. return awflc
  182. }
  183. // SetOrganizationID sets the "organization_id" field.
  184. func (awflc *AddWechatFriendLogCreate) SetOrganizationID(i int64) *AddWechatFriendLogCreate {
  185. awflc.mutation.SetOrganizationID(i)
  186. return awflc
  187. }
  188. // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
  189. func (awflc *AddWechatFriendLogCreate) SetNillableOrganizationID(i *int64) *AddWechatFriendLogCreate {
  190. if i != nil {
  191. awflc.SetOrganizationID(*i)
  192. }
  193. return awflc
  194. }
  195. // SetID sets the "id" field.
  196. func (awflc *AddWechatFriendLogCreate) SetID(i int64) *AddWechatFriendLogCreate {
  197. awflc.mutation.SetID(i)
  198. return awflc
  199. }
  200. // Mutation returns the AddWechatFriendLogMutation object of the builder.
  201. func (awflc *AddWechatFriendLogCreate) Mutation() *AddWechatFriendLogMutation {
  202. return awflc.mutation
  203. }
  204. // Save creates the AddWechatFriendLog in the database.
  205. func (awflc *AddWechatFriendLogCreate) Save(ctx context.Context) (*AddWechatFriendLog, error) {
  206. awflc.defaults()
  207. return withHooks(ctx, awflc.sqlSave, awflc.mutation, awflc.hooks)
  208. }
  209. // SaveX calls Save and panics if Save returns an error.
  210. func (awflc *AddWechatFriendLogCreate) SaveX(ctx context.Context) *AddWechatFriendLog {
  211. v, err := awflc.Save(ctx)
  212. if err != nil {
  213. panic(err)
  214. }
  215. return v
  216. }
  217. // Exec executes the query.
  218. func (awflc *AddWechatFriendLogCreate) Exec(ctx context.Context) error {
  219. _, err := awflc.Save(ctx)
  220. return err
  221. }
  222. // ExecX is like Exec, but panics if an error occurs.
  223. func (awflc *AddWechatFriendLogCreate) ExecX(ctx context.Context) {
  224. if err := awflc.Exec(ctx); err != nil {
  225. panic(err)
  226. }
  227. }
  228. // defaults sets the default values of the builder before save.
  229. func (awflc *AddWechatFriendLogCreate) defaults() {
  230. if _, ok := awflc.mutation.OwnerWxID(); !ok {
  231. v := addwechatfriendlog.DefaultOwnerWxID
  232. awflc.mutation.SetOwnerWxID(v)
  233. }
  234. if _, ok := awflc.mutation.OwnerWxType(); !ok {
  235. v := addwechatfriendlog.DefaultOwnerWxType
  236. awflc.mutation.SetOwnerWxType(v)
  237. }
  238. if _, ok := awflc.mutation.FindContent(); !ok {
  239. v := addwechatfriendlog.DefaultFindContent
  240. awflc.mutation.SetFindContent(v)
  241. }
  242. if _, ok := awflc.mutation.Message(); !ok {
  243. v := addwechatfriendlog.DefaultMessage
  244. awflc.mutation.SetMessage(v)
  245. }
  246. if _, ok := awflc.mutation.IsCanAdd(); !ok {
  247. v := addwechatfriendlog.DefaultIsCanAdd
  248. awflc.mutation.SetIsCanAdd(v)
  249. }
  250. if _, ok := awflc.mutation.TaskCount(); !ok {
  251. v := addwechatfriendlog.DefaultTaskCount
  252. awflc.mutation.SetTaskCount(v)
  253. }
  254. if _, ok := awflc.mutation.TaskID(); !ok {
  255. v := addwechatfriendlog.DefaultTaskID
  256. awflc.mutation.SetTaskID(v)
  257. }
  258. if _, ok := awflc.mutation.CreatedAt(); !ok {
  259. v := addwechatfriendlog.DefaultCreatedAt()
  260. awflc.mutation.SetCreatedAt(v)
  261. }
  262. if _, ok := awflc.mutation.UpdatedAt(); !ok {
  263. v := addwechatfriendlog.DefaultUpdatedAt()
  264. awflc.mutation.SetUpdatedAt(v)
  265. }
  266. if _, ok := awflc.mutation.Source(); !ok {
  267. v := addwechatfriendlog.DefaultSource
  268. awflc.mutation.SetSource(v)
  269. }
  270. if _, ok := awflc.mutation.NickName(); !ok {
  271. v := addwechatfriendlog.DefaultNickName
  272. awflc.mutation.SetNickName(v)
  273. }
  274. if _, ok := awflc.mutation.Avatar(); !ok {
  275. v := addwechatfriendlog.DefaultAvatar
  276. awflc.mutation.SetAvatar(v)
  277. }
  278. if _, ok := awflc.mutation.OrganizationID(); !ok {
  279. v := addwechatfriendlog.DefaultOrganizationID
  280. awflc.mutation.SetOrganizationID(v)
  281. }
  282. }
  283. // check runs all checks and user-defined validators on the builder.
  284. func (awflc *AddWechatFriendLogCreate) check() error {
  285. if _, ok := awflc.mutation.OwnerWxID(); !ok {
  286. return &ValidationError{Name: "owner_wx_id", err: errors.New(`ent: missing required field "AddWechatFriendLog.owner_wx_id"`)}
  287. }
  288. if v, ok := awflc.mutation.OwnerWxID(); ok {
  289. if err := addwechatfriendlog.OwnerWxIDValidator(v); err != nil {
  290. return &ValidationError{Name: "owner_wx_id", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.owner_wx_id": %w`, err)}
  291. }
  292. }
  293. if _, ok := awflc.mutation.OwnerWxType(); !ok {
  294. return &ValidationError{Name: "owner_wx_type", err: errors.New(`ent: missing required field "AddWechatFriendLog.owner_wx_type"`)}
  295. }
  296. if _, ok := awflc.mutation.FindContent(); !ok {
  297. return &ValidationError{Name: "find_content", err: errors.New(`ent: missing required field "AddWechatFriendLog.find_content"`)}
  298. }
  299. if v, ok := awflc.mutation.FindContent(); ok {
  300. if err := addwechatfriendlog.FindContentValidator(v); err != nil {
  301. return &ValidationError{Name: "find_content", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.find_content": %w`, err)}
  302. }
  303. }
  304. if _, ok := awflc.mutation.Message(); !ok {
  305. return &ValidationError{Name: "message", err: errors.New(`ent: missing required field "AddWechatFriendLog.message"`)}
  306. }
  307. if v, ok := awflc.mutation.Message(); ok {
  308. if err := addwechatfriendlog.MessageValidator(v); err != nil {
  309. return &ValidationError{Name: "message", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.message": %w`, err)}
  310. }
  311. }
  312. if _, ok := awflc.mutation.IsCanAdd(); !ok {
  313. return &ValidationError{Name: "is_can_add", err: errors.New(`ent: missing required field "AddWechatFriendLog.is_can_add"`)}
  314. }
  315. if _, ok := awflc.mutation.TaskCount(); !ok {
  316. return &ValidationError{Name: "task_count", err: errors.New(`ent: missing required field "AddWechatFriendLog.task_count"`)}
  317. }
  318. if _, ok := awflc.mutation.TaskID(); !ok {
  319. return &ValidationError{Name: "task_id", err: errors.New(`ent: missing required field "AddWechatFriendLog.task_id"`)}
  320. }
  321. if _, ok := awflc.mutation.CreatedAt(); !ok {
  322. return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "AddWechatFriendLog.created_at"`)}
  323. }
  324. if _, ok := awflc.mutation.UpdatedAt(); !ok {
  325. return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AddWechatFriendLog.updated_at"`)}
  326. }
  327. if v, ok := awflc.mutation.NickName(); ok {
  328. if err := addwechatfriendlog.NickNameValidator(v); err != nil {
  329. return &ValidationError{Name: "nick_name", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.nick_name": %w`, err)}
  330. }
  331. }
  332. if v, ok := awflc.mutation.Avatar(); ok {
  333. if err := addwechatfriendlog.AvatarValidator(v); err != nil {
  334. return &ValidationError{Name: "avatar", err: fmt.Errorf(`ent: validator failed for field "AddWechatFriendLog.avatar": %w`, err)}
  335. }
  336. }
  337. return nil
  338. }
  339. func (awflc *AddWechatFriendLogCreate) sqlSave(ctx context.Context) (*AddWechatFriendLog, error) {
  340. if err := awflc.check(); err != nil {
  341. return nil, err
  342. }
  343. _node, _spec := awflc.createSpec()
  344. if err := sqlgraph.CreateNode(ctx, awflc.driver, _spec); err != nil {
  345. if sqlgraph.IsConstraintError(err) {
  346. err = &ConstraintError{msg: err.Error(), wrap: err}
  347. }
  348. return nil, err
  349. }
  350. if _spec.ID.Value != _node.ID {
  351. id := _spec.ID.Value.(int64)
  352. _node.ID = int64(id)
  353. }
  354. awflc.mutation.id = &_node.ID
  355. awflc.mutation.done = true
  356. return _node, nil
  357. }
  358. func (awflc *AddWechatFriendLogCreate) createSpec() (*AddWechatFriendLog, *sqlgraph.CreateSpec) {
  359. var (
  360. _node = &AddWechatFriendLog{config: awflc.config}
  361. _spec = sqlgraph.NewCreateSpec(addwechatfriendlog.Table, sqlgraph.NewFieldSpec(addwechatfriendlog.FieldID, field.TypeInt64))
  362. )
  363. _spec.OnConflict = awflc.conflict
  364. if id, ok := awflc.mutation.ID(); ok {
  365. _node.ID = id
  366. _spec.ID.Value = id
  367. }
  368. if value, ok := awflc.mutation.OwnerWxID(); ok {
  369. _spec.SetField(addwechatfriendlog.FieldOwnerWxID, field.TypeString, value)
  370. _node.OwnerWxID = value
  371. }
  372. if value, ok := awflc.mutation.OwnerWxType(); ok {
  373. _spec.SetField(addwechatfriendlog.FieldOwnerWxType, field.TypeInt, value)
  374. _node.OwnerWxType = value
  375. }
  376. if value, ok := awflc.mutation.FindContent(); ok {
  377. _spec.SetField(addwechatfriendlog.FieldFindContent, field.TypeString, value)
  378. _node.FindContent = value
  379. }
  380. if value, ok := awflc.mutation.Message(); ok {
  381. _spec.SetField(addwechatfriendlog.FieldMessage, field.TypeString, value)
  382. _node.Message = value
  383. }
  384. if value, ok := awflc.mutation.FindRequest(); ok {
  385. _spec.SetField(addwechatfriendlog.FieldFindRequest, field.TypeJSON, value)
  386. _node.FindRequest = value
  387. }
  388. if value, ok := awflc.mutation.FindResult(); ok {
  389. _spec.SetField(addwechatfriendlog.FieldFindResult, field.TypeJSON, value)
  390. _node.FindResult = value
  391. }
  392. if value, ok := awflc.mutation.IsCanAdd(); ok {
  393. _spec.SetField(addwechatfriendlog.FieldIsCanAdd, field.TypeInt, value)
  394. _node.IsCanAdd = value
  395. }
  396. if value, ok := awflc.mutation.TaskCount(); ok {
  397. _spec.SetField(addwechatfriendlog.FieldTaskCount, field.TypeInt, value)
  398. _node.TaskCount = value
  399. }
  400. if value, ok := awflc.mutation.TaskID(); ok {
  401. _spec.SetField(addwechatfriendlog.FieldTaskID, field.TypeInt64, value)
  402. _node.TaskID = value
  403. }
  404. if value, ok := awflc.mutation.AddRequest(); ok {
  405. _spec.SetField(addwechatfriendlog.FieldAddRequest, field.TypeJSON, value)
  406. _node.AddRequest = value
  407. }
  408. if value, ok := awflc.mutation.AddResult(); ok {
  409. _spec.SetField(addwechatfriendlog.FieldAddResult, field.TypeJSON, value)
  410. _node.AddResult = value
  411. }
  412. if value, ok := awflc.mutation.CreatedAt(); ok {
  413. _spec.SetField(addwechatfriendlog.FieldCreatedAt, field.TypeInt64, value)
  414. _node.CreatedAt = value
  415. }
  416. if value, ok := awflc.mutation.UpdatedAt(); ok {
  417. _spec.SetField(addwechatfriendlog.FieldUpdatedAt, field.TypeInt64, value)
  418. _node.UpdatedAt = value
  419. }
  420. if value, ok := awflc.mutation.Source(); ok {
  421. _spec.SetField(addwechatfriendlog.FieldSource, field.TypeInt, value)
  422. _node.Source = value
  423. }
  424. if value, ok := awflc.mutation.NickName(); ok {
  425. _spec.SetField(addwechatfriendlog.FieldNickName, field.TypeString, value)
  426. _node.NickName = value
  427. }
  428. if value, ok := awflc.mutation.Avatar(); ok {
  429. _spec.SetField(addwechatfriendlog.FieldAvatar, field.TypeString, value)
  430. _node.Avatar = value
  431. }
  432. if value, ok := awflc.mutation.OrganizationID(); ok {
  433. _spec.SetField(addwechatfriendlog.FieldOrganizationID, field.TypeInt64, value)
  434. _node.OrganizationID = value
  435. }
  436. return _node, _spec
  437. }
  438. // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
  439. // of the `INSERT` statement. For example:
  440. //
  441. // client.AddWechatFriendLog.Create().
  442. // SetOwnerWxID(v).
  443. // OnConflict(
  444. // // Update the row with the new values
  445. // // the was proposed for insertion.
  446. // sql.ResolveWithNewValues(),
  447. // ).
  448. // // Override some of the fields with custom
  449. // // update values.
  450. // Update(func(u *ent.AddWechatFriendLogUpsert) {
  451. // SetOwnerWxID(v+v).
  452. // }).
  453. // Exec(ctx)
  454. func (awflc *AddWechatFriendLogCreate) OnConflict(opts ...sql.ConflictOption) *AddWechatFriendLogUpsertOne {
  455. awflc.conflict = opts
  456. return &AddWechatFriendLogUpsertOne{
  457. create: awflc,
  458. }
  459. }
  460. // OnConflictColumns calls `OnConflict` and configures the columns
  461. // as conflict target. Using this option is equivalent to using:
  462. //
  463. // client.AddWechatFriendLog.Create().
  464. // OnConflict(sql.ConflictColumns(columns...)).
  465. // Exec(ctx)
  466. func (awflc *AddWechatFriendLogCreate) OnConflictColumns(columns ...string) *AddWechatFriendLogUpsertOne {
  467. awflc.conflict = append(awflc.conflict, sql.ConflictColumns(columns...))
  468. return &AddWechatFriendLogUpsertOne{
  469. create: awflc,
  470. }
  471. }
  472. type (
  473. // AddWechatFriendLogUpsertOne is the builder for "upsert"-ing
  474. // one AddWechatFriendLog node.
  475. AddWechatFriendLogUpsertOne struct {
  476. create *AddWechatFriendLogCreate
  477. }
  478. // AddWechatFriendLogUpsert is the "OnConflict" setter.
  479. AddWechatFriendLogUpsert struct {
  480. *sql.UpdateSet
  481. }
  482. )
  483. // SetOwnerWxID sets the "owner_wx_id" field.
  484. func (u *AddWechatFriendLogUpsert) SetOwnerWxID(v string) *AddWechatFriendLogUpsert {
  485. u.Set(addwechatfriendlog.FieldOwnerWxID, v)
  486. return u
  487. }
  488. // UpdateOwnerWxID sets the "owner_wx_id" field to the value that was provided on create.
  489. func (u *AddWechatFriendLogUpsert) UpdateOwnerWxID() *AddWechatFriendLogUpsert {
  490. u.SetExcluded(addwechatfriendlog.FieldOwnerWxID)
  491. return u
  492. }
  493. // SetOwnerWxType sets the "owner_wx_type" field.
  494. func (u *AddWechatFriendLogUpsert) SetOwnerWxType(v int) *AddWechatFriendLogUpsert {
  495. u.Set(addwechatfriendlog.FieldOwnerWxType, v)
  496. return u
  497. }
  498. // UpdateOwnerWxType sets the "owner_wx_type" field to the value that was provided on create.
  499. func (u *AddWechatFriendLogUpsert) UpdateOwnerWxType() *AddWechatFriendLogUpsert {
  500. u.SetExcluded(addwechatfriendlog.FieldOwnerWxType)
  501. return u
  502. }
  503. // AddOwnerWxType adds v to the "owner_wx_type" field.
  504. func (u *AddWechatFriendLogUpsert) AddOwnerWxType(v int) *AddWechatFriendLogUpsert {
  505. u.Add(addwechatfriendlog.FieldOwnerWxType, v)
  506. return u
  507. }
  508. // SetFindContent sets the "find_content" field.
  509. func (u *AddWechatFriendLogUpsert) SetFindContent(v string) *AddWechatFriendLogUpsert {
  510. u.Set(addwechatfriendlog.FieldFindContent, v)
  511. return u
  512. }
  513. // UpdateFindContent sets the "find_content" field to the value that was provided on create.
  514. func (u *AddWechatFriendLogUpsert) UpdateFindContent() *AddWechatFriendLogUpsert {
  515. u.SetExcluded(addwechatfriendlog.FieldFindContent)
  516. return u
  517. }
  518. // SetMessage sets the "message" field.
  519. func (u *AddWechatFriendLogUpsert) SetMessage(v string) *AddWechatFriendLogUpsert {
  520. u.Set(addwechatfriendlog.FieldMessage, v)
  521. return u
  522. }
  523. // UpdateMessage sets the "message" field to the value that was provided on create.
  524. func (u *AddWechatFriendLogUpsert) UpdateMessage() *AddWechatFriendLogUpsert {
  525. u.SetExcluded(addwechatfriendlog.FieldMessage)
  526. return u
  527. }
  528. // SetFindRequest sets the "find_request" field.
  529. func (u *AddWechatFriendLogUpsert) SetFindRequest(v map[string]interface{}) *AddWechatFriendLogUpsert {
  530. u.Set(addwechatfriendlog.FieldFindRequest, v)
  531. return u
  532. }
  533. // UpdateFindRequest sets the "find_request" field to the value that was provided on create.
  534. func (u *AddWechatFriendLogUpsert) UpdateFindRequest() *AddWechatFriendLogUpsert {
  535. u.SetExcluded(addwechatfriendlog.FieldFindRequest)
  536. return u
  537. }
  538. // ClearFindRequest clears the value of the "find_request" field.
  539. func (u *AddWechatFriendLogUpsert) ClearFindRequest() *AddWechatFriendLogUpsert {
  540. u.SetNull(addwechatfriendlog.FieldFindRequest)
  541. return u
  542. }
  543. // SetFindResult sets the "find_result" field.
  544. func (u *AddWechatFriendLogUpsert) SetFindResult(v map[string]interface{}) *AddWechatFriendLogUpsert {
  545. u.Set(addwechatfriendlog.FieldFindResult, v)
  546. return u
  547. }
  548. // UpdateFindResult sets the "find_result" field to the value that was provided on create.
  549. func (u *AddWechatFriendLogUpsert) UpdateFindResult() *AddWechatFriendLogUpsert {
  550. u.SetExcluded(addwechatfriendlog.FieldFindResult)
  551. return u
  552. }
  553. // ClearFindResult clears the value of the "find_result" field.
  554. func (u *AddWechatFriendLogUpsert) ClearFindResult() *AddWechatFriendLogUpsert {
  555. u.SetNull(addwechatfriendlog.FieldFindResult)
  556. return u
  557. }
  558. // SetIsCanAdd sets the "is_can_add" field.
  559. func (u *AddWechatFriendLogUpsert) SetIsCanAdd(v int) *AddWechatFriendLogUpsert {
  560. u.Set(addwechatfriendlog.FieldIsCanAdd, v)
  561. return u
  562. }
  563. // UpdateIsCanAdd sets the "is_can_add" field to the value that was provided on create.
  564. func (u *AddWechatFriendLogUpsert) UpdateIsCanAdd() *AddWechatFriendLogUpsert {
  565. u.SetExcluded(addwechatfriendlog.FieldIsCanAdd)
  566. return u
  567. }
  568. // AddIsCanAdd adds v to the "is_can_add" field.
  569. func (u *AddWechatFriendLogUpsert) AddIsCanAdd(v int) *AddWechatFriendLogUpsert {
  570. u.Add(addwechatfriendlog.FieldIsCanAdd, v)
  571. return u
  572. }
  573. // SetTaskCount sets the "task_count" field.
  574. func (u *AddWechatFriendLogUpsert) SetTaskCount(v int) *AddWechatFriendLogUpsert {
  575. u.Set(addwechatfriendlog.FieldTaskCount, v)
  576. return u
  577. }
  578. // UpdateTaskCount sets the "task_count" field to the value that was provided on create.
  579. func (u *AddWechatFriendLogUpsert) UpdateTaskCount() *AddWechatFriendLogUpsert {
  580. u.SetExcluded(addwechatfriendlog.FieldTaskCount)
  581. return u
  582. }
  583. // AddTaskCount adds v to the "task_count" field.
  584. func (u *AddWechatFriendLogUpsert) AddTaskCount(v int) *AddWechatFriendLogUpsert {
  585. u.Add(addwechatfriendlog.FieldTaskCount, v)
  586. return u
  587. }
  588. // SetTaskID sets the "task_id" field.
  589. func (u *AddWechatFriendLogUpsert) SetTaskID(v int64) *AddWechatFriendLogUpsert {
  590. u.Set(addwechatfriendlog.FieldTaskID, v)
  591. return u
  592. }
  593. // UpdateTaskID sets the "task_id" field to the value that was provided on create.
  594. func (u *AddWechatFriendLogUpsert) UpdateTaskID() *AddWechatFriendLogUpsert {
  595. u.SetExcluded(addwechatfriendlog.FieldTaskID)
  596. return u
  597. }
  598. // AddTaskID adds v to the "task_id" field.
  599. func (u *AddWechatFriendLogUpsert) AddTaskID(v int64) *AddWechatFriendLogUpsert {
  600. u.Add(addwechatfriendlog.FieldTaskID, v)
  601. return u
  602. }
  603. // SetAddRequest sets the "add_request" field.
  604. func (u *AddWechatFriendLogUpsert) SetAddRequest(v map[string]interface{}) *AddWechatFriendLogUpsert {
  605. u.Set(addwechatfriendlog.FieldAddRequest, v)
  606. return u
  607. }
  608. // UpdateAddRequest sets the "add_request" field to the value that was provided on create.
  609. func (u *AddWechatFriendLogUpsert) UpdateAddRequest() *AddWechatFriendLogUpsert {
  610. u.SetExcluded(addwechatfriendlog.FieldAddRequest)
  611. return u
  612. }
  613. // ClearAddRequest clears the value of the "add_request" field.
  614. func (u *AddWechatFriendLogUpsert) ClearAddRequest() *AddWechatFriendLogUpsert {
  615. u.SetNull(addwechatfriendlog.FieldAddRequest)
  616. return u
  617. }
  618. // SetAddResult sets the "add_result" field.
  619. func (u *AddWechatFriendLogUpsert) SetAddResult(v map[string]interface{}) *AddWechatFriendLogUpsert {
  620. u.Set(addwechatfriendlog.FieldAddResult, v)
  621. return u
  622. }
  623. // UpdateAddResult sets the "add_result" field to the value that was provided on create.
  624. func (u *AddWechatFriendLogUpsert) UpdateAddResult() *AddWechatFriendLogUpsert {
  625. u.SetExcluded(addwechatfriendlog.FieldAddResult)
  626. return u
  627. }
  628. // ClearAddResult clears the value of the "add_result" field.
  629. func (u *AddWechatFriendLogUpsert) ClearAddResult() *AddWechatFriendLogUpsert {
  630. u.SetNull(addwechatfriendlog.FieldAddResult)
  631. return u
  632. }
  633. // SetCreatedAt sets the "created_at" field.
  634. func (u *AddWechatFriendLogUpsert) SetCreatedAt(v int64) *AddWechatFriendLogUpsert {
  635. u.Set(addwechatfriendlog.FieldCreatedAt, v)
  636. return u
  637. }
  638. // UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
  639. func (u *AddWechatFriendLogUpsert) UpdateCreatedAt() *AddWechatFriendLogUpsert {
  640. u.SetExcluded(addwechatfriendlog.FieldCreatedAt)
  641. return u
  642. }
  643. // AddCreatedAt adds v to the "created_at" field.
  644. func (u *AddWechatFriendLogUpsert) AddCreatedAt(v int64) *AddWechatFriendLogUpsert {
  645. u.Add(addwechatfriendlog.FieldCreatedAt, v)
  646. return u
  647. }
  648. // SetUpdatedAt sets the "updated_at" field.
  649. func (u *AddWechatFriendLogUpsert) SetUpdatedAt(v int64) *AddWechatFriendLogUpsert {
  650. u.Set(addwechatfriendlog.FieldUpdatedAt, v)
  651. return u
  652. }
  653. // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
  654. func (u *AddWechatFriendLogUpsert) UpdateUpdatedAt() *AddWechatFriendLogUpsert {
  655. u.SetExcluded(addwechatfriendlog.FieldUpdatedAt)
  656. return u
  657. }
  658. // AddUpdatedAt adds v to the "updated_at" field.
  659. func (u *AddWechatFriendLogUpsert) AddUpdatedAt(v int64) *AddWechatFriendLogUpsert {
  660. u.Add(addwechatfriendlog.FieldUpdatedAt, v)
  661. return u
  662. }
  663. // SetSource sets the "source" field.
  664. func (u *AddWechatFriendLogUpsert) SetSource(v int) *AddWechatFriendLogUpsert {
  665. u.Set(addwechatfriendlog.FieldSource, v)
  666. return u
  667. }
  668. // UpdateSource sets the "source" field to the value that was provided on create.
  669. func (u *AddWechatFriendLogUpsert) UpdateSource() *AddWechatFriendLogUpsert {
  670. u.SetExcluded(addwechatfriendlog.FieldSource)
  671. return u
  672. }
  673. // AddSource adds v to the "source" field.
  674. func (u *AddWechatFriendLogUpsert) AddSource(v int) *AddWechatFriendLogUpsert {
  675. u.Add(addwechatfriendlog.FieldSource, v)
  676. return u
  677. }
  678. // ClearSource clears the value of the "source" field.
  679. func (u *AddWechatFriendLogUpsert) ClearSource() *AddWechatFriendLogUpsert {
  680. u.SetNull(addwechatfriendlog.FieldSource)
  681. return u
  682. }
  683. // SetNickName sets the "nick_name" field.
  684. func (u *AddWechatFriendLogUpsert) SetNickName(v string) *AddWechatFriendLogUpsert {
  685. u.Set(addwechatfriendlog.FieldNickName, v)
  686. return u
  687. }
  688. // UpdateNickName sets the "nick_name" field to the value that was provided on create.
  689. func (u *AddWechatFriendLogUpsert) UpdateNickName() *AddWechatFriendLogUpsert {
  690. u.SetExcluded(addwechatfriendlog.FieldNickName)
  691. return u
  692. }
  693. // ClearNickName clears the value of the "nick_name" field.
  694. func (u *AddWechatFriendLogUpsert) ClearNickName() *AddWechatFriendLogUpsert {
  695. u.SetNull(addwechatfriendlog.FieldNickName)
  696. return u
  697. }
  698. // SetAvatar sets the "avatar" field.
  699. func (u *AddWechatFriendLogUpsert) SetAvatar(v string) *AddWechatFriendLogUpsert {
  700. u.Set(addwechatfriendlog.FieldAvatar, v)
  701. return u
  702. }
  703. // UpdateAvatar sets the "avatar" field to the value that was provided on create.
  704. func (u *AddWechatFriendLogUpsert) UpdateAvatar() *AddWechatFriendLogUpsert {
  705. u.SetExcluded(addwechatfriendlog.FieldAvatar)
  706. return u
  707. }
  708. // ClearAvatar clears the value of the "avatar" field.
  709. func (u *AddWechatFriendLogUpsert) ClearAvatar() *AddWechatFriendLogUpsert {
  710. u.SetNull(addwechatfriendlog.FieldAvatar)
  711. return u
  712. }
  713. // SetOrganizationID sets the "organization_id" field.
  714. func (u *AddWechatFriendLogUpsert) SetOrganizationID(v int64) *AddWechatFriendLogUpsert {
  715. u.Set(addwechatfriendlog.FieldOrganizationID, v)
  716. return u
  717. }
  718. // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
  719. func (u *AddWechatFriendLogUpsert) UpdateOrganizationID() *AddWechatFriendLogUpsert {
  720. u.SetExcluded(addwechatfriendlog.FieldOrganizationID)
  721. return u
  722. }
  723. // AddOrganizationID adds v to the "organization_id" field.
  724. func (u *AddWechatFriendLogUpsert) AddOrganizationID(v int64) *AddWechatFriendLogUpsert {
  725. u.Add(addwechatfriendlog.FieldOrganizationID, v)
  726. return u
  727. }
  728. // ClearOrganizationID clears the value of the "organization_id" field.
  729. func (u *AddWechatFriendLogUpsert) ClearOrganizationID() *AddWechatFriendLogUpsert {
  730. u.SetNull(addwechatfriendlog.FieldOrganizationID)
  731. return u
  732. }
  733. // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
  734. // Using this option is equivalent to using:
  735. //
  736. // client.AddWechatFriendLog.Create().
  737. // OnConflict(
  738. // sql.ResolveWithNewValues(),
  739. // sql.ResolveWith(func(u *sql.UpdateSet) {
  740. // u.SetIgnore(addwechatfriendlog.FieldID)
  741. // }),
  742. // ).
  743. // Exec(ctx)
  744. func (u *AddWechatFriendLogUpsertOne) UpdateNewValues() *AddWechatFriendLogUpsertOne {
  745. u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
  746. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
  747. if _, exists := u.create.mutation.ID(); exists {
  748. s.SetIgnore(addwechatfriendlog.FieldID)
  749. }
  750. }))
  751. return u
  752. }
  753. // Ignore sets each column to itself in case of conflict.
  754. // Using this option is equivalent to using:
  755. //
  756. // client.AddWechatFriendLog.Create().
  757. // OnConflict(sql.ResolveWithIgnore()).
  758. // Exec(ctx)
  759. func (u *AddWechatFriendLogUpsertOne) Ignore() *AddWechatFriendLogUpsertOne {
  760. u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
  761. return u
  762. }
  763. // DoNothing configures the conflict_action to `DO NOTHING`.
  764. // Supported only by SQLite and PostgreSQL.
  765. func (u *AddWechatFriendLogUpsertOne) DoNothing() *AddWechatFriendLogUpsertOne {
  766. u.create.conflict = append(u.create.conflict, sql.DoNothing())
  767. return u
  768. }
  769. // Update allows overriding fields `UPDATE` values. See the AddWechatFriendLogCreate.OnConflict
  770. // documentation for more info.
  771. func (u *AddWechatFriendLogUpsertOne) Update(set func(*AddWechatFriendLogUpsert)) *AddWechatFriendLogUpsertOne {
  772. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
  773. set(&AddWechatFriendLogUpsert{UpdateSet: update})
  774. }))
  775. return u
  776. }
  777. // SetOwnerWxID sets the "owner_wx_id" field.
  778. func (u *AddWechatFriendLogUpsertOne) SetOwnerWxID(v string) *AddWechatFriendLogUpsertOne {
  779. return u.Update(func(s *AddWechatFriendLogUpsert) {
  780. s.SetOwnerWxID(v)
  781. })
  782. }
  783. // UpdateOwnerWxID sets the "owner_wx_id" field to the value that was provided on create.
  784. func (u *AddWechatFriendLogUpsertOne) UpdateOwnerWxID() *AddWechatFriendLogUpsertOne {
  785. return u.Update(func(s *AddWechatFriendLogUpsert) {
  786. s.UpdateOwnerWxID()
  787. })
  788. }
  789. // SetOwnerWxType sets the "owner_wx_type" field.
  790. func (u *AddWechatFriendLogUpsertOne) SetOwnerWxType(v int) *AddWechatFriendLogUpsertOne {
  791. return u.Update(func(s *AddWechatFriendLogUpsert) {
  792. s.SetOwnerWxType(v)
  793. })
  794. }
  795. // AddOwnerWxType adds v to the "owner_wx_type" field.
  796. func (u *AddWechatFriendLogUpsertOne) AddOwnerWxType(v int) *AddWechatFriendLogUpsertOne {
  797. return u.Update(func(s *AddWechatFriendLogUpsert) {
  798. s.AddOwnerWxType(v)
  799. })
  800. }
  801. // UpdateOwnerWxType sets the "owner_wx_type" field to the value that was provided on create.
  802. func (u *AddWechatFriendLogUpsertOne) UpdateOwnerWxType() *AddWechatFriendLogUpsertOne {
  803. return u.Update(func(s *AddWechatFriendLogUpsert) {
  804. s.UpdateOwnerWxType()
  805. })
  806. }
  807. // SetFindContent sets the "find_content" field.
  808. func (u *AddWechatFriendLogUpsertOne) SetFindContent(v string) *AddWechatFriendLogUpsertOne {
  809. return u.Update(func(s *AddWechatFriendLogUpsert) {
  810. s.SetFindContent(v)
  811. })
  812. }
  813. // UpdateFindContent sets the "find_content" field to the value that was provided on create.
  814. func (u *AddWechatFriendLogUpsertOne) UpdateFindContent() *AddWechatFriendLogUpsertOne {
  815. return u.Update(func(s *AddWechatFriendLogUpsert) {
  816. s.UpdateFindContent()
  817. })
  818. }
  819. // SetMessage sets the "message" field.
  820. func (u *AddWechatFriendLogUpsertOne) SetMessage(v string) *AddWechatFriendLogUpsertOne {
  821. return u.Update(func(s *AddWechatFriendLogUpsert) {
  822. s.SetMessage(v)
  823. })
  824. }
  825. // UpdateMessage sets the "message" field to the value that was provided on create.
  826. func (u *AddWechatFriendLogUpsertOne) UpdateMessage() *AddWechatFriendLogUpsertOne {
  827. return u.Update(func(s *AddWechatFriendLogUpsert) {
  828. s.UpdateMessage()
  829. })
  830. }
  831. // SetFindRequest sets the "find_request" field.
  832. func (u *AddWechatFriendLogUpsertOne) SetFindRequest(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
  833. return u.Update(func(s *AddWechatFriendLogUpsert) {
  834. s.SetFindRequest(v)
  835. })
  836. }
  837. // UpdateFindRequest sets the "find_request" field to the value that was provided on create.
  838. func (u *AddWechatFriendLogUpsertOne) UpdateFindRequest() *AddWechatFriendLogUpsertOne {
  839. return u.Update(func(s *AddWechatFriendLogUpsert) {
  840. s.UpdateFindRequest()
  841. })
  842. }
  843. // ClearFindRequest clears the value of the "find_request" field.
  844. func (u *AddWechatFriendLogUpsertOne) ClearFindRequest() *AddWechatFriendLogUpsertOne {
  845. return u.Update(func(s *AddWechatFriendLogUpsert) {
  846. s.ClearFindRequest()
  847. })
  848. }
  849. // SetFindResult sets the "find_result" field.
  850. func (u *AddWechatFriendLogUpsertOne) SetFindResult(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
  851. return u.Update(func(s *AddWechatFriendLogUpsert) {
  852. s.SetFindResult(v)
  853. })
  854. }
  855. // UpdateFindResult sets the "find_result" field to the value that was provided on create.
  856. func (u *AddWechatFriendLogUpsertOne) UpdateFindResult() *AddWechatFriendLogUpsertOne {
  857. return u.Update(func(s *AddWechatFriendLogUpsert) {
  858. s.UpdateFindResult()
  859. })
  860. }
  861. // ClearFindResult clears the value of the "find_result" field.
  862. func (u *AddWechatFriendLogUpsertOne) ClearFindResult() *AddWechatFriendLogUpsertOne {
  863. return u.Update(func(s *AddWechatFriendLogUpsert) {
  864. s.ClearFindResult()
  865. })
  866. }
  867. // SetIsCanAdd sets the "is_can_add" field.
  868. func (u *AddWechatFriendLogUpsertOne) SetIsCanAdd(v int) *AddWechatFriendLogUpsertOne {
  869. return u.Update(func(s *AddWechatFriendLogUpsert) {
  870. s.SetIsCanAdd(v)
  871. })
  872. }
  873. // AddIsCanAdd adds v to the "is_can_add" field.
  874. func (u *AddWechatFriendLogUpsertOne) AddIsCanAdd(v int) *AddWechatFriendLogUpsertOne {
  875. return u.Update(func(s *AddWechatFriendLogUpsert) {
  876. s.AddIsCanAdd(v)
  877. })
  878. }
  879. // UpdateIsCanAdd sets the "is_can_add" field to the value that was provided on create.
  880. func (u *AddWechatFriendLogUpsertOne) UpdateIsCanAdd() *AddWechatFriendLogUpsertOne {
  881. return u.Update(func(s *AddWechatFriendLogUpsert) {
  882. s.UpdateIsCanAdd()
  883. })
  884. }
  885. // SetTaskCount sets the "task_count" field.
  886. func (u *AddWechatFriendLogUpsertOne) SetTaskCount(v int) *AddWechatFriendLogUpsertOne {
  887. return u.Update(func(s *AddWechatFriendLogUpsert) {
  888. s.SetTaskCount(v)
  889. })
  890. }
  891. // AddTaskCount adds v to the "task_count" field.
  892. func (u *AddWechatFriendLogUpsertOne) AddTaskCount(v int) *AddWechatFriendLogUpsertOne {
  893. return u.Update(func(s *AddWechatFriendLogUpsert) {
  894. s.AddTaskCount(v)
  895. })
  896. }
  897. // UpdateTaskCount sets the "task_count" field to the value that was provided on create.
  898. func (u *AddWechatFriendLogUpsertOne) UpdateTaskCount() *AddWechatFriendLogUpsertOne {
  899. return u.Update(func(s *AddWechatFriendLogUpsert) {
  900. s.UpdateTaskCount()
  901. })
  902. }
  903. // SetTaskID sets the "task_id" field.
  904. func (u *AddWechatFriendLogUpsertOne) SetTaskID(v int64) *AddWechatFriendLogUpsertOne {
  905. return u.Update(func(s *AddWechatFriendLogUpsert) {
  906. s.SetTaskID(v)
  907. })
  908. }
  909. // AddTaskID adds v to the "task_id" field.
  910. func (u *AddWechatFriendLogUpsertOne) AddTaskID(v int64) *AddWechatFriendLogUpsertOne {
  911. return u.Update(func(s *AddWechatFriendLogUpsert) {
  912. s.AddTaskID(v)
  913. })
  914. }
  915. // UpdateTaskID sets the "task_id" field to the value that was provided on create.
  916. func (u *AddWechatFriendLogUpsertOne) UpdateTaskID() *AddWechatFriendLogUpsertOne {
  917. return u.Update(func(s *AddWechatFriendLogUpsert) {
  918. s.UpdateTaskID()
  919. })
  920. }
  921. // SetAddRequest sets the "add_request" field.
  922. func (u *AddWechatFriendLogUpsertOne) SetAddRequest(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
  923. return u.Update(func(s *AddWechatFriendLogUpsert) {
  924. s.SetAddRequest(v)
  925. })
  926. }
  927. // UpdateAddRequest sets the "add_request" field to the value that was provided on create.
  928. func (u *AddWechatFriendLogUpsertOne) UpdateAddRequest() *AddWechatFriendLogUpsertOne {
  929. return u.Update(func(s *AddWechatFriendLogUpsert) {
  930. s.UpdateAddRequest()
  931. })
  932. }
  933. // ClearAddRequest clears the value of the "add_request" field.
  934. func (u *AddWechatFriendLogUpsertOne) ClearAddRequest() *AddWechatFriendLogUpsertOne {
  935. return u.Update(func(s *AddWechatFriendLogUpsert) {
  936. s.ClearAddRequest()
  937. })
  938. }
  939. // SetAddResult sets the "add_result" field.
  940. func (u *AddWechatFriendLogUpsertOne) SetAddResult(v map[string]interface{}) *AddWechatFriendLogUpsertOne {
  941. return u.Update(func(s *AddWechatFriendLogUpsert) {
  942. s.SetAddResult(v)
  943. })
  944. }
  945. // UpdateAddResult sets the "add_result" field to the value that was provided on create.
  946. func (u *AddWechatFriendLogUpsertOne) UpdateAddResult() *AddWechatFriendLogUpsertOne {
  947. return u.Update(func(s *AddWechatFriendLogUpsert) {
  948. s.UpdateAddResult()
  949. })
  950. }
  951. // ClearAddResult clears the value of the "add_result" field.
  952. func (u *AddWechatFriendLogUpsertOne) ClearAddResult() *AddWechatFriendLogUpsertOne {
  953. return u.Update(func(s *AddWechatFriendLogUpsert) {
  954. s.ClearAddResult()
  955. })
  956. }
  957. // SetCreatedAt sets the "created_at" field.
  958. func (u *AddWechatFriendLogUpsertOne) SetCreatedAt(v int64) *AddWechatFriendLogUpsertOne {
  959. return u.Update(func(s *AddWechatFriendLogUpsert) {
  960. s.SetCreatedAt(v)
  961. })
  962. }
  963. // AddCreatedAt adds v to the "created_at" field.
  964. func (u *AddWechatFriendLogUpsertOne) AddCreatedAt(v int64) *AddWechatFriendLogUpsertOne {
  965. return u.Update(func(s *AddWechatFriendLogUpsert) {
  966. s.AddCreatedAt(v)
  967. })
  968. }
  969. // UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
  970. func (u *AddWechatFriendLogUpsertOne) UpdateCreatedAt() *AddWechatFriendLogUpsertOne {
  971. return u.Update(func(s *AddWechatFriendLogUpsert) {
  972. s.UpdateCreatedAt()
  973. })
  974. }
  975. // SetUpdatedAt sets the "updated_at" field.
  976. func (u *AddWechatFriendLogUpsertOne) SetUpdatedAt(v int64) *AddWechatFriendLogUpsertOne {
  977. return u.Update(func(s *AddWechatFriendLogUpsert) {
  978. s.SetUpdatedAt(v)
  979. })
  980. }
  981. // AddUpdatedAt adds v to the "updated_at" field.
  982. func (u *AddWechatFriendLogUpsertOne) AddUpdatedAt(v int64) *AddWechatFriendLogUpsertOne {
  983. return u.Update(func(s *AddWechatFriendLogUpsert) {
  984. s.AddUpdatedAt(v)
  985. })
  986. }
  987. // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
  988. func (u *AddWechatFriendLogUpsertOne) UpdateUpdatedAt() *AddWechatFriendLogUpsertOne {
  989. return u.Update(func(s *AddWechatFriendLogUpsert) {
  990. s.UpdateUpdatedAt()
  991. })
  992. }
  993. // SetSource sets the "source" field.
  994. func (u *AddWechatFriendLogUpsertOne) SetSource(v int) *AddWechatFriendLogUpsertOne {
  995. return u.Update(func(s *AddWechatFriendLogUpsert) {
  996. s.SetSource(v)
  997. })
  998. }
  999. // AddSource adds v to the "source" field.
  1000. func (u *AddWechatFriendLogUpsertOne) AddSource(v int) *AddWechatFriendLogUpsertOne {
  1001. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1002. s.AddSource(v)
  1003. })
  1004. }
  1005. // UpdateSource sets the "source" field to the value that was provided on create.
  1006. func (u *AddWechatFriendLogUpsertOne) UpdateSource() *AddWechatFriendLogUpsertOne {
  1007. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1008. s.UpdateSource()
  1009. })
  1010. }
  1011. // ClearSource clears the value of the "source" field.
  1012. func (u *AddWechatFriendLogUpsertOne) ClearSource() *AddWechatFriendLogUpsertOne {
  1013. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1014. s.ClearSource()
  1015. })
  1016. }
  1017. // SetNickName sets the "nick_name" field.
  1018. func (u *AddWechatFriendLogUpsertOne) SetNickName(v string) *AddWechatFriendLogUpsertOne {
  1019. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1020. s.SetNickName(v)
  1021. })
  1022. }
  1023. // UpdateNickName sets the "nick_name" field to the value that was provided on create.
  1024. func (u *AddWechatFriendLogUpsertOne) UpdateNickName() *AddWechatFriendLogUpsertOne {
  1025. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1026. s.UpdateNickName()
  1027. })
  1028. }
  1029. // ClearNickName clears the value of the "nick_name" field.
  1030. func (u *AddWechatFriendLogUpsertOne) ClearNickName() *AddWechatFriendLogUpsertOne {
  1031. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1032. s.ClearNickName()
  1033. })
  1034. }
  1035. // SetAvatar sets the "avatar" field.
  1036. func (u *AddWechatFriendLogUpsertOne) SetAvatar(v string) *AddWechatFriendLogUpsertOne {
  1037. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1038. s.SetAvatar(v)
  1039. })
  1040. }
  1041. // UpdateAvatar sets the "avatar" field to the value that was provided on create.
  1042. func (u *AddWechatFriendLogUpsertOne) UpdateAvatar() *AddWechatFriendLogUpsertOne {
  1043. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1044. s.UpdateAvatar()
  1045. })
  1046. }
  1047. // ClearAvatar clears the value of the "avatar" field.
  1048. func (u *AddWechatFriendLogUpsertOne) ClearAvatar() *AddWechatFriendLogUpsertOne {
  1049. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1050. s.ClearAvatar()
  1051. })
  1052. }
  1053. // SetOrganizationID sets the "organization_id" field.
  1054. func (u *AddWechatFriendLogUpsertOne) SetOrganizationID(v int64) *AddWechatFriendLogUpsertOne {
  1055. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1056. s.SetOrganizationID(v)
  1057. })
  1058. }
  1059. // AddOrganizationID adds v to the "organization_id" field.
  1060. func (u *AddWechatFriendLogUpsertOne) AddOrganizationID(v int64) *AddWechatFriendLogUpsertOne {
  1061. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1062. s.AddOrganizationID(v)
  1063. })
  1064. }
  1065. // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
  1066. func (u *AddWechatFriendLogUpsertOne) UpdateOrganizationID() *AddWechatFriendLogUpsertOne {
  1067. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1068. s.UpdateOrganizationID()
  1069. })
  1070. }
  1071. // ClearOrganizationID clears the value of the "organization_id" field.
  1072. func (u *AddWechatFriendLogUpsertOne) ClearOrganizationID() *AddWechatFriendLogUpsertOne {
  1073. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1074. s.ClearOrganizationID()
  1075. })
  1076. }
  1077. // Exec executes the query.
  1078. func (u *AddWechatFriendLogUpsertOne) Exec(ctx context.Context) error {
  1079. if len(u.create.conflict) == 0 {
  1080. return errors.New("ent: missing options for AddWechatFriendLogCreate.OnConflict")
  1081. }
  1082. return u.create.Exec(ctx)
  1083. }
  1084. // ExecX is like Exec, but panics if an error occurs.
  1085. func (u *AddWechatFriendLogUpsertOne) ExecX(ctx context.Context) {
  1086. if err := u.create.Exec(ctx); err != nil {
  1087. panic(err)
  1088. }
  1089. }
  1090. // Exec executes the UPSERT query and returns the inserted/updated ID.
  1091. func (u *AddWechatFriendLogUpsertOne) ID(ctx context.Context) (id int64, err error) {
  1092. node, err := u.create.Save(ctx)
  1093. if err != nil {
  1094. return id, err
  1095. }
  1096. return node.ID, nil
  1097. }
  1098. // IDX is like ID, but panics if an error occurs.
  1099. func (u *AddWechatFriendLogUpsertOne) IDX(ctx context.Context) int64 {
  1100. id, err := u.ID(ctx)
  1101. if err != nil {
  1102. panic(err)
  1103. }
  1104. return id
  1105. }
  1106. // AddWechatFriendLogCreateBulk is the builder for creating many AddWechatFriendLog entities in bulk.
  1107. type AddWechatFriendLogCreateBulk struct {
  1108. config
  1109. err error
  1110. builders []*AddWechatFriendLogCreate
  1111. conflict []sql.ConflictOption
  1112. }
  1113. // Save creates the AddWechatFriendLog entities in the database.
  1114. func (awflcb *AddWechatFriendLogCreateBulk) Save(ctx context.Context) ([]*AddWechatFriendLog, error) {
  1115. if awflcb.err != nil {
  1116. return nil, awflcb.err
  1117. }
  1118. specs := make([]*sqlgraph.CreateSpec, len(awflcb.builders))
  1119. nodes := make([]*AddWechatFriendLog, len(awflcb.builders))
  1120. mutators := make([]Mutator, len(awflcb.builders))
  1121. for i := range awflcb.builders {
  1122. func(i int, root context.Context) {
  1123. builder := awflcb.builders[i]
  1124. builder.defaults()
  1125. var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
  1126. mutation, ok := m.(*AddWechatFriendLogMutation)
  1127. if !ok {
  1128. return nil, fmt.Errorf("unexpected mutation type %T", m)
  1129. }
  1130. if err := builder.check(); err != nil {
  1131. return nil, err
  1132. }
  1133. builder.mutation = mutation
  1134. var err error
  1135. nodes[i], specs[i] = builder.createSpec()
  1136. if i < len(mutators)-1 {
  1137. _, err = mutators[i+1].Mutate(root, awflcb.builders[i+1].mutation)
  1138. } else {
  1139. spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
  1140. spec.OnConflict = awflcb.conflict
  1141. // Invoke the actual operation on the latest mutation in the chain.
  1142. if err = sqlgraph.BatchCreate(ctx, awflcb.driver, spec); err != nil {
  1143. if sqlgraph.IsConstraintError(err) {
  1144. err = &ConstraintError{msg: err.Error(), wrap: err}
  1145. }
  1146. }
  1147. }
  1148. if err != nil {
  1149. return nil, err
  1150. }
  1151. mutation.id = &nodes[i].ID
  1152. if specs[i].ID.Value != nil && nodes[i].ID == 0 {
  1153. id := specs[i].ID.Value.(int64)
  1154. nodes[i].ID = int64(id)
  1155. }
  1156. mutation.done = true
  1157. return nodes[i], nil
  1158. })
  1159. for i := len(builder.hooks) - 1; i >= 0; i-- {
  1160. mut = builder.hooks[i](mut)
  1161. }
  1162. mutators[i] = mut
  1163. }(i, ctx)
  1164. }
  1165. if len(mutators) > 0 {
  1166. if _, err := mutators[0].Mutate(ctx, awflcb.builders[0].mutation); err != nil {
  1167. return nil, err
  1168. }
  1169. }
  1170. return nodes, nil
  1171. }
  1172. // SaveX is like Save, but panics if an error occurs.
  1173. func (awflcb *AddWechatFriendLogCreateBulk) SaveX(ctx context.Context) []*AddWechatFriendLog {
  1174. v, err := awflcb.Save(ctx)
  1175. if err != nil {
  1176. panic(err)
  1177. }
  1178. return v
  1179. }
  1180. // Exec executes the query.
  1181. func (awflcb *AddWechatFriendLogCreateBulk) Exec(ctx context.Context) error {
  1182. _, err := awflcb.Save(ctx)
  1183. return err
  1184. }
  1185. // ExecX is like Exec, but panics if an error occurs.
  1186. func (awflcb *AddWechatFriendLogCreateBulk) ExecX(ctx context.Context) {
  1187. if err := awflcb.Exec(ctx); err != nil {
  1188. panic(err)
  1189. }
  1190. }
  1191. // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
  1192. // of the `INSERT` statement. For example:
  1193. //
  1194. // client.AddWechatFriendLog.CreateBulk(builders...).
  1195. // OnConflict(
  1196. // // Update the row with the new values
  1197. // // the was proposed for insertion.
  1198. // sql.ResolveWithNewValues(),
  1199. // ).
  1200. // // Override some of the fields with custom
  1201. // // update values.
  1202. // Update(func(u *ent.AddWechatFriendLogUpsert) {
  1203. // SetOwnerWxID(v+v).
  1204. // }).
  1205. // Exec(ctx)
  1206. func (awflcb *AddWechatFriendLogCreateBulk) OnConflict(opts ...sql.ConflictOption) *AddWechatFriendLogUpsertBulk {
  1207. awflcb.conflict = opts
  1208. return &AddWechatFriendLogUpsertBulk{
  1209. create: awflcb,
  1210. }
  1211. }
  1212. // OnConflictColumns calls `OnConflict` and configures the columns
  1213. // as conflict target. Using this option is equivalent to using:
  1214. //
  1215. // client.AddWechatFriendLog.Create().
  1216. // OnConflict(sql.ConflictColumns(columns...)).
  1217. // Exec(ctx)
  1218. func (awflcb *AddWechatFriendLogCreateBulk) OnConflictColumns(columns ...string) *AddWechatFriendLogUpsertBulk {
  1219. awflcb.conflict = append(awflcb.conflict, sql.ConflictColumns(columns...))
  1220. return &AddWechatFriendLogUpsertBulk{
  1221. create: awflcb,
  1222. }
  1223. }
  1224. // AddWechatFriendLogUpsertBulk is the builder for "upsert"-ing
  1225. // a bulk of AddWechatFriendLog nodes.
  1226. type AddWechatFriendLogUpsertBulk struct {
  1227. create *AddWechatFriendLogCreateBulk
  1228. }
  1229. // UpdateNewValues updates the mutable fields using the new values that
  1230. // were set on create. Using this option is equivalent to using:
  1231. //
  1232. // client.AddWechatFriendLog.Create().
  1233. // OnConflict(
  1234. // sql.ResolveWithNewValues(),
  1235. // sql.ResolveWith(func(u *sql.UpdateSet) {
  1236. // u.SetIgnore(addwechatfriendlog.FieldID)
  1237. // }),
  1238. // ).
  1239. // Exec(ctx)
  1240. func (u *AddWechatFriendLogUpsertBulk) UpdateNewValues() *AddWechatFriendLogUpsertBulk {
  1241. u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
  1242. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
  1243. for _, b := range u.create.builders {
  1244. if _, exists := b.mutation.ID(); exists {
  1245. s.SetIgnore(addwechatfriendlog.FieldID)
  1246. }
  1247. }
  1248. }))
  1249. return u
  1250. }
  1251. // Ignore sets each column to itself in case of conflict.
  1252. // Using this option is equivalent to using:
  1253. //
  1254. // client.AddWechatFriendLog.Create().
  1255. // OnConflict(sql.ResolveWithIgnore()).
  1256. // Exec(ctx)
  1257. func (u *AddWechatFriendLogUpsertBulk) Ignore() *AddWechatFriendLogUpsertBulk {
  1258. u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
  1259. return u
  1260. }
  1261. // DoNothing configures the conflict_action to `DO NOTHING`.
  1262. // Supported only by SQLite and PostgreSQL.
  1263. func (u *AddWechatFriendLogUpsertBulk) DoNothing() *AddWechatFriendLogUpsertBulk {
  1264. u.create.conflict = append(u.create.conflict, sql.DoNothing())
  1265. return u
  1266. }
  1267. // Update allows overriding fields `UPDATE` values. See the AddWechatFriendLogCreateBulk.OnConflict
  1268. // documentation for more info.
  1269. func (u *AddWechatFriendLogUpsertBulk) Update(set func(*AddWechatFriendLogUpsert)) *AddWechatFriendLogUpsertBulk {
  1270. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
  1271. set(&AddWechatFriendLogUpsert{UpdateSet: update})
  1272. }))
  1273. return u
  1274. }
  1275. // SetOwnerWxID sets the "owner_wx_id" field.
  1276. func (u *AddWechatFriendLogUpsertBulk) SetOwnerWxID(v string) *AddWechatFriendLogUpsertBulk {
  1277. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1278. s.SetOwnerWxID(v)
  1279. })
  1280. }
  1281. // UpdateOwnerWxID sets the "owner_wx_id" field to the value that was provided on create.
  1282. func (u *AddWechatFriendLogUpsertBulk) UpdateOwnerWxID() *AddWechatFriendLogUpsertBulk {
  1283. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1284. s.UpdateOwnerWxID()
  1285. })
  1286. }
  1287. // SetOwnerWxType sets the "owner_wx_type" field.
  1288. func (u *AddWechatFriendLogUpsertBulk) SetOwnerWxType(v int) *AddWechatFriendLogUpsertBulk {
  1289. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1290. s.SetOwnerWxType(v)
  1291. })
  1292. }
  1293. // AddOwnerWxType adds v to the "owner_wx_type" field.
  1294. func (u *AddWechatFriendLogUpsertBulk) AddOwnerWxType(v int) *AddWechatFriendLogUpsertBulk {
  1295. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1296. s.AddOwnerWxType(v)
  1297. })
  1298. }
  1299. // UpdateOwnerWxType sets the "owner_wx_type" field to the value that was provided on create.
  1300. func (u *AddWechatFriendLogUpsertBulk) UpdateOwnerWxType() *AddWechatFriendLogUpsertBulk {
  1301. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1302. s.UpdateOwnerWxType()
  1303. })
  1304. }
  1305. // SetFindContent sets the "find_content" field.
  1306. func (u *AddWechatFriendLogUpsertBulk) SetFindContent(v string) *AddWechatFriendLogUpsertBulk {
  1307. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1308. s.SetFindContent(v)
  1309. })
  1310. }
  1311. // UpdateFindContent sets the "find_content" field to the value that was provided on create.
  1312. func (u *AddWechatFriendLogUpsertBulk) UpdateFindContent() *AddWechatFriendLogUpsertBulk {
  1313. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1314. s.UpdateFindContent()
  1315. })
  1316. }
  1317. // SetMessage sets the "message" field.
  1318. func (u *AddWechatFriendLogUpsertBulk) SetMessage(v string) *AddWechatFriendLogUpsertBulk {
  1319. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1320. s.SetMessage(v)
  1321. })
  1322. }
  1323. // UpdateMessage sets the "message" field to the value that was provided on create.
  1324. func (u *AddWechatFriendLogUpsertBulk) UpdateMessage() *AddWechatFriendLogUpsertBulk {
  1325. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1326. s.UpdateMessage()
  1327. })
  1328. }
  1329. // SetFindRequest sets the "find_request" field.
  1330. func (u *AddWechatFriendLogUpsertBulk) SetFindRequest(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
  1331. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1332. s.SetFindRequest(v)
  1333. })
  1334. }
  1335. // UpdateFindRequest sets the "find_request" field to the value that was provided on create.
  1336. func (u *AddWechatFriendLogUpsertBulk) UpdateFindRequest() *AddWechatFriendLogUpsertBulk {
  1337. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1338. s.UpdateFindRequest()
  1339. })
  1340. }
  1341. // ClearFindRequest clears the value of the "find_request" field.
  1342. func (u *AddWechatFriendLogUpsertBulk) ClearFindRequest() *AddWechatFriendLogUpsertBulk {
  1343. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1344. s.ClearFindRequest()
  1345. })
  1346. }
  1347. // SetFindResult sets the "find_result" field.
  1348. func (u *AddWechatFriendLogUpsertBulk) SetFindResult(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
  1349. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1350. s.SetFindResult(v)
  1351. })
  1352. }
  1353. // UpdateFindResult sets the "find_result" field to the value that was provided on create.
  1354. func (u *AddWechatFriendLogUpsertBulk) UpdateFindResult() *AddWechatFriendLogUpsertBulk {
  1355. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1356. s.UpdateFindResult()
  1357. })
  1358. }
  1359. // ClearFindResult clears the value of the "find_result" field.
  1360. func (u *AddWechatFriendLogUpsertBulk) ClearFindResult() *AddWechatFriendLogUpsertBulk {
  1361. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1362. s.ClearFindResult()
  1363. })
  1364. }
  1365. // SetIsCanAdd sets the "is_can_add" field.
  1366. func (u *AddWechatFriendLogUpsertBulk) SetIsCanAdd(v int) *AddWechatFriendLogUpsertBulk {
  1367. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1368. s.SetIsCanAdd(v)
  1369. })
  1370. }
  1371. // AddIsCanAdd adds v to the "is_can_add" field.
  1372. func (u *AddWechatFriendLogUpsertBulk) AddIsCanAdd(v int) *AddWechatFriendLogUpsertBulk {
  1373. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1374. s.AddIsCanAdd(v)
  1375. })
  1376. }
  1377. // UpdateIsCanAdd sets the "is_can_add" field to the value that was provided on create.
  1378. func (u *AddWechatFriendLogUpsertBulk) UpdateIsCanAdd() *AddWechatFriendLogUpsertBulk {
  1379. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1380. s.UpdateIsCanAdd()
  1381. })
  1382. }
  1383. // SetTaskCount sets the "task_count" field.
  1384. func (u *AddWechatFriendLogUpsertBulk) SetTaskCount(v int) *AddWechatFriendLogUpsertBulk {
  1385. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1386. s.SetTaskCount(v)
  1387. })
  1388. }
  1389. // AddTaskCount adds v to the "task_count" field.
  1390. func (u *AddWechatFriendLogUpsertBulk) AddTaskCount(v int) *AddWechatFriendLogUpsertBulk {
  1391. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1392. s.AddTaskCount(v)
  1393. })
  1394. }
  1395. // UpdateTaskCount sets the "task_count" field to the value that was provided on create.
  1396. func (u *AddWechatFriendLogUpsertBulk) UpdateTaskCount() *AddWechatFriendLogUpsertBulk {
  1397. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1398. s.UpdateTaskCount()
  1399. })
  1400. }
  1401. // SetTaskID sets the "task_id" field.
  1402. func (u *AddWechatFriendLogUpsertBulk) SetTaskID(v int64) *AddWechatFriendLogUpsertBulk {
  1403. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1404. s.SetTaskID(v)
  1405. })
  1406. }
  1407. // AddTaskID adds v to the "task_id" field.
  1408. func (u *AddWechatFriendLogUpsertBulk) AddTaskID(v int64) *AddWechatFriendLogUpsertBulk {
  1409. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1410. s.AddTaskID(v)
  1411. })
  1412. }
  1413. // UpdateTaskID sets the "task_id" field to the value that was provided on create.
  1414. func (u *AddWechatFriendLogUpsertBulk) UpdateTaskID() *AddWechatFriendLogUpsertBulk {
  1415. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1416. s.UpdateTaskID()
  1417. })
  1418. }
  1419. // SetAddRequest sets the "add_request" field.
  1420. func (u *AddWechatFriendLogUpsertBulk) SetAddRequest(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
  1421. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1422. s.SetAddRequest(v)
  1423. })
  1424. }
  1425. // UpdateAddRequest sets the "add_request" field to the value that was provided on create.
  1426. func (u *AddWechatFriendLogUpsertBulk) UpdateAddRequest() *AddWechatFriendLogUpsertBulk {
  1427. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1428. s.UpdateAddRequest()
  1429. })
  1430. }
  1431. // ClearAddRequest clears the value of the "add_request" field.
  1432. func (u *AddWechatFriendLogUpsertBulk) ClearAddRequest() *AddWechatFriendLogUpsertBulk {
  1433. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1434. s.ClearAddRequest()
  1435. })
  1436. }
  1437. // SetAddResult sets the "add_result" field.
  1438. func (u *AddWechatFriendLogUpsertBulk) SetAddResult(v map[string]interface{}) *AddWechatFriendLogUpsertBulk {
  1439. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1440. s.SetAddResult(v)
  1441. })
  1442. }
  1443. // UpdateAddResult sets the "add_result" field to the value that was provided on create.
  1444. func (u *AddWechatFriendLogUpsertBulk) UpdateAddResult() *AddWechatFriendLogUpsertBulk {
  1445. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1446. s.UpdateAddResult()
  1447. })
  1448. }
  1449. // ClearAddResult clears the value of the "add_result" field.
  1450. func (u *AddWechatFriendLogUpsertBulk) ClearAddResult() *AddWechatFriendLogUpsertBulk {
  1451. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1452. s.ClearAddResult()
  1453. })
  1454. }
  1455. // SetCreatedAt sets the "created_at" field.
  1456. func (u *AddWechatFriendLogUpsertBulk) SetCreatedAt(v int64) *AddWechatFriendLogUpsertBulk {
  1457. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1458. s.SetCreatedAt(v)
  1459. })
  1460. }
  1461. // AddCreatedAt adds v to the "created_at" field.
  1462. func (u *AddWechatFriendLogUpsertBulk) AddCreatedAt(v int64) *AddWechatFriendLogUpsertBulk {
  1463. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1464. s.AddCreatedAt(v)
  1465. })
  1466. }
  1467. // UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
  1468. func (u *AddWechatFriendLogUpsertBulk) UpdateCreatedAt() *AddWechatFriendLogUpsertBulk {
  1469. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1470. s.UpdateCreatedAt()
  1471. })
  1472. }
  1473. // SetUpdatedAt sets the "updated_at" field.
  1474. func (u *AddWechatFriendLogUpsertBulk) SetUpdatedAt(v int64) *AddWechatFriendLogUpsertBulk {
  1475. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1476. s.SetUpdatedAt(v)
  1477. })
  1478. }
  1479. // AddUpdatedAt adds v to the "updated_at" field.
  1480. func (u *AddWechatFriendLogUpsertBulk) AddUpdatedAt(v int64) *AddWechatFriendLogUpsertBulk {
  1481. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1482. s.AddUpdatedAt(v)
  1483. })
  1484. }
  1485. // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
  1486. func (u *AddWechatFriendLogUpsertBulk) UpdateUpdatedAt() *AddWechatFriendLogUpsertBulk {
  1487. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1488. s.UpdateUpdatedAt()
  1489. })
  1490. }
  1491. // SetSource sets the "source" field.
  1492. func (u *AddWechatFriendLogUpsertBulk) SetSource(v int) *AddWechatFriendLogUpsertBulk {
  1493. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1494. s.SetSource(v)
  1495. })
  1496. }
  1497. // AddSource adds v to the "source" field.
  1498. func (u *AddWechatFriendLogUpsertBulk) AddSource(v int) *AddWechatFriendLogUpsertBulk {
  1499. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1500. s.AddSource(v)
  1501. })
  1502. }
  1503. // UpdateSource sets the "source" field to the value that was provided on create.
  1504. func (u *AddWechatFriendLogUpsertBulk) UpdateSource() *AddWechatFriendLogUpsertBulk {
  1505. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1506. s.UpdateSource()
  1507. })
  1508. }
  1509. // ClearSource clears the value of the "source" field.
  1510. func (u *AddWechatFriendLogUpsertBulk) ClearSource() *AddWechatFriendLogUpsertBulk {
  1511. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1512. s.ClearSource()
  1513. })
  1514. }
  1515. // SetNickName sets the "nick_name" field.
  1516. func (u *AddWechatFriendLogUpsertBulk) SetNickName(v string) *AddWechatFriendLogUpsertBulk {
  1517. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1518. s.SetNickName(v)
  1519. })
  1520. }
  1521. // UpdateNickName sets the "nick_name" field to the value that was provided on create.
  1522. func (u *AddWechatFriendLogUpsertBulk) UpdateNickName() *AddWechatFriendLogUpsertBulk {
  1523. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1524. s.UpdateNickName()
  1525. })
  1526. }
  1527. // ClearNickName clears the value of the "nick_name" field.
  1528. func (u *AddWechatFriendLogUpsertBulk) ClearNickName() *AddWechatFriendLogUpsertBulk {
  1529. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1530. s.ClearNickName()
  1531. })
  1532. }
  1533. // SetAvatar sets the "avatar" field.
  1534. func (u *AddWechatFriendLogUpsertBulk) SetAvatar(v string) *AddWechatFriendLogUpsertBulk {
  1535. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1536. s.SetAvatar(v)
  1537. })
  1538. }
  1539. // UpdateAvatar sets the "avatar" field to the value that was provided on create.
  1540. func (u *AddWechatFriendLogUpsertBulk) UpdateAvatar() *AddWechatFriendLogUpsertBulk {
  1541. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1542. s.UpdateAvatar()
  1543. })
  1544. }
  1545. // ClearAvatar clears the value of the "avatar" field.
  1546. func (u *AddWechatFriendLogUpsertBulk) ClearAvatar() *AddWechatFriendLogUpsertBulk {
  1547. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1548. s.ClearAvatar()
  1549. })
  1550. }
  1551. // SetOrganizationID sets the "organization_id" field.
  1552. func (u *AddWechatFriendLogUpsertBulk) SetOrganizationID(v int64) *AddWechatFriendLogUpsertBulk {
  1553. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1554. s.SetOrganizationID(v)
  1555. })
  1556. }
  1557. // AddOrganizationID adds v to the "organization_id" field.
  1558. func (u *AddWechatFriendLogUpsertBulk) AddOrganizationID(v int64) *AddWechatFriendLogUpsertBulk {
  1559. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1560. s.AddOrganizationID(v)
  1561. })
  1562. }
  1563. // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
  1564. func (u *AddWechatFriendLogUpsertBulk) UpdateOrganizationID() *AddWechatFriendLogUpsertBulk {
  1565. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1566. s.UpdateOrganizationID()
  1567. })
  1568. }
  1569. // ClearOrganizationID clears the value of the "organization_id" field.
  1570. func (u *AddWechatFriendLogUpsertBulk) ClearOrganizationID() *AddWechatFriendLogUpsertBulk {
  1571. return u.Update(func(s *AddWechatFriendLogUpsert) {
  1572. s.ClearOrganizationID()
  1573. })
  1574. }
  1575. // Exec executes the query.
  1576. func (u *AddWechatFriendLogUpsertBulk) Exec(ctx context.Context) error {
  1577. if u.create.err != nil {
  1578. return u.create.err
  1579. }
  1580. for i, b := range u.create.builders {
  1581. if len(b.conflict) != 0 {
  1582. return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the AddWechatFriendLogCreateBulk instead", i)
  1583. }
  1584. }
  1585. if len(u.create.conflict) == 0 {
  1586. return errors.New("ent: missing options for AddWechatFriendLogCreateBulk.OnConflict")
  1587. }
  1588. return u.create.Exec(ctx)
  1589. }
  1590. // ExecX is like Exec, but panics if an error occurs.
  1591. func (u *AddWechatFriendLogUpsertBulk) ExecX(ctx context.Context) {
  1592. if err := u.create.Exec(ctx); err != nil {
  1593. panic(err)
  1594. }
  1595. }