labeltagging_create.go 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  1. // Code generated by ent, DO NOT EDIT.
  2. package ent
  3. import (
  4. "context"
  5. "errors"
  6. "fmt"
  7. "time"
  8. "wechat-api/ent/labeltagging"
  9. "entgo.io/ent/dialect/sql"
  10. "entgo.io/ent/dialect/sql/sqlgraph"
  11. "entgo.io/ent/schema/field"
  12. )
  13. // LabelTaggingCreate is the builder for creating a LabelTagging entity.
  14. type LabelTaggingCreate struct {
  15. config
  16. mutation *LabelTaggingMutation
  17. hooks []Hook
  18. conflict []sql.ConflictOption
  19. }
  20. // SetCreatedAt sets the "created_at" field.
  21. func (ltc *LabelTaggingCreate) SetCreatedAt(t time.Time) *LabelTaggingCreate {
  22. ltc.mutation.SetCreatedAt(t)
  23. return ltc
  24. }
  25. // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
  26. func (ltc *LabelTaggingCreate) SetNillableCreatedAt(t *time.Time) *LabelTaggingCreate {
  27. if t != nil {
  28. ltc.SetCreatedAt(*t)
  29. }
  30. return ltc
  31. }
  32. // SetUpdatedAt sets the "updated_at" field.
  33. func (ltc *LabelTaggingCreate) SetUpdatedAt(t time.Time) *LabelTaggingCreate {
  34. ltc.mutation.SetUpdatedAt(t)
  35. return ltc
  36. }
  37. // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
  38. func (ltc *LabelTaggingCreate) SetNillableUpdatedAt(t *time.Time) *LabelTaggingCreate {
  39. if t != nil {
  40. ltc.SetUpdatedAt(*t)
  41. }
  42. return ltc
  43. }
  44. // SetStatus sets the "status" field.
  45. func (ltc *LabelTaggingCreate) SetStatus(u uint8) *LabelTaggingCreate {
  46. ltc.mutation.SetStatus(u)
  47. return ltc
  48. }
  49. // SetNillableStatus sets the "status" field if the given value is not nil.
  50. func (ltc *LabelTaggingCreate) SetNillableStatus(u *uint8) *LabelTaggingCreate {
  51. if u != nil {
  52. ltc.SetStatus(*u)
  53. }
  54. return ltc
  55. }
  56. // SetDeletedAt sets the "deleted_at" field.
  57. func (ltc *LabelTaggingCreate) SetDeletedAt(t time.Time) *LabelTaggingCreate {
  58. ltc.mutation.SetDeletedAt(t)
  59. return ltc
  60. }
  61. // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
  62. func (ltc *LabelTaggingCreate) SetNillableDeletedAt(t *time.Time) *LabelTaggingCreate {
  63. if t != nil {
  64. ltc.SetDeletedAt(*t)
  65. }
  66. return ltc
  67. }
  68. // SetOrganizationID sets the "organization_id" field.
  69. func (ltc *LabelTaggingCreate) SetOrganizationID(u uint64) *LabelTaggingCreate {
  70. ltc.mutation.SetOrganizationID(u)
  71. return ltc
  72. }
  73. // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
  74. func (ltc *LabelTaggingCreate) SetNillableOrganizationID(u *uint64) *LabelTaggingCreate {
  75. if u != nil {
  76. ltc.SetOrganizationID(*u)
  77. }
  78. return ltc
  79. }
  80. // SetType sets the "type" field.
  81. func (ltc *LabelTaggingCreate) SetType(i int) *LabelTaggingCreate {
  82. ltc.mutation.SetType(i)
  83. return ltc
  84. }
  85. // SetNillableType sets the "type" field if the given value is not nil.
  86. func (ltc *LabelTaggingCreate) SetNillableType(i *int) *LabelTaggingCreate {
  87. if i != nil {
  88. ltc.SetType(*i)
  89. }
  90. return ltc
  91. }
  92. // SetConditions sets the "conditions" field.
  93. func (ltc *LabelTaggingCreate) SetConditions(s []string) *LabelTaggingCreate {
  94. ltc.mutation.SetConditions(s)
  95. return ltc
  96. }
  97. // SetActionLabelAdd sets the "action_label_add" field.
  98. func (ltc *LabelTaggingCreate) SetActionLabelAdd(u []uint64) *LabelTaggingCreate {
  99. ltc.mutation.SetActionLabelAdd(u)
  100. return ltc
  101. }
  102. // SetActionLabelDel sets the "action_label_del" field.
  103. func (ltc *LabelTaggingCreate) SetActionLabelDel(u []uint64) *LabelTaggingCreate {
  104. ltc.mutation.SetActionLabelDel(u)
  105. return ltc
  106. }
  107. // SetID sets the "id" field.
  108. func (ltc *LabelTaggingCreate) SetID(u uint64) *LabelTaggingCreate {
  109. ltc.mutation.SetID(u)
  110. return ltc
  111. }
  112. // Mutation returns the LabelTaggingMutation object of the builder.
  113. func (ltc *LabelTaggingCreate) Mutation() *LabelTaggingMutation {
  114. return ltc.mutation
  115. }
  116. // Save creates the LabelTagging in the database.
  117. func (ltc *LabelTaggingCreate) Save(ctx context.Context) (*LabelTagging, error) {
  118. if err := ltc.defaults(); err != nil {
  119. return nil, err
  120. }
  121. return withHooks(ctx, ltc.sqlSave, ltc.mutation, ltc.hooks)
  122. }
  123. // SaveX calls Save and panics if Save returns an error.
  124. func (ltc *LabelTaggingCreate) SaveX(ctx context.Context) *LabelTagging {
  125. v, err := ltc.Save(ctx)
  126. if err != nil {
  127. panic(err)
  128. }
  129. return v
  130. }
  131. // Exec executes the query.
  132. func (ltc *LabelTaggingCreate) Exec(ctx context.Context) error {
  133. _, err := ltc.Save(ctx)
  134. return err
  135. }
  136. // ExecX is like Exec, but panics if an error occurs.
  137. func (ltc *LabelTaggingCreate) ExecX(ctx context.Context) {
  138. if err := ltc.Exec(ctx); err != nil {
  139. panic(err)
  140. }
  141. }
  142. // defaults sets the default values of the builder before save.
  143. func (ltc *LabelTaggingCreate) defaults() error {
  144. if _, ok := ltc.mutation.CreatedAt(); !ok {
  145. if labeltagging.DefaultCreatedAt == nil {
  146. return fmt.Errorf("ent: uninitialized labeltagging.DefaultCreatedAt (forgotten import ent/runtime?)")
  147. }
  148. v := labeltagging.DefaultCreatedAt()
  149. ltc.mutation.SetCreatedAt(v)
  150. }
  151. if _, ok := ltc.mutation.UpdatedAt(); !ok {
  152. if labeltagging.DefaultUpdatedAt == nil {
  153. return fmt.Errorf("ent: uninitialized labeltagging.DefaultUpdatedAt (forgotten import ent/runtime?)")
  154. }
  155. v := labeltagging.DefaultUpdatedAt()
  156. ltc.mutation.SetUpdatedAt(v)
  157. }
  158. if _, ok := ltc.mutation.Status(); !ok {
  159. v := labeltagging.DefaultStatus
  160. ltc.mutation.SetStatus(v)
  161. }
  162. if _, ok := ltc.mutation.OrganizationID(); !ok {
  163. v := labeltagging.DefaultOrganizationID
  164. ltc.mutation.SetOrganizationID(v)
  165. }
  166. if _, ok := ltc.mutation.GetType(); !ok {
  167. v := labeltagging.DefaultType
  168. ltc.mutation.SetType(v)
  169. }
  170. return nil
  171. }
  172. // check runs all checks and user-defined validators on the builder.
  173. func (ltc *LabelTaggingCreate) check() error {
  174. if _, ok := ltc.mutation.CreatedAt(); !ok {
  175. return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "LabelTagging.created_at"`)}
  176. }
  177. if _, ok := ltc.mutation.UpdatedAt(); !ok {
  178. return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "LabelTagging.updated_at"`)}
  179. }
  180. if _, ok := ltc.mutation.GetType(); !ok {
  181. return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "LabelTagging.type"`)}
  182. }
  183. return nil
  184. }
  185. func (ltc *LabelTaggingCreate) sqlSave(ctx context.Context) (*LabelTagging, error) {
  186. if err := ltc.check(); err != nil {
  187. return nil, err
  188. }
  189. _node, _spec := ltc.createSpec()
  190. if err := sqlgraph.CreateNode(ctx, ltc.driver, _spec); err != nil {
  191. if sqlgraph.IsConstraintError(err) {
  192. err = &ConstraintError{msg: err.Error(), wrap: err}
  193. }
  194. return nil, err
  195. }
  196. if _spec.ID.Value != _node.ID {
  197. id := _spec.ID.Value.(int64)
  198. _node.ID = uint64(id)
  199. }
  200. ltc.mutation.id = &_node.ID
  201. ltc.mutation.done = true
  202. return _node, nil
  203. }
  204. func (ltc *LabelTaggingCreate) createSpec() (*LabelTagging, *sqlgraph.CreateSpec) {
  205. var (
  206. _node = &LabelTagging{config: ltc.config}
  207. _spec = sqlgraph.NewCreateSpec(labeltagging.Table, sqlgraph.NewFieldSpec(labeltagging.FieldID, field.TypeUint64))
  208. )
  209. _spec.OnConflict = ltc.conflict
  210. if id, ok := ltc.mutation.ID(); ok {
  211. _node.ID = id
  212. _spec.ID.Value = id
  213. }
  214. if value, ok := ltc.mutation.CreatedAt(); ok {
  215. _spec.SetField(labeltagging.FieldCreatedAt, field.TypeTime, value)
  216. _node.CreatedAt = value
  217. }
  218. if value, ok := ltc.mutation.UpdatedAt(); ok {
  219. _spec.SetField(labeltagging.FieldUpdatedAt, field.TypeTime, value)
  220. _node.UpdatedAt = value
  221. }
  222. if value, ok := ltc.mutation.Status(); ok {
  223. _spec.SetField(labeltagging.FieldStatus, field.TypeUint8, value)
  224. _node.Status = value
  225. }
  226. if value, ok := ltc.mutation.DeletedAt(); ok {
  227. _spec.SetField(labeltagging.FieldDeletedAt, field.TypeTime, value)
  228. _node.DeletedAt = value
  229. }
  230. if value, ok := ltc.mutation.OrganizationID(); ok {
  231. _spec.SetField(labeltagging.FieldOrganizationID, field.TypeUint64, value)
  232. _node.OrganizationID = value
  233. }
  234. if value, ok := ltc.mutation.GetType(); ok {
  235. _spec.SetField(labeltagging.FieldType, field.TypeInt, value)
  236. _node.Type = value
  237. }
  238. if value, ok := ltc.mutation.Conditions(); ok {
  239. _spec.SetField(labeltagging.FieldConditions, field.TypeJSON, value)
  240. _node.Conditions = value
  241. }
  242. if value, ok := ltc.mutation.ActionLabelAdd(); ok {
  243. _spec.SetField(labeltagging.FieldActionLabelAdd, field.TypeJSON, value)
  244. _node.ActionLabelAdd = value
  245. }
  246. if value, ok := ltc.mutation.ActionLabelDel(); ok {
  247. _spec.SetField(labeltagging.FieldActionLabelDel, field.TypeJSON, value)
  248. _node.ActionLabelDel = value
  249. }
  250. return _node, _spec
  251. }
  252. // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
  253. // of the `INSERT` statement. For example:
  254. //
  255. // client.LabelTagging.Create().
  256. // SetCreatedAt(v).
  257. // OnConflict(
  258. // // Update the row with the new values
  259. // // the was proposed for insertion.
  260. // sql.ResolveWithNewValues(),
  261. // ).
  262. // // Override some of the fields with custom
  263. // // update values.
  264. // Update(func(u *ent.LabelTaggingUpsert) {
  265. // SetCreatedAt(v+v).
  266. // }).
  267. // Exec(ctx)
  268. func (ltc *LabelTaggingCreate) OnConflict(opts ...sql.ConflictOption) *LabelTaggingUpsertOne {
  269. ltc.conflict = opts
  270. return &LabelTaggingUpsertOne{
  271. create: ltc,
  272. }
  273. }
  274. // OnConflictColumns calls `OnConflict` and configures the columns
  275. // as conflict target. Using this option is equivalent to using:
  276. //
  277. // client.LabelTagging.Create().
  278. // OnConflict(sql.ConflictColumns(columns...)).
  279. // Exec(ctx)
  280. func (ltc *LabelTaggingCreate) OnConflictColumns(columns ...string) *LabelTaggingUpsertOne {
  281. ltc.conflict = append(ltc.conflict, sql.ConflictColumns(columns...))
  282. return &LabelTaggingUpsertOne{
  283. create: ltc,
  284. }
  285. }
  286. type (
  287. // LabelTaggingUpsertOne is the builder for "upsert"-ing
  288. // one LabelTagging node.
  289. LabelTaggingUpsertOne struct {
  290. create *LabelTaggingCreate
  291. }
  292. // LabelTaggingUpsert is the "OnConflict" setter.
  293. LabelTaggingUpsert struct {
  294. *sql.UpdateSet
  295. }
  296. )
  297. // SetUpdatedAt sets the "updated_at" field.
  298. func (u *LabelTaggingUpsert) SetUpdatedAt(v time.Time) *LabelTaggingUpsert {
  299. u.Set(labeltagging.FieldUpdatedAt, v)
  300. return u
  301. }
  302. // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
  303. func (u *LabelTaggingUpsert) UpdateUpdatedAt() *LabelTaggingUpsert {
  304. u.SetExcluded(labeltagging.FieldUpdatedAt)
  305. return u
  306. }
  307. // SetStatus sets the "status" field.
  308. func (u *LabelTaggingUpsert) SetStatus(v uint8) *LabelTaggingUpsert {
  309. u.Set(labeltagging.FieldStatus, v)
  310. return u
  311. }
  312. // UpdateStatus sets the "status" field to the value that was provided on create.
  313. func (u *LabelTaggingUpsert) UpdateStatus() *LabelTaggingUpsert {
  314. u.SetExcluded(labeltagging.FieldStatus)
  315. return u
  316. }
  317. // AddStatus adds v to the "status" field.
  318. func (u *LabelTaggingUpsert) AddStatus(v uint8) *LabelTaggingUpsert {
  319. u.Add(labeltagging.FieldStatus, v)
  320. return u
  321. }
  322. // ClearStatus clears the value of the "status" field.
  323. func (u *LabelTaggingUpsert) ClearStatus() *LabelTaggingUpsert {
  324. u.SetNull(labeltagging.FieldStatus)
  325. return u
  326. }
  327. // SetDeletedAt sets the "deleted_at" field.
  328. func (u *LabelTaggingUpsert) SetDeletedAt(v time.Time) *LabelTaggingUpsert {
  329. u.Set(labeltagging.FieldDeletedAt, v)
  330. return u
  331. }
  332. // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
  333. func (u *LabelTaggingUpsert) UpdateDeletedAt() *LabelTaggingUpsert {
  334. u.SetExcluded(labeltagging.FieldDeletedAt)
  335. return u
  336. }
  337. // ClearDeletedAt clears the value of the "deleted_at" field.
  338. func (u *LabelTaggingUpsert) ClearDeletedAt() *LabelTaggingUpsert {
  339. u.SetNull(labeltagging.FieldDeletedAt)
  340. return u
  341. }
  342. // SetOrganizationID sets the "organization_id" field.
  343. func (u *LabelTaggingUpsert) SetOrganizationID(v uint64) *LabelTaggingUpsert {
  344. u.Set(labeltagging.FieldOrganizationID, v)
  345. return u
  346. }
  347. // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
  348. func (u *LabelTaggingUpsert) UpdateOrganizationID() *LabelTaggingUpsert {
  349. u.SetExcluded(labeltagging.FieldOrganizationID)
  350. return u
  351. }
  352. // AddOrganizationID adds v to the "organization_id" field.
  353. func (u *LabelTaggingUpsert) AddOrganizationID(v uint64) *LabelTaggingUpsert {
  354. u.Add(labeltagging.FieldOrganizationID, v)
  355. return u
  356. }
  357. // ClearOrganizationID clears the value of the "organization_id" field.
  358. func (u *LabelTaggingUpsert) ClearOrganizationID() *LabelTaggingUpsert {
  359. u.SetNull(labeltagging.FieldOrganizationID)
  360. return u
  361. }
  362. // SetType sets the "type" field.
  363. func (u *LabelTaggingUpsert) SetType(v int) *LabelTaggingUpsert {
  364. u.Set(labeltagging.FieldType, v)
  365. return u
  366. }
  367. // UpdateType sets the "type" field to the value that was provided on create.
  368. func (u *LabelTaggingUpsert) UpdateType() *LabelTaggingUpsert {
  369. u.SetExcluded(labeltagging.FieldType)
  370. return u
  371. }
  372. // AddType adds v to the "type" field.
  373. func (u *LabelTaggingUpsert) AddType(v int) *LabelTaggingUpsert {
  374. u.Add(labeltagging.FieldType, v)
  375. return u
  376. }
  377. // SetConditions sets the "conditions" field.
  378. func (u *LabelTaggingUpsert) SetConditions(v []string) *LabelTaggingUpsert {
  379. u.Set(labeltagging.FieldConditions, v)
  380. return u
  381. }
  382. // UpdateConditions sets the "conditions" field to the value that was provided on create.
  383. func (u *LabelTaggingUpsert) UpdateConditions() *LabelTaggingUpsert {
  384. u.SetExcluded(labeltagging.FieldConditions)
  385. return u
  386. }
  387. // ClearConditions clears the value of the "conditions" field.
  388. func (u *LabelTaggingUpsert) ClearConditions() *LabelTaggingUpsert {
  389. u.SetNull(labeltagging.FieldConditions)
  390. return u
  391. }
  392. // SetActionLabelAdd sets the "action_label_add" field.
  393. func (u *LabelTaggingUpsert) SetActionLabelAdd(v []uint64) *LabelTaggingUpsert {
  394. u.Set(labeltagging.FieldActionLabelAdd, v)
  395. return u
  396. }
  397. // UpdateActionLabelAdd sets the "action_label_add" field to the value that was provided on create.
  398. func (u *LabelTaggingUpsert) UpdateActionLabelAdd() *LabelTaggingUpsert {
  399. u.SetExcluded(labeltagging.FieldActionLabelAdd)
  400. return u
  401. }
  402. // ClearActionLabelAdd clears the value of the "action_label_add" field.
  403. func (u *LabelTaggingUpsert) ClearActionLabelAdd() *LabelTaggingUpsert {
  404. u.SetNull(labeltagging.FieldActionLabelAdd)
  405. return u
  406. }
  407. // SetActionLabelDel sets the "action_label_del" field.
  408. func (u *LabelTaggingUpsert) SetActionLabelDel(v []uint64) *LabelTaggingUpsert {
  409. u.Set(labeltagging.FieldActionLabelDel, v)
  410. return u
  411. }
  412. // UpdateActionLabelDel sets the "action_label_del" field to the value that was provided on create.
  413. func (u *LabelTaggingUpsert) UpdateActionLabelDel() *LabelTaggingUpsert {
  414. u.SetExcluded(labeltagging.FieldActionLabelDel)
  415. return u
  416. }
  417. // ClearActionLabelDel clears the value of the "action_label_del" field.
  418. func (u *LabelTaggingUpsert) ClearActionLabelDel() *LabelTaggingUpsert {
  419. u.SetNull(labeltagging.FieldActionLabelDel)
  420. return u
  421. }
  422. // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
  423. // Using this option is equivalent to using:
  424. //
  425. // client.LabelTagging.Create().
  426. // OnConflict(
  427. // sql.ResolveWithNewValues(),
  428. // sql.ResolveWith(func(u *sql.UpdateSet) {
  429. // u.SetIgnore(labeltagging.FieldID)
  430. // }),
  431. // ).
  432. // Exec(ctx)
  433. func (u *LabelTaggingUpsertOne) UpdateNewValues() *LabelTaggingUpsertOne {
  434. u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
  435. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
  436. if _, exists := u.create.mutation.ID(); exists {
  437. s.SetIgnore(labeltagging.FieldID)
  438. }
  439. if _, exists := u.create.mutation.CreatedAt(); exists {
  440. s.SetIgnore(labeltagging.FieldCreatedAt)
  441. }
  442. }))
  443. return u
  444. }
  445. // Ignore sets each column to itself in case of conflict.
  446. // Using this option is equivalent to using:
  447. //
  448. // client.LabelTagging.Create().
  449. // OnConflict(sql.ResolveWithIgnore()).
  450. // Exec(ctx)
  451. func (u *LabelTaggingUpsertOne) Ignore() *LabelTaggingUpsertOne {
  452. u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
  453. return u
  454. }
  455. // DoNothing configures the conflict_action to `DO NOTHING`.
  456. // Supported only by SQLite and PostgreSQL.
  457. func (u *LabelTaggingUpsertOne) DoNothing() *LabelTaggingUpsertOne {
  458. u.create.conflict = append(u.create.conflict, sql.DoNothing())
  459. return u
  460. }
  461. // Update allows overriding fields `UPDATE` values. See the LabelTaggingCreate.OnConflict
  462. // documentation for more info.
  463. func (u *LabelTaggingUpsertOne) Update(set func(*LabelTaggingUpsert)) *LabelTaggingUpsertOne {
  464. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
  465. set(&LabelTaggingUpsert{UpdateSet: update})
  466. }))
  467. return u
  468. }
  469. // SetUpdatedAt sets the "updated_at" field.
  470. func (u *LabelTaggingUpsertOne) SetUpdatedAt(v time.Time) *LabelTaggingUpsertOne {
  471. return u.Update(func(s *LabelTaggingUpsert) {
  472. s.SetUpdatedAt(v)
  473. })
  474. }
  475. // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
  476. func (u *LabelTaggingUpsertOne) UpdateUpdatedAt() *LabelTaggingUpsertOne {
  477. return u.Update(func(s *LabelTaggingUpsert) {
  478. s.UpdateUpdatedAt()
  479. })
  480. }
  481. // SetStatus sets the "status" field.
  482. func (u *LabelTaggingUpsertOne) SetStatus(v uint8) *LabelTaggingUpsertOne {
  483. return u.Update(func(s *LabelTaggingUpsert) {
  484. s.SetStatus(v)
  485. })
  486. }
  487. // AddStatus adds v to the "status" field.
  488. func (u *LabelTaggingUpsertOne) AddStatus(v uint8) *LabelTaggingUpsertOne {
  489. return u.Update(func(s *LabelTaggingUpsert) {
  490. s.AddStatus(v)
  491. })
  492. }
  493. // UpdateStatus sets the "status" field to the value that was provided on create.
  494. func (u *LabelTaggingUpsertOne) UpdateStatus() *LabelTaggingUpsertOne {
  495. return u.Update(func(s *LabelTaggingUpsert) {
  496. s.UpdateStatus()
  497. })
  498. }
  499. // ClearStatus clears the value of the "status" field.
  500. func (u *LabelTaggingUpsertOne) ClearStatus() *LabelTaggingUpsertOne {
  501. return u.Update(func(s *LabelTaggingUpsert) {
  502. s.ClearStatus()
  503. })
  504. }
  505. // SetDeletedAt sets the "deleted_at" field.
  506. func (u *LabelTaggingUpsertOne) SetDeletedAt(v time.Time) *LabelTaggingUpsertOne {
  507. return u.Update(func(s *LabelTaggingUpsert) {
  508. s.SetDeletedAt(v)
  509. })
  510. }
  511. // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
  512. func (u *LabelTaggingUpsertOne) UpdateDeletedAt() *LabelTaggingUpsertOne {
  513. return u.Update(func(s *LabelTaggingUpsert) {
  514. s.UpdateDeletedAt()
  515. })
  516. }
  517. // ClearDeletedAt clears the value of the "deleted_at" field.
  518. func (u *LabelTaggingUpsertOne) ClearDeletedAt() *LabelTaggingUpsertOne {
  519. return u.Update(func(s *LabelTaggingUpsert) {
  520. s.ClearDeletedAt()
  521. })
  522. }
  523. // SetOrganizationID sets the "organization_id" field.
  524. func (u *LabelTaggingUpsertOne) SetOrganizationID(v uint64) *LabelTaggingUpsertOne {
  525. return u.Update(func(s *LabelTaggingUpsert) {
  526. s.SetOrganizationID(v)
  527. })
  528. }
  529. // AddOrganizationID adds v to the "organization_id" field.
  530. func (u *LabelTaggingUpsertOne) AddOrganizationID(v uint64) *LabelTaggingUpsertOne {
  531. return u.Update(func(s *LabelTaggingUpsert) {
  532. s.AddOrganizationID(v)
  533. })
  534. }
  535. // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
  536. func (u *LabelTaggingUpsertOne) UpdateOrganizationID() *LabelTaggingUpsertOne {
  537. return u.Update(func(s *LabelTaggingUpsert) {
  538. s.UpdateOrganizationID()
  539. })
  540. }
  541. // ClearOrganizationID clears the value of the "organization_id" field.
  542. func (u *LabelTaggingUpsertOne) ClearOrganizationID() *LabelTaggingUpsertOne {
  543. return u.Update(func(s *LabelTaggingUpsert) {
  544. s.ClearOrganizationID()
  545. })
  546. }
  547. // SetType sets the "type" field.
  548. func (u *LabelTaggingUpsertOne) SetType(v int) *LabelTaggingUpsertOne {
  549. return u.Update(func(s *LabelTaggingUpsert) {
  550. s.SetType(v)
  551. })
  552. }
  553. // AddType adds v to the "type" field.
  554. func (u *LabelTaggingUpsertOne) AddType(v int) *LabelTaggingUpsertOne {
  555. return u.Update(func(s *LabelTaggingUpsert) {
  556. s.AddType(v)
  557. })
  558. }
  559. // UpdateType sets the "type" field to the value that was provided on create.
  560. func (u *LabelTaggingUpsertOne) UpdateType() *LabelTaggingUpsertOne {
  561. return u.Update(func(s *LabelTaggingUpsert) {
  562. s.UpdateType()
  563. })
  564. }
  565. // SetConditions sets the "conditions" field.
  566. func (u *LabelTaggingUpsertOne) SetConditions(v []string) *LabelTaggingUpsertOne {
  567. return u.Update(func(s *LabelTaggingUpsert) {
  568. s.SetConditions(v)
  569. })
  570. }
  571. // UpdateConditions sets the "conditions" field to the value that was provided on create.
  572. func (u *LabelTaggingUpsertOne) UpdateConditions() *LabelTaggingUpsertOne {
  573. return u.Update(func(s *LabelTaggingUpsert) {
  574. s.UpdateConditions()
  575. })
  576. }
  577. // ClearConditions clears the value of the "conditions" field.
  578. func (u *LabelTaggingUpsertOne) ClearConditions() *LabelTaggingUpsertOne {
  579. return u.Update(func(s *LabelTaggingUpsert) {
  580. s.ClearConditions()
  581. })
  582. }
  583. // SetActionLabelAdd sets the "action_label_add" field.
  584. func (u *LabelTaggingUpsertOne) SetActionLabelAdd(v []uint64) *LabelTaggingUpsertOne {
  585. return u.Update(func(s *LabelTaggingUpsert) {
  586. s.SetActionLabelAdd(v)
  587. })
  588. }
  589. // UpdateActionLabelAdd sets the "action_label_add" field to the value that was provided on create.
  590. func (u *LabelTaggingUpsertOne) UpdateActionLabelAdd() *LabelTaggingUpsertOne {
  591. return u.Update(func(s *LabelTaggingUpsert) {
  592. s.UpdateActionLabelAdd()
  593. })
  594. }
  595. // ClearActionLabelAdd clears the value of the "action_label_add" field.
  596. func (u *LabelTaggingUpsertOne) ClearActionLabelAdd() *LabelTaggingUpsertOne {
  597. return u.Update(func(s *LabelTaggingUpsert) {
  598. s.ClearActionLabelAdd()
  599. })
  600. }
  601. // SetActionLabelDel sets the "action_label_del" field.
  602. func (u *LabelTaggingUpsertOne) SetActionLabelDel(v []uint64) *LabelTaggingUpsertOne {
  603. return u.Update(func(s *LabelTaggingUpsert) {
  604. s.SetActionLabelDel(v)
  605. })
  606. }
  607. // UpdateActionLabelDel sets the "action_label_del" field to the value that was provided on create.
  608. func (u *LabelTaggingUpsertOne) UpdateActionLabelDel() *LabelTaggingUpsertOne {
  609. return u.Update(func(s *LabelTaggingUpsert) {
  610. s.UpdateActionLabelDel()
  611. })
  612. }
  613. // ClearActionLabelDel clears the value of the "action_label_del" field.
  614. func (u *LabelTaggingUpsertOne) ClearActionLabelDel() *LabelTaggingUpsertOne {
  615. return u.Update(func(s *LabelTaggingUpsert) {
  616. s.ClearActionLabelDel()
  617. })
  618. }
  619. // Exec executes the query.
  620. func (u *LabelTaggingUpsertOne) Exec(ctx context.Context) error {
  621. if len(u.create.conflict) == 0 {
  622. return errors.New("ent: missing options for LabelTaggingCreate.OnConflict")
  623. }
  624. return u.create.Exec(ctx)
  625. }
  626. // ExecX is like Exec, but panics if an error occurs.
  627. func (u *LabelTaggingUpsertOne) ExecX(ctx context.Context) {
  628. if err := u.create.Exec(ctx); err != nil {
  629. panic(err)
  630. }
  631. }
  632. // Exec executes the UPSERT query and returns the inserted/updated ID.
  633. func (u *LabelTaggingUpsertOne) ID(ctx context.Context) (id uint64, err error) {
  634. node, err := u.create.Save(ctx)
  635. if err != nil {
  636. return id, err
  637. }
  638. return node.ID, nil
  639. }
  640. // IDX is like ID, but panics if an error occurs.
  641. func (u *LabelTaggingUpsertOne) IDX(ctx context.Context) uint64 {
  642. id, err := u.ID(ctx)
  643. if err != nil {
  644. panic(err)
  645. }
  646. return id
  647. }
  648. // LabelTaggingCreateBulk is the builder for creating many LabelTagging entities in bulk.
  649. type LabelTaggingCreateBulk struct {
  650. config
  651. err error
  652. builders []*LabelTaggingCreate
  653. conflict []sql.ConflictOption
  654. }
  655. // Save creates the LabelTagging entities in the database.
  656. func (ltcb *LabelTaggingCreateBulk) Save(ctx context.Context) ([]*LabelTagging, error) {
  657. if ltcb.err != nil {
  658. return nil, ltcb.err
  659. }
  660. specs := make([]*sqlgraph.CreateSpec, len(ltcb.builders))
  661. nodes := make([]*LabelTagging, len(ltcb.builders))
  662. mutators := make([]Mutator, len(ltcb.builders))
  663. for i := range ltcb.builders {
  664. func(i int, root context.Context) {
  665. builder := ltcb.builders[i]
  666. builder.defaults()
  667. var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
  668. mutation, ok := m.(*LabelTaggingMutation)
  669. if !ok {
  670. return nil, fmt.Errorf("unexpected mutation type %T", m)
  671. }
  672. if err := builder.check(); err != nil {
  673. return nil, err
  674. }
  675. builder.mutation = mutation
  676. var err error
  677. nodes[i], specs[i] = builder.createSpec()
  678. if i < len(mutators)-1 {
  679. _, err = mutators[i+1].Mutate(root, ltcb.builders[i+1].mutation)
  680. } else {
  681. spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
  682. spec.OnConflict = ltcb.conflict
  683. // Invoke the actual operation on the latest mutation in the chain.
  684. if err = sqlgraph.BatchCreate(ctx, ltcb.driver, spec); err != nil {
  685. if sqlgraph.IsConstraintError(err) {
  686. err = &ConstraintError{msg: err.Error(), wrap: err}
  687. }
  688. }
  689. }
  690. if err != nil {
  691. return nil, err
  692. }
  693. mutation.id = &nodes[i].ID
  694. if specs[i].ID.Value != nil && nodes[i].ID == 0 {
  695. id := specs[i].ID.Value.(int64)
  696. nodes[i].ID = uint64(id)
  697. }
  698. mutation.done = true
  699. return nodes[i], nil
  700. })
  701. for i := len(builder.hooks) - 1; i >= 0; i-- {
  702. mut = builder.hooks[i](mut)
  703. }
  704. mutators[i] = mut
  705. }(i, ctx)
  706. }
  707. if len(mutators) > 0 {
  708. if _, err := mutators[0].Mutate(ctx, ltcb.builders[0].mutation); err != nil {
  709. return nil, err
  710. }
  711. }
  712. return nodes, nil
  713. }
  714. // SaveX is like Save, but panics if an error occurs.
  715. func (ltcb *LabelTaggingCreateBulk) SaveX(ctx context.Context) []*LabelTagging {
  716. v, err := ltcb.Save(ctx)
  717. if err != nil {
  718. panic(err)
  719. }
  720. return v
  721. }
  722. // Exec executes the query.
  723. func (ltcb *LabelTaggingCreateBulk) Exec(ctx context.Context) error {
  724. _, err := ltcb.Save(ctx)
  725. return err
  726. }
  727. // ExecX is like Exec, but panics if an error occurs.
  728. func (ltcb *LabelTaggingCreateBulk) ExecX(ctx context.Context) {
  729. if err := ltcb.Exec(ctx); err != nil {
  730. panic(err)
  731. }
  732. }
  733. // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
  734. // of the `INSERT` statement. For example:
  735. //
  736. // client.LabelTagging.CreateBulk(builders...).
  737. // OnConflict(
  738. // // Update the row with the new values
  739. // // the was proposed for insertion.
  740. // sql.ResolveWithNewValues(),
  741. // ).
  742. // // Override some of the fields with custom
  743. // // update values.
  744. // Update(func(u *ent.LabelTaggingUpsert) {
  745. // SetCreatedAt(v+v).
  746. // }).
  747. // Exec(ctx)
  748. func (ltcb *LabelTaggingCreateBulk) OnConflict(opts ...sql.ConflictOption) *LabelTaggingUpsertBulk {
  749. ltcb.conflict = opts
  750. return &LabelTaggingUpsertBulk{
  751. create: ltcb,
  752. }
  753. }
  754. // OnConflictColumns calls `OnConflict` and configures the columns
  755. // as conflict target. Using this option is equivalent to using:
  756. //
  757. // client.LabelTagging.Create().
  758. // OnConflict(sql.ConflictColumns(columns...)).
  759. // Exec(ctx)
  760. func (ltcb *LabelTaggingCreateBulk) OnConflictColumns(columns ...string) *LabelTaggingUpsertBulk {
  761. ltcb.conflict = append(ltcb.conflict, sql.ConflictColumns(columns...))
  762. return &LabelTaggingUpsertBulk{
  763. create: ltcb,
  764. }
  765. }
  766. // LabelTaggingUpsertBulk is the builder for "upsert"-ing
  767. // a bulk of LabelTagging nodes.
  768. type LabelTaggingUpsertBulk struct {
  769. create *LabelTaggingCreateBulk
  770. }
  771. // UpdateNewValues updates the mutable fields using the new values that
  772. // were set on create. Using this option is equivalent to using:
  773. //
  774. // client.LabelTagging.Create().
  775. // OnConflict(
  776. // sql.ResolveWithNewValues(),
  777. // sql.ResolveWith(func(u *sql.UpdateSet) {
  778. // u.SetIgnore(labeltagging.FieldID)
  779. // }),
  780. // ).
  781. // Exec(ctx)
  782. func (u *LabelTaggingUpsertBulk) UpdateNewValues() *LabelTaggingUpsertBulk {
  783. u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
  784. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
  785. for _, b := range u.create.builders {
  786. if _, exists := b.mutation.ID(); exists {
  787. s.SetIgnore(labeltagging.FieldID)
  788. }
  789. if _, exists := b.mutation.CreatedAt(); exists {
  790. s.SetIgnore(labeltagging.FieldCreatedAt)
  791. }
  792. }
  793. }))
  794. return u
  795. }
  796. // Ignore sets each column to itself in case of conflict.
  797. // Using this option is equivalent to using:
  798. //
  799. // client.LabelTagging.Create().
  800. // OnConflict(sql.ResolveWithIgnore()).
  801. // Exec(ctx)
  802. func (u *LabelTaggingUpsertBulk) Ignore() *LabelTaggingUpsertBulk {
  803. u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
  804. return u
  805. }
  806. // DoNothing configures the conflict_action to `DO NOTHING`.
  807. // Supported only by SQLite and PostgreSQL.
  808. func (u *LabelTaggingUpsertBulk) DoNothing() *LabelTaggingUpsertBulk {
  809. u.create.conflict = append(u.create.conflict, sql.DoNothing())
  810. return u
  811. }
  812. // Update allows overriding fields `UPDATE` values. See the LabelTaggingCreateBulk.OnConflict
  813. // documentation for more info.
  814. func (u *LabelTaggingUpsertBulk) Update(set func(*LabelTaggingUpsert)) *LabelTaggingUpsertBulk {
  815. u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
  816. set(&LabelTaggingUpsert{UpdateSet: update})
  817. }))
  818. return u
  819. }
  820. // SetUpdatedAt sets the "updated_at" field.
  821. func (u *LabelTaggingUpsertBulk) SetUpdatedAt(v time.Time) *LabelTaggingUpsertBulk {
  822. return u.Update(func(s *LabelTaggingUpsert) {
  823. s.SetUpdatedAt(v)
  824. })
  825. }
  826. // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
  827. func (u *LabelTaggingUpsertBulk) UpdateUpdatedAt() *LabelTaggingUpsertBulk {
  828. return u.Update(func(s *LabelTaggingUpsert) {
  829. s.UpdateUpdatedAt()
  830. })
  831. }
  832. // SetStatus sets the "status" field.
  833. func (u *LabelTaggingUpsertBulk) SetStatus(v uint8) *LabelTaggingUpsertBulk {
  834. return u.Update(func(s *LabelTaggingUpsert) {
  835. s.SetStatus(v)
  836. })
  837. }
  838. // AddStatus adds v to the "status" field.
  839. func (u *LabelTaggingUpsertBulk) AddStatus(v uint8) *LabelTaggingUpsertBulk {
  840. return u.Update(func(s *LabelTaggingUpsert) {
  841. s.AddStatus(v)
  842. })
  843. }
  844. // UpdateStatus sets the "status" field to the value that was provided on create.
  845. func (u *LabelTaggingUpsertBulk) UpdateStatus() *LabelTaggingUpsertBulk {
  846. return u.Update(func(s *LabelTaggingUpsert) {
  847. s.UpdateStatus()
  848. })
  849. }
  850. // ClearStatus clears the value of the "status" field.
  851. func (u *LabelTaggingUpsertBulk) ClearStatus() *LabelTaggingUpsertBulk {
  852. return u.Update(func(s *LabelTaggingUpsert) {
  853. s.ClearStatus()
  854. })
  855. }
  856. // SetDeletedAt sets the "deleted_at" field.
  857. func (u *LabelTaggingUpsertBulk) SetDeletedAt(v time.Time) *LabelTaggingUpsertBulk {
  858. return u.Update(func(s *LabelTaggingUpsert) {
  859. s.SetDeletedAt(v)
  860. })
  861. }
  862. // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
  863. func (u *LabelTaggingUpsertBulk) UpdateDeletedAt() *LabelTaggingUpsertBulk {
  864. return u.Update(func(s *LabelTaggingUpsert) {
  865. s.UpdateDeletedAt()
  866. })
  867. }
  868. // ClearDeletedAt clears the value of the "deleted_at" field.
  869. func (u *LabelTaggingUpsertBulk) ClearDeletedAt() *LabelTaggingUpsertBulk {
  870. return u.Update(func(s *LabelTaggingUpsert) {
  871. s.ClearDeletedAt()
  872. })
  873. }
  874. // SetOrganizationID sets the "organization_id" field.
  875. func (u *LabelTaggingUpsertBulk) SetOrganizationID(v uint64) *LabelTaggingUpsertBulk {
  876. return u.Update(func(s *LabelTaggingUpsert) {
  877. s.SetOrganizationID(v)
  878. })
  879. }
  880. // AddOrganizationID adds v to the "organization_id" field.
  881. func (u *LabelTaggingUpsertBulk) AddOrganizationID(v uint64) *LabelTaggingUpsertBulk {
  882. return u.Update(func(s *LabelTaggingUpsert) {
  883. s.AddOrganizationID(v)
  884. })
  885. }
  886. // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
  887. func (u *LabelTaggingUpsertBulk) UpdateOrganizationID() *LabelTaggingUpsertBulk {
  888. return u.Update(func(s *LabelTaggingUpsert) {
  889. s.UpdateOrganizationID()
  890. })
  891. }
  892. // ClearOrganizationID clears the value of the "organization_id" field.
  893. func (u *LabelTaggingUpsertBulk) ClearOrganizationID() *LabelTaggingUpsertBulk {
  894. return u.Update(func(s *LabelTaggingUpsert) {
  895. s.ClearOrganizationID()
  896. })
  897. }
  898. // SetType sets the "type" field.
  899. func (u *LabelTaggingUpsertBulk) SetType(v int) *LabelTaggingUpsertBulk {
  900. return u.Update(func(s *LabelTaggingUpsert) {
  901. s.SetType(v)
  902. })
  903. }
  904. // AddType adds v to the "type" field.
  905. func (u *LabelTaggingUpsertBulk) AddType(v int) *LabelTaggingUpsertBulk {
  906. return u.Update(func(s *LabelTaggingUpsert) {
  907. s.AddType(v)
  908. })
  909. }
  910. // UpdateType sets the "type" field to the value that was provided on create.
  911. func (u *LabelTaggingUpsertBulk) UpdateType() *LabelTaggingUpsertBulk {
  912. return u.Update(func(s *LabelTaggingUpsert) {
  913. s.UpdateType()
  914. })
  915. }
  916. // SetConditions sets the "conditions" field.
  917. func (u *LabelTaggingUpsertBulk) SetConditions(v []string) *LabelTaggingUpsertBulk {
  918. return u.Update(func(s *LabelTaggingUpsert) {
  919. s.SetConditions(v)
  920. })
  921. }
  922. // UpdateConditions sets the "conditions" field to the value that was provided on create.
  923. func (u *LabelTaggingUpsertBulk) UpdateConditions() *LabelTaggingUpsertBulk {
  924. return u.Update(func(s *LabelTaggingUpsert) {
  925. s.UpdateConditions()
  926. })
  927. }
  928. // ClearConditions clears the value of the "conditions" field.
  929. func (u *LabelTaggingUpsertBulk) ClearConditions() *LabelTaggingUpsertBulk {
  930. return u.Update(func(s *LabelTaggingUpsert) {
  931. s.ClearConditions()
  932. })
  933. }
  934. // SetActionLabelAdd sets the "action_label_add" field.
  935. func (u *LabelTaggingUpsertBulk) SetActionLabelAdd(v []uint64) *LabelTaggingUpsertBulk {
  936. return u.Update(func(s *LabelTaggingUpsert) {
  937. s.SetActionLabelAdd(v)
  938. })
  939. }
  940. // UpdateActionLabelAdd sets the "action_label_add" field to the value that was provided on create.
  941. func (u *LabelTaggingUpsertBulk) UpdateActionLabelAdd() *LabelTaggingUpsertBulk {
  942. return u.Update(func(s *LabelTaggingUpsert) {
  943. s.UpdateActionLabelAdd()
  944. })
  945. }
  946. // ClearActionLabelAdd clears the value of the "action_label_add" field.
  947. func (u *LabelTaggingUpsertBulk) ClearActionLabelAdd() *LabelTaggingUpsertBulk {
  948. return u.Update(func(s *LabelTaggingUpsert) {
  949. s.ClearActionLabelAdd()
  950. })
  951. }
  952. // SetActionLabelDel sets the "action_label_del" field.
  953. func (u *LabelTaggingUpsertBulk) SetActionLabelDel(v []uint64) *LabelTaggingUpsertBulk {
  954. return u.Update(func(s *LabelTaggingUpsert) {
  955. s.SetActionLabelDel(v)
  956. })
  957. }
  958. // UpdateActionLabelDel sets the "action_label_del" field to the value that was provided on create.
  959. func (u *LabelTaggingUpsertBulk) UpdateActionLabelDel() *LabelTaggingUpsertBulk {
  960. return u.Update(func(s *LabelTaggingUpsert) {
  961. s.UpdateActionLabelDel()
  962. })
  963. }
  964. // ClearActionLabelDel clears the value of the "action_label_del" field.
  965. func (u *LabelTaggingUpsertBulk) ClearActionLabelDel() *LabelTaggingUpsertBulk {
  966. return u.Update(func(s *LabelTaggingUpsert) {
  967. s.ClearActionLabelDel()
  968. })
  969. }
  970. // Exec executes the query.
  971. func (u *LabelTaggingUpsertBulk) Exec(ctx context.Context) error {
  972. if u.create.err != nil {
  973. return u.create.err
  974. }
  975. for i, b := range u.create.builders {
  976. if len(b.conflict) != 0 {
  977. return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the LabelTaggingCreateBulk instead", i)
  978. }
  979. }
  980. if len(u.create.conflict) == 0 {
  981. return errors.New("ent: missing options for LabelTaggingCreateBulk.OnConflict")
  982. }
  983. return u.create.Exec(ctx)
  984. }
  985. // ExecX is like Exec, but panics if an error occurs.
  986. func (u *LabelTaggingUpsertBulk) ExecX(ctx context.Context) {
  987. if err := u.create.Exec(ctx); err != nil {
  988. panic(err)
  989. }
  990. }