usagestatisticmonth_update.go 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  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/predicate"
  9. "wechat-api/ent/usagestatisticmonth"
  10. "entgo.io/ent/dialect/sql"
  11. "entgo.io/ent/dialect/sql/sqlgraph"
  12. "entgo.io/ent/schema/field"
  13. )
  14. // UsageStatisticMonthUpdate is the builder for updating UsageStatisticMonth entities.
  15. type UsageStatisticMonthUpdate struct {
  16. config
  17. hooks []Hook
  18. mutation *UsageStatisticMonthMutation
  19. }
  20. // Where appends a list predicates to the UsageStatisticMonthUpdate builder.
  21. func (usmu *UsageStatisticMonthUpdate) Where(ps ...predicate.UsageStatisticMonth) *UsageStatisticMonthUpdate {
  22. usmu.mutation.Where(ps...)
  23. return usmu
  24. }
  25. // SetUpdatedAt sets the "updated_at" field.
  26. func (usmu *UsageStatisticMonthUpdate) SetUpdatedAt(t time.Time) *UsageStatisticMonthUpdate {
  27. usmu.mutation.SetUpdatedAt(t)
  28. return usmu
  29. }
  30. // SetStatus sets the "status" field.
  31. func (usmu *UsageStatisticMonthUpdate) SetStatus(u uint8) *UsageStatisticMonthUpdate {
  32. usmu.mutation.ResetStatus()
  33. usmu.mutation.SetStatus(u)
  34. return usmu
  35. }
  36. // SetNillableStatus sets the "status" field if the given value is not nil.
  37. func (usmu *UsageStatisticMonthUpdate) SetNillableStatus(u *uint8) *UsageStatisticMonthUpdate {
  38. if u != nil {
  39. usmu.SetStatus(*u)
  40. }
  41. return usmu
  42. }
  43. // AddStatus adds u to the "status" field.
  44. func (usmu *UsageStatisticMonthUpdate) AddStatus(u int8) *UsageStatisticMonthUpdate {
  45. usmu.mutation.AddStatus(u)
  46. return usmu
  47. }
  48. // ClearStatus clears the value of the "status" field.
  49. func (usmu *UsageStatisticMonthUpdate) ClearStatus() *UsageStatisticMonthUpdate {
  50. usmu.mutation.ClearStatus()
  51. return usmu
  52. }
  53. // SetDeletedAt sets the "deleted_at" field.
  54. func (usmu *UsageStatisticMonthUpdate) SetDeletedAt(t time.Time) *UsageStatisticMonthUpdate {
  55. usmu.mutation.SetDeletedAt(t)
  56. return usmu
  57. }
  58. // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
  59. func (usmu *UsageStatisticMonthUpdate) SetNillableDeletedAt(t *time.Time) *UsageStatisticMonthUpdate {
  60. if t != nil {
  61. usmu.SetDeletedAt(*t)
  62. }
  63. return usmu
  64. }
  65. // ClearDeletedAt clears the value of the "deleted_at" field.
  66. func (usmu *UsageStatisticMonthUpdate) ClearDeletedAt() *UsageStatisticMonthUpdate {
  67. usmu.mutation.ClearDeletedAt()
  68. return usmu
  69. }
  70. // SetAddtime sets the "addtime" field.
  71. func (usmu *UsageStatisticMonthUpdate) SetAddtime(u uint64) *UsageStatisticMonthUpdate {
  72. usmu.mutation.ResetAddtime()
  73. usmu.mutation.SetAddtime(u)
  74. return usmu
  75. }
  76. // SetNillableAddtime sets the "addtime" field if the given value is not nil.
  77. func (usmu *UsageStatisticMonthUpdate) SetNillableAddtime(u *uint64) *UsageStatisticMonthUpdate {
  78. if u != nil {
  79. usmu.SetAddtime(*u)
  80. }
  81. return usmu
  82. }
  83. // AddAddtime adds u to the "addtime" field.
  84. func (usmu *UsageStatisticMonthUpdate) AddAddtime(u int64) *UsageStatisticMonthUpdate {
  85. usmu.mutation.AddAddtime(u)
  86. return usmu
  87. }
  88. // SetType sets the "type" field.
  89. func (usmu *UsageStatisticMonthUpdate) SetType(i int) *UsageStatisticMonthUpdate {
  90. usmu.mutation.ResetType()
  91. usmu.mutation.SetType(i)
  92. return usmu
  93. }
  94. // SetNillableType sets the "type" field if the given value is not nil.
  95. func (usmu *UsageStatisticMonthUpdate) SetNillableType(i *int) *UsageStatisticMonthUpdate {
  96. if i != nil {
  97. usmu.SetType(*i)
  98. }
  99. return usmu
  100. }
  101. // AddType adds i to the "type" field.
  102. func (usmu *UsageStatisticMonthUpdate) AddType(i int) *UsageStatisticMonthUpdate {
  103. usmu.mutation.AddType(i)
  104. return usmu
  105. }
  106. // SetBotID sets the "bot_id" field.
  107. func (usmu *UsageStatisticMonthUpdate) SetBotID(s string) *UsageStatisticMonthUpdate {
  108. usmu.mutation.SetBotID(s)
  109. return usmu
  110. }
  111. // SetNillableBotID sets the "bot_id" field if the given value is not nil.
  112. func (usmu *UsageStatisticMonthUpdate) SetNillableBotID(s *string) *UsageStatisticMonthUpdate {
  113. if s != nil {
  114. usmu.SetBotID(*s)
  115. }
  116. return usmu
  117. }
  118. // SetOrganizationID sets the "organization_id" field.
  119. func (usmu *UsageStatisticMonthUpdate) SetOrganizationID(u uint64) *UsageStatisticMonthUpdate {
  120. usmu.mutation.ResetOrganizationID()
  121. usmu.mutation.SetOrganizationID(u)
  122. return usmu
  123. }
  124. // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
  125. func (usmu *UsageStatisticMonthUpdate) SetNillableOrganizationID(u *uint64) *UsageStatisticMonthUpdate {
  126. if u != nil {
  127. usmu.SetOrganizationID(*u)
  128. }
  129. return usmu
  130. }
  131. // AddOrganizationID adds u to the "organization_id" field.
  132. func (usmu *UsageStatisticMonthUpdate) AddOrganizationID(u int64) *UsageStatisticMonthUpdate {
  133. usmu.mutation.AddOrganizationID(u)
  134. return usmu
  135. }
  136. // ClearOrganizationID clears the value of the "organization_id" field.
  137. func (usmu *UsageStatisticMonthUpdate) ClearOrganizationID() *UsageStatisticMonthUpdate {
  138. usmu.mutation.ClearOrganizationID()
  139. return usmu
  140. }
  141. // SetAiResponse sets the "ai_response" field.
  142. func (usmu *UsageStatisticMonthUpdate) SetAiResponse(u uint64) *UsageStatisticMonthUpdate {
  143. usmu.mutation.ResetAiResponse()
  144. usmu.mutation.SetAiResponse(u)
  145. return usmu
  146. }
  147. // SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
  148. func (usmu *UsageStatisticMonthUpdate) SetNillableAiResponse(u *uint64) *UsageStatisticMonthUpdate {
  149. if u != nil {
  150. usmu.SetAiResponse(*u)
  151. }
  152. return usmu
  153. }
  154. // AddAiResponse adds u to the "ai_response" field.
  155. func (usmu *UsageStatisticMonthUpdate) AddAiResponse(u int64) *UsageStatisticMonthUpdate {
  156. usmu.mutation.AddAiResponse(u)
  157. return usmu
  158. }
  159. // SetSopRun sets the "sop_run" field.
  160. func (usmu *UsageStatisticMonthUpdate) SetSopRun(u uint64) *UsageStatisticMonthUpdate {
  161. usmu.mutation.ResetSopRun()
  162. usmu.mutation.SetSopRun(u)
  163. return usmu
  164. }
  165. // SetNillableSopRun sets the "sop_run" field if the given value is not nil.
  166. func (usmu *UsageStatisticMonthUpdate) SetNillableSopRun(u *uint64) *UsageStatisticMonthUpdate {
  167. if u != nil {
  168. usmu.SetSopRun(*u)
  169. }
  170. return usmu
  171. }
  172. // AddSopRun adds u to the "sop_run" field.
  173. func (usmu *UsageStatisticMonthUpdate) AddSopRun(u int64) *UsageStatisticMonthUpdate {
  174. usmu.mutation.AddSopRun(u)
  175. return usmu
  176. }
  177. // SetTotalFriend sets the "total_friend" field.
  178. func (usmu *UsageStatisticMonthUpdate) SetTotalFriend(u uint64) *UsageStatisticMonthUpdate {
  179. usmu.mutation.ResetTotalFriend()
  180. usmu.mutation.SetTotalFriend(u)
  181. return usmu
  182. }
  183. // SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
  184. func (usmu *UsageStatisticMonthUpdate) SetNillableTotalFriend(u *uint64) *UsageStatisticMonthUpdate {
  185. if u != nil {
  186. usmu.SetTotalFriend(*u)
  187. }
  188. return usmu
  189. }
  190. // AddTotalFriend adds u to the "total_friend" field.
  191. func (usmu *UsageStatisticMonthUpdate) AddTotalFriend(u int64) *UsageStatisticMonthUpdate {
  192. usmu.mutation.AddTotalFriend(u)
  193. return usmu
  194. }
  195. // SetTotalGroup sets the "total_group" field.
  196. func (usmu *UsageStatisticMonthUpdate) SetTotalGroup(u uint64) *UsageStatisticMonthUpdate {
  197. usmu.mutation.ResetTotalGroup()
  198. usmu.mutation.SetTotalGroup(u)
  199. return usmu
  200. }
  201. // SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
  202. func (usmu *UsageStatisticMonthUpdate) SetNillableTotalGroup(u *uint64) *UsageStatisticMonthUpdate {
  203. if u != nil {
  204. usmu.SetTotalGroup(*u)
  205. }
  206. return usmu
  207. }
  208. // AddTotalGroup adds u to the "total_group" field.
  209. func (usmu *UsageStatisticMonthUpdate) AddTotalGroup(u int64) *UsageStatisticMonthUpdate {
  210. usmu.mutation.AddTotalGroup(u)
  211. return usmu
  212. }
  213. // SetAccountBalance sets the "account_balance" field.
  214. func (usmu *UsageStatisticMonthUpdate) SetAccountBalance(u uint64) *UsageStatisticMonthUpdate {
  215. usmu.mutation.ResetAccountBalance()
  216. usmu.mutation.SetAccountBalance(u)
  217. return usmu
  218. }
  219. // SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
  220. func (usmu *UsageStatisticMonthUpdate) SetNillableAccountBalance(u *uint64) *UsageStatisticMonthUpdate {
  221. if u != nil {
  222. usmu.SetAccountBalance(*u)
  223. }
  224. return usmu
  225. }
  226. // AddAccountBalance adds u to the "account_balance" field.
  227. func (usmu *UsageStatisticMonthUpdate) AddAccountBalance(u int64) *UsageStatisticMonthUpdate {
  228. usmu.mutation.AddAccountBalance(u)
  229. return usmu
  230. }
  231. // SetConsumeToken sets the "consume_token" field.
  232. func (usmu *UsageStatisticMonthUpdate) SetConsumeToken(u uint64) *UsageStatisticMonthUpdate {
  233. usmu.mutation.ResetConsumeToken()
  234. usmu.mutation.SetConsumeToken(u)
  235. return usmu
  236. }
  237. // SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
  238. func (usmu *UsageStatisticMonthUpdate) SetNillableConsumeToken(u *uint64) *UsageStatisticMonthUpdate {
  239. if u != nil {
  240. usmu.SetConsumeToken(*u)
  241. }
  242. return usmu
  243. }
  244. // AddConsumeToken adds u to the "consume_token" field.
  245. func (usmu *UsageStatisticMonthUpdate) AddConsumeToken(u int64) *UsageStatisticMonthUpdate {
  246. usmu.mutation.AddConsumeToken(u)
  247. return usmu
  248. }
  249. // SetActiveUser sets the "active_user" field.
  250. func (usmu *UsageStatisticMonthUpdate) SetActiveUser(u uint64) *UsageStatisticMonthUpdate {
  251. usmu.mutation.ResetActiveUser()
  252. usmu.mutation.SetActiveUser(u)
  253. return usmu
  254. }
  255. // SetNillableActiveUser sets the "active_user" field if the given value is not nil.
  256. func (usmu *UsageStatisticMonthUpdate) SetNillableActiveUser(u *uint64) *UsageStatisticMonthUpdate {
  257. if u != nil {
  258. usmu.SetActiveUser(*u)
  259. }
  260. return usmu
  261. }
  262. // AddActiveUser adds u to the "active_user" field.
  263. func (usmu *UsageStatisticMonthUpdate) AddActiveUser(u int64) *UsageStatisticMonthUpdate {
  264. usmu.mutation.AddActiveUser(u)
  265. return usmu
  266. }
  267. // SetNewUser sets the "new_user" field.
  268. func (usmu *UsageStatisticMonthUpdate) SetNewUser(i int64) *UsageStatisticMonthUpdate {
  269. usmu.mutation.ResetNewUser()
  270. usmu.mutation.SetNewUser(i)
  271. return usmu
  272. }
  273. // SetNillableNewUser sets the "new_user" field if the given value is not nil.
  274. func (usmu *UsageStatisticMonthUpdate) SetNillableNewUser(i *int64) *UsageStatisticMonthUpdate {
  275. if i != nil {
  276. usmu.SetNewUser(*i)
  277. }
  278. return usmu
  279. }
  280. // AddNewUser adds i to the "new_user" field.
  281. func (usmu *UsageStatisticMonthUpdate) AddNewUser(i int64) *UsageStatisticMonthUpdate {
  282. usmu.mutation.AddNewUser(i)
  283. return usmu
  284. }
  285. // Mutation returns the UsageStatisticMonthMutation object of the builder.
  286. func (usmu *UsageStatisticMonthUpdate) Mutation() *UsageStatisticMonthMutation {
  287. return usmu.mutation
  288. }
  289. // Save executes the query and returns the number of nodes affected by the update operation.
  290. func (usmu *UsageStatisticMonthUpdate) Save(ctx context.Context) (int, error) {
  291. if err := usmu.defaults(); err != nil {
  292. return 0, err
  293. }
  294. return withHooks(ctx, usmu.sqlSave, usmu.mutation, usmu.hooks)
  295. }
  296. // SaveX is like Save, but panics if an error occurs.
  297. func (usmu *UsageStatisticMonthUpdate) SaveX(ctx context.Context) int {
  298. affected, err := usmu.Save(ctx)
  299. if err != nil {
  300. panic(err)
  301. }
  302. return affected
  303. }
  304. // Exec executes the query.
  305. func (usmu *UsageStatisticMonthUpdate) Exec(ctx context.Context) error {
  306. _, err := usmu.Save(ctx)
  307. return err
  308. }
  309. // ExecX is like Exec, but panics if an error occurs.
  310. func (usmu *UsageStatisticMonthUpdate) ExecX(ctx context.Context) {
  311. if err := usmu.Exec(ctx); err != nil {
  312. panic(err)
  313. }
  314. }
  315. // defaults sets the default values of the builder before save.
  316. func (usmu *UsageStatisticMonthUpdate) defaults() error {
  317. if _, ok := usmu.mutation.UpdatedAt(); !ok {
  318. if usagestatisticmonth.UpdateDefaultUpdatedAt == nil {
  319. return fmt.Errorf("ent: uninitialized usagestatisticmonth.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
  320. }
  321. v := usagestatisticmonth.UpdateDefaultUpdatedAt()
  322. usmu.mutation.SetUpdatedAt(v)
  323. }
  324. return nil
  325. }
  326. func (usmu *UsageStatisticMonthUpdate) sqlSave(ctx context.Context) (n int, err error) {
  327. _spec := sqlgraph.NewUpdateSpec(usagestatisticmonth.Table, usagestatisticmonth.Columns, sqlgraph.NewFieldSpec(usagestatisticmonth.FieldID, field.TypeUint64))
  328. if ps := usmu.mutation.predicates; len(ps) > 0 {
  329. _spec.Predicate = func(selector *sql.Selector) {
  330. for i := range ps {
  331. ps[i](selector)
  332. }
  333. }
  334. }
  335. if value, ok := usmu.mutation.UpdatedAt(); ok {
  336. _spec.SetField(usagestatisticmonth.FieldUpdatedAt, field.TypeTime, value)
  337. }
  338. if value, ok := usmu.mutation.Status(); ok {
  339. _spec.SetField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
  340. }
  341. if value, ok := usmu.mutation.AddedStatus(); ok {
  342. _spec.AddField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
  343. }
  344. if usmu.mutation.StatusCleared() {
  345. _spec.ClearField(usagestatisticmonth.FieldStatus, field.TypeUint8)
  346. }
  347. if value, ok := usmu.mutation.DeletedAt(); ok {
  348. _spec.SetField(usagestatisticmonth.FieldDeletedAt, field.TypeTime, value)
  349. }
  350. if usmu.mutation.DeletedAtCleared() {
  351. _spec.ClearField(usagestatisticmonth.FieldDeletedAt, field.TypeTime)
  352. }
  353. if value, ok := usmu.mutation.Addtime(); ok {
  354. _spec.SetField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
  355. }
  356. if value, ok := usmu.mutation.AddedAddtime(); ok {
  357. _spec.AddField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
  358. }
  359. if value, ok := usmu.mutation.GetType(); ok {
  360. _spec.SetField(usagestatisticmonth.FieldType, field.TypeInt, value)
  361. }
  362. if value, ok := usmu.mutation.AddedType(); ok {
  363. _spec.AddField(usagestatisticmonth.FieldType, field.TypeInt, value)
  364. }
  365. if value, ok := usmu.mutation.BotID(); ok {
  366. _spec.SetField(usagestatisticmonth.FieldBotID, field.TypeString, value)
  367. }
  368. if value, ok := usmu.mutation.OrganizationID(); ok {
  369. _spec.SetField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
  370. }
  371. if value, ok := usmu.mutation.AddedOrganizationID(); ok {
  372. _spec.AddField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
  373. }
  374. if usmu.mutation.OrganizationIDCleared() {
  375. _spec.ClearField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64)
  376. }
  377. if value, ok := usmu.mutation.AiResponse(); ok {
  378. _spec.SetField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
  379. }
  380. if value, ok := usmu.mutation.AddedAiResponse(); ok {
  381. _spec.AddField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
  382. }
  383. if value, ok := usmu.mutation.SopRun(); ok {
  384. _spec.SetField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
  385. }
  386. if value, ok := usmu.mutation.AddedSopRun(); ok {
  387. _spec.AddField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
  388. }
  389. if value, ok := usmu.mutation.TotalFriend(); ok {
  390. _spec.SetField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
  391. }
  392. if value, ok := usmu.mutation.AddedTotalFriend(); ok {
  393. _spec.AddField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
  394. }
  395. if value, ok := usmu.mutation.TotalGroup(); ok {
  396. _spec.SetField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
  397. }
  398. if value, ok := usmu.mutation.AddedTotalGroup(); ok {
  399. _spec.AddField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
  400. }
  401. if value, ok := usmu.mutation.AccountBalance(); ok {
  402. _spec.SetField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
  403. }
  404. if value, ok := usmu.mutation.AddedAccountBalance(); ok {
  405. _spec.AddField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
  406. }
  407. if value, ok := usmu.mutation.ConsumeToken(); ok {
  408. _spec.SetField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
  409. }
  410. if value, ok := usmu.mutation.AddedConsumeToken(); ok {
  411. _spec.AddField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
  412. }
  413. if value, ok := usmu.mutation.ActiveUser(); ok {
  414. _spec.SetField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
  415. }
  416. if value, ok := usmu.mutation.AddedActiveUser(); ok {
  417. _spec.AddField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
  418. }
  419. if value, ok := usmu.mutation.NewUser(); ok {
  420. _spec.SetField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
  421. }
  422. if value, ok := usmu.mutation.AddedNewUser(); ok {
  423. _spec.AddField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
  424. }
  425. if n, err = sqlgraph.UpdateNodes(ctx, usmu.driver, _spec); err != nil {
  426. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  427. err = &NotFoundError{usagestatisticmonth.Label}
  428. } else if sqlgraph.IsConstraintError(err) {
  429. err = &ConstraintError{msg: err.Error(), wrap: err}
  430. }
  431. return 0, err
  432. }
  433. usmu.mutation.done = true
  434. return n, nil
  435. }
  436. // UsageStatisticMonthUpdateOne is the builder for updating a single UsageStatisticMonth entity.
  437. type UsageStatisticMonthUpdateOne struct {
  438. config
  439. fields []string
  440. hooks []Hook
  441. mutation *UsageStatisticMonthMutation
  442. }
  443. // SetUpdatedAt sets the "updated_at" field.
  444. func (usmuo *UsageStatisticMonthUpdateOne) SetUpdatedAt(t time.Time) *UsageStatisticMonthUpdateOne {
  445. usmuo.mutation.SetUpdatedAt(t)
  446. return usmuo
  447. }
  448. // SetStatus sets the "status" field.
  449. func (usmuo *UsageStatisticMonthUpdateOne) SetStatus(u uint8) *UsageStatisticMonthUpdateOne {
  450. usmuo.mutation.ResetStatus()
  451. usmuo.mutation.SetStatus(u)
  452. return usmuo
  453. }
  454. // SetNillableStatus sets the "status" field if the given value is not nil.
  455. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableStatus(u *uint8) *UsageStatisticMonthUpdateOne {
  456. if u != nil {
  457. usmuo.SetStatus(*u)
  458. }
  459. return usmuo
  460. }
  461. // AddStatus adds u to the "status" field.
  462. func (usmuo *UsageStatisticMonthUpdateOne) AddStatus(u int8) *UsageStatisticMonthUpdateOne {
  463. usmuo.mutation.AddStatus(u)
  464. return usmuo
  465. }
  466. // ClearStatus clears the value of the "status" field.
  467. func (usmuo *UsageStatisticMonthUpdateOne) ClearStatus() *UsageStatisticMonthUpdateOne {
  468. usmuo.mutation.ClearStatus()
  469. return usmuo
  470. }
  471. // SetDeletedAt sets the "deleted_at" field.
  472. func (usmuo *UsageStatisticMonthUpdateOne) SetDeletedAt(t time.Time) *UsageStatisticMonthUpdateOne {
  473. usmuo.mutation.SetDeletedAt(t)
  474. return usmuo
  475. }
  476. // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
  477. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableDeletedAt(t *time.Time) *UsageStatisticMonthUpdateOne {
  478. if t != nil {
  479. usmuo.SetDeletedAt(*t)
  480. }
  481. return usmuo
  482. }
  483. // ClearDeletedAt clears the value of the "deleted_at" field.
  484. func (usmuo *UsageStatisticMonthUpdateOne) ClearDeletedAt() *UsageStatisticMonthUpdateOne {
  485. usmuo.mutation.ClearDeletedAt()
  486. return usmuo
  487. }
  488. // SetAddtime sets the "addtime" field.
  489. func (usmuo *UsageStatisticMonthUpdateOne) SetAddtime(u uint64) *UsageStatisticMonthUpdateOne {
  490. usmuo.mutation.ResetAddtime()
  491. usmuo.mutation.SetAddtime(u)
  492. return usmuo
  493. }
  494. // SetNillableAddtime sets the "addtime" field if the given value is not nil.
  495. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableAddtime(u *uint64) *UsageStatisticMonthUpdateOne {
  496. if u != nil {
  497. usmuo.SetAddtime(*u)
  498. }
  499. return usmuo
  500. }
  501. // AddAddtime adds u to the "addtime" field.
  502. func (usmuo *UsageStatisticMonthUpdateOne) AddAddtime(u int64) *UsageStatisticMonthUpdateOne {
  503. usmuo.mutation.AddAddtime(u)
  504. return usmuo
  505. }
  506. // SetType sets the "type" field.
  507. func (usmuo *UsageStatisticMonthUpdateOne) SetType(i int) *UsageStatisticMonthUpdateOne {
  508. usmuo.mutation.ResetType()
  509. usmuo.mutation.SetType(i)
  510. return usmuo
  511. }
  512. // SetNillableType sets the "type" field if the given value is not nil.
  513. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableType(i *int) *UsageStatisticMonthUpdateOne {
  514. if i != nil {
  515. usmuo.SetType(*i)
  516. }
  517. return usmuo
  518. }
  519. // AddType adds i to the "type" field.
  520. func (usmuo *UsageStatisticMonthUpdateOne) AddType(i int) *UsageStatisticMonthUpdateOne {
  521. usmuo.mutation.AddType(i)
  522. return usmuo
  523. }
  524. // SetBotID sets the "bot_id" field.
  525. func (usmuo *UsageStatisticMonthUpdateOne) SetBotID(s string) *UsageStatisticMonthUpdateOne {
  526. usmuo.mutation.SetBotID(s)
  527. return usmuo
  528. }
  529. // SetNillableBotID sets the "bot_id" field if the given value is not nil.
  530. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableBotID(s *string) *UsageStatisticMonthUpdateOne {
  531. if s != nil {
  532. usmuo.SetBotID(*s)
  533. }
  534. return usmuo
  535. }
  536. // SetOrganizationID sets the "organization_id" field.
  537. func (usmuo *UsageStatisticMonthUpdateOne) SetOrganizationID(u uint64) *UsageStatisticMonthUpdateOne {
  538. usmuo.mutation.ResetOrganizationID()
  539. usmuo.mutation.SetOrganizationID(u)
  540. return usmuo
  541. }
  542. // SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
  543. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableOrganizationID(u *uint64) *UsageStatisticMonthUpdateOne {
  544. if u != nil {
  545. usmuo.SetOrganizationID(*u)
  546. }
  547. return usmuo
  548. }
  549. // AddOrganizationID adds u to the "organization_id" field.
  550. func (usmuo *UsageStatisticMonthUpdateOne) AddOrganizationID(u int64) *UsageStatisticMonthUpdateOne {
  551. usmuo.mutation.AddOrganizationID(u)
  552. return usmuo
  553. }
  554. // ClearOrganizationID clears the value of the "organization_id" field.
  555. func (usmuo *UsageStatisticMonthUpdateOne) ClearOrganizationID() *UsageStatisticMonthUpdateOne {
  556. usmuo.mutation.ClearOrganizationID()
  557. return usmuo
  558. }
  559. // SetAiResponse sets the "ai_response" field.
  560. func (usmuo *UsageStatisticMonthUpdateOne) SetAiResponse(u uint64) *UsageStatisticMonthUpdateOne {
  561. usmuo.mutation.ResetAiResponse()
  562. usmuo.mutation.SetAiResponse(u)
  563. return usmuo
  564. }
  565. // SetNillableAiResponse sets the "ai_response" field if the given value is not nil.
  566. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableAiResponse(u *uint64) *UsageStatisticMonthUpdateOne {
  567. if u != nil {
  568. usmuo.SetAiResponse(*u)
  569. }
  570. return usmuo
  571. }
  572. // AddAiResponse adds u to the "ai_response" field.
  573. func (usmuo *UsageStatisticMonthUpdateOne) AddAiResponse(u int64) *UsageStatisticMonthUpdateOne {
  574. usmuo.mutation.AddAiResponse(u)
  575. return usmuo
  576. }
  577. // SetSopRun sets the "sop_run" field.
  578. func (usmuo *UsageStatisticMonthUpdateOne) SetSopRun(u uint64) *UsageStatisticMonthUpdateOne {
  579. usmuo.mutation.ResetSopRun()
  580. usmuo.mutation.SetSopRun(u)
  581. return usmuo
  582. }
  583. // SetNillableSopRun sets the "sop_run" field if the given value is not nil.
  584. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableSopRun(u *uint64) *UsageStatisticMonthUpdateOne {
  585. if u != nil {
  586. usmuo.SetSopRun(*u)
  587. }
  588. return usmuo
  589. }
  590. // AddSopRun adds u to the "sop_run" field.
  591. func (usmuo *UsageStatisticMonthUpdateOne) AddSopRun(u int64) *UsageStatisticMonthUpdateOne {
  592. usmuo.mutation.AddSopRun(u)
  593. return usmuo
  594. }
  595. // SetTotalFriend sets the "total_friend" field.
  596. func (usmuo *UsageStatisticMonthUpdateOne) SetTotalFriend(u uint64) *UsageStatisticMonthUpdateOne {
  597. usmuo.mutation.ResetTotalFriend()
  598. usmuo.mutation.SetTotalFriend(u)
  599. return usmuo
  600. }
  601. // SetNillableTotalFriend sets the "total_friend" field if the given value is not nil.
  602. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableTotalFriend(u *uint64) *UsageStatisticMonthUpdateOne {
  603. if u != nil {
  604. usmuo.SetTotalFriend(*u)
  605. }
  606. return usmuo
  607. }
  608. // AddTotalFriend adds u to the "total_friend" field.
  609. func (usmuo *UsageStatisticMonthUpdateOne) AddTotalFriend(u int64) *UsageStatisticMonthUpdateOne {
  610. usmuo.mutation.AddTotalFriend(u)
  611. return usmuo
  612. }
  613. // SetTotalGroup sets the "total_group" field.
  614. func (usmuo *UsageStatisticMonthUpdateOne) SetTotalGroup(u uint64) *UsageStatisticMonthUpdateOne {
  615. usmuo.mutation.ResetTotalGroup()
  616. usmuo.mutation.SetTotalGroup(u)
  617. return usmuo
  618. }
  619. // SetNillableTotalGroup sets the "total_group" field if the given value is not nil.
  620. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableTotalGroup(u *uint64) *UsageStatisticMonthUpdateOne {
  621. if u != nil {
  622. usmuo.SetTotalGroup(*u)
  623. }
  624. return usmuo
  625. }
  626. // AddTotalGroup adds u to the "total_group" field.
  627. func (usmuo *UsageStatisticMonthUpdateOne) AddTotalGroup(u int64) *UsageStatisticMonthUpdateOne {
  628. usmuo.mutation.AddTotalGroup(u)
  629. return usmuo
  630. }
  631. // SetAccountBalance sets the "account_balance" field.
  632. func (usmuo *UsageStatisticMonthUpdateOne) SetAccountBalance(u uint64) *UsageStatisticMonthUpdateOne {
  633. usmuo.mutation.ResetAccountBalance()
  634. usmuo.mutation.SetAccountBalance(u)
  635. return usmuo
  636. }
  637. // SetNillableAccountBalance sets the "account_balance" field if the given value is not nil.
  638. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableAccountBalance(u *uint64) *UsageStatisticMonthUpdateOne {
  639. if u != nil {
  640. usmuo.SetAccountBalance(*u)
  641. }
  642. return usmuo
  643. }
  644. // AddAccountBalance adds u to the "account_balance" field.
  645. func (usmuo *UsageStatisticMonthUpdateOne) AddAccountBalance(u int64) *UsageStatisticMonthUpdateOne {
  646. usmuo.mutation.AddAccountBalance(u)
  647. return usmuo
  648. }
  649. // SetConsumeToken sets the "consume_token" field.
  650. func (usmuo *UsageStatisticMonthUpdateOne) SetConsumeToken(u uint64) *UsageStatisticMonthUpdateOne {
  651. usmuo.mutation.ResetConsumeToken()
  652. usmuo.mutation.SetConsumeToken(u)
  653. return usmuo
  654. }
  655. // SetNillableConsumeToken sets the "consume_token" field if the given value is not nil.
  656. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableConsumeToken(u *uint64) *UsageStatisticMonthUpdateOne {
  657. if u != nil {
  658. usmuo.SetConsumeToken(*u)
  659. }
  660. return usmuo
  661. }
  662. // AddConsumeToken adds u to the "consume_token" field.
  663. func (usmuo *UsageStatisticMonthUpdateOne) AddConsumeToken(u int64) *UsageStatisticMonthUpdateOne {
  664. usmuo.mutation.AddConsumeToken(u)
  665. return usmuo
  666. }
  667. // SetActiveUser sets the "active_user" field.
  668. func (usmuo *UsageStatisticMonthUpdateOne) SetActiveUser(u uint64) *UsageStatisticMonthUpdateOne {
  669. usmuo.mutation.ResetActiveUser()
  670. usmuo.mutation.SetActiveUser(u)
  671. return usmuo
  672. }
  673. // SetNillableActiveUser sets the "active_user" field if the given value is not nil.
  674. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableActiveUser(u *uint64) *UsageStatisticMonthUpdateOne {
  675. if u != nil {
  676. usmuo.SetActiveUser(*u)
  677. }
  678. return usmuo
  679. }
  680. // AddActiveUser adds u to the "active_user" field.
  681. func (usmuo *UsageStatisticMonthUpdateOne) AddActiveUser(u int64) *UsageStatisticMonthUpdateOne {
  682. usmuo.mutation.AddActiveUser(u)
  683. return usmuo
  684. }
  685. // SetNewUser sets the "new_user" field.
  686. func (usmuo *UsageStatisticMonthUpdateOne) SetNewUser(i int64) *UsageStatisticMonthUpdateOne {
  687. usmuo.mutation.ResetNewUser()
  688. usmuo.mutation.SetNewUser(i)
  689. return usmuo
  690. }
  691. // SetNillableNewUser sets the "new_user" field if the given value is not nil.
  692. func (usmuo *UsageStatisticMonthUpdateOne) SetNillableNewUser(i *int64) *UsageStatisticMonthUpdateOne {
  693. if i != nil {
  694. usmuo.SetNewUser(*i)
  695. }
  696. return usmuo
  697. }
  698. // AddNewUser adds i to the "new_user" field.
  699. func (usmuo *UsageStatisticMonthUpdateOne) AddNewUser(i int64) *UsageStatisticMonthUpdateOne {
  700. usmuo.mutation.AddNewUser(i)
  701. return usmuo
  702. }
  703. // Mutation returns the UsageStatisticMonthMutation object of the builder.
  704. func (usmuo *UsageStatisticMonthUpdateOne) Mutation() *UsageStatisticMonthMutation {
  705. return usmuo.mutation
  706. }
  707. // Where appends a list predicates to the UsageStatisticMonthUpdate builder.
  708. func (usmuo *UsageStatisticMonthUpdateOne) Where(ps ...predicate.UsageStatisticMonth) *UsageStatisticMonthUpdateOne {
  709. usmuo.mutation.Where(ps...)
  710. return usmuo
  711. }
  712. // Select allows selecting one or more fields (columns) of the returned entity.
  713. // The default is selecting all fields defined in the entity schema.
  714. func (usmuo *UsageStatisticMonthUpdateOne) Select(field string, fields ...string) *UsageStatisticMonthUpdateOne {
  715. usmuo.fields = append([]string{field}, fields...)
  716. return usmuo
  717. }
  718. // Save executes the query and returns the updated UsageStatisticMonth entity.
  719. func (usmuo *UsageStatisticMonthUpdateOne) Save(ctx context.Context) (*UsageStatisticMonth, error) {
  720. if err := usmuo.defaults(); err != nil {
  721. return nil, err
  722. }
  723. return withHooks(ctx, usmuo.sqlSave, usmuo.mutation, usmuo.hooks)
  724. }
  725. // SaveX is like Save, but panics if an error occurs.
  726. func (usmuo *UsageStatisticMonthUpdateOne) SaveX(ctx context.Context) *UsageStatisticMonth {
  727. node, err := usmuo.Save(ctx)
  728. if err != nil {
  729. panic(err)
  730. }
  731. return node
  732. }
  733. // Exec executes the query on the entity.
  734. func (usmuo *UsageStatisticMonthUpdateOne) Exec(ctx context.Context) error {
  735. _, err := usmuo.Save(ctx)
  736. return err
  737. }
  738. // ExecX is like Exec, but panics if an error occurs.
  739. func (usmuo *UsageStatisticMonthUpdateOne) ExecX(ctx context.Context) {
  740. if err := usmuo.Exec(ctx); err != nil {
  741. panic(err)
  742. }
  743. }
  744. // defaults sets the default values of the builder before save.
  745. func (usmuo *UsageStatisticMonthUpdateOne) defaults() error {
  746. if _, ok := usmuo.mutation.UpdatedAt(); !ok {
  747. if usagestatisticmonth.UpdateDefaultUpdatedAt == nil {
  748. return fmt.Errorf("ent: uninitialized usagestatisticmonth.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
  749. }
  750. v := usagestatisticmonth.UpdateDefaultUpdatedAt()
  751. usmuo.mutation.SetUpdatedAt(v)
  752. }
  753. return nil
  754. }
  755. func (usmuo *UsageStatisticMonthUpdateOne) sqlSave(ctx context.Context) (_node *UsageStatisticMonth, err error) {
  756. _spec := sqlgraph.NewUpdateSpec(usagestatisticmonth.Table, usagestatisticmonth.Columns, sqlgraph.NewFieldSpec(usagestatisticmonth.FieldID, field.TypeUint64))
  757. id, ok := usmuo.mutation.ID()
  758. if !ok {
  759. return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "UsageStatisticMonth.id" for update`)}
  760. }
  761. _spec.Node.ID.Value = id
  762. if fields := usmuo.fields; len(fields) > 0 {
  763. _spec.Node.Columns = make([]string, 0, len(fields))
  764. _spec.Node.Columns = append(_spec.Node.Columns, usagestatisticmonth.FieldID)
  765. for _, f := range fields {
  766. if !usagestatisticmonth.ValidColumn(f) {
  767. return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
  768. }
  769. if f != usagestatisticmonth.FieldID {
  770. _spec.Node.Columns = append(_spec.Node.Columns, f)
  771. }
  772. }
  773. }
  774. if ps := usmuo.mutation.predicates; len(ps) > 0 {
  775. _spec.Predicate = func(selector *sql.Selector) {
  776. for i := range ps {
  777. ps[i](selector)
  778. }
  779. }
  780. }
  781. if value, ok := usmuo.mutation.UpdatedAt(); ok {
  782. _spec.SetField(usagestatisticmonth.FieldUpdatedAt, field.TypeTime, value)
  783. }
  784. if value, ok := usmuo.mutation.Status(); ok {
  785. _spec.SetField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
  786. }
  787. if value, ok := usmuo.mutation.AddedStatus(); ok {
  788. _spec.AddField(usagestatisticmonth.FieldStatus, field.TypeUint8, value)
  789. }
  790. if usmuo.mutation.StatusCleared() {
  791. _spec.ClearField(usagestatisticmonth.FieldStatus, field.TypeUint8)
  792. }
  793. if value, ok := usmuo.mutation.DeletedAt(); ok {
  794. _spec.SetField(usagestatisticmonth.FieldDeletedAt, field.TypeTime, value)
  795. }
  796. if usmuo.mutation.DeletedAtCleared() {
  797. _spec.ClearField(usagestatisticmonth.FieldDeletedAt, field.TypeTime)
  798. }
  799. if value, ok := usmuo.mutation.Addtime(); ok {
  800. _spec.SetField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
  801. }
  802. if value, ok := usmuo.mutation.AddedAddtime(); ok {
  803. _spec.AddField(usagestatisticmonth.FieldAddtime, field.TypeUint64, value)
  804. }
  805. if value, ok := usmuo.mutation.GetType(); ok {
  806. _spec.SetField(usagestatisticmonth.FieldType, field.TypeInt, value)
  807. }
  808. if value, ok := usmuo.mutation.AddedType(); ok {
  809. _spec.AddField(usagestatisticmonth.FieldType, field.TypeInt, value)
  810. }
  811. if value, ok := usmuo.mutation.BotID(); ok {
  812. _spec.SetField(usagestatisticmonth.FieldBotID, field.TypeString, value)
  813. }
  814. if value, ok := usmuo.mutation.OrganizationID(); ok {
  815. _spec.SetField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
  816. }
  817. if value, ok := usmuo.mutation.AddedOrganizationID(); ok {
  818. _spec.AddField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64, value)
  819. }
  820. if usmuo.mutation.OrganizationIDCleared() {
  821. _spec.ClearField(usagestatisticmonth.FieldOrganizationID, field.TypeUint64)
  822. }
  823. if value, ok := usmuo.mutation.AiResponse(); ok {
  824. _spec.SetField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
  825. }
  826. if value, ok := usmuo.mutation.AddedAiResponse(); ok {
  827. _spec.AddField(usagestatisticmonth.FieldAiResponse, field.TypeUint64, value)
  828. }
  829. if value, ok := usmuo.mutation.SopRun(); ok {
  830. _spec.SetField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
  831. }
  832. if value, ok := usmuo.mutation.AddedSopRun(); ok {
  833. _spec.AddField(usagestatisticmonth.FieldSopRun, field.TypeUint64, value)
  834. }
  835. if value, ok := usmuo.mutation.TotalFriend(); ok {
  836. _spec.SetField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
  837. }
  838. if value, ok := usmuo.mutation.AddedTotalFriend(); ok {
  839. _spec.AddField(usagestatisticmonth.FieldTotalFriend, field.TypeUint64, value)
  840. }
  841. if value, ok := usmuo.mutation.TotalGroup(); ok {
  842. _spec.SetField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
  843. }
  844. if value, ok := usmuo.mutation.AddedTotalGroup(); ok {
  845. _spec.AddField(usagestatisticmonth.FieldTotalGroup, field.TypeUint64, value)
  846. }
  847. if value, ok := usmuo.mutation.AccountBalance(); ok {
  848. _spec.SetField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
  849. }
  850. if value, ok := usmuo.mutation.AddedAccountBalance(); ok {
  851. _spec.AddField(usagestatisticmonth.FieldAccountBalance, field.TypeUint64, value)
  852. }
  853. if value, ok := usmuo.mutation.ConsumeToken(); ok {
  854. _spec.SetField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
  855. }
  856. if value, ok := usmuo.mutation.AddedConsumeToken(); ok {
  857. _spec.AddField(usagestatisticmonth.FieldConsumeToken, field.TypeUint64, value)
  858. }
  859. if value, ok := usmuo.mutation.ActiveUser(); ok {
  860. _spec.SetField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
  861. }
  862. if value, ok := usmuo.mutation.AddedActiveUser(); ok {
  863. _spec.AddField(usagestatisticmonth.FieldActiveUser, field.TypeUint64, value)
  864. }
  865. if value, ok := usmuo.mutation.NewUser(); ok {
  866. _spec.SetField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
  867. }
  868. if value, ok := usmuo.mutation.AddedNewUser(); ok {
  869. _spec.AddField(usagestatisticmonth.FieldNewUser, field.TypeInt64, value)
  870. }
  871. _node = &UsageStatisticMonth{config: usmuo.config}
  872. _spec.Assign = _node.assignValues
  873. _spec.ScanValues = _node.scanValues
  874. if err = sqlgraph.UpdateNode(ctx, usmuo.driver, _spec); err != nil {
  875. if _, ok := err.(*sqlgraph.NotFoundError); ok {
  876. err = &NotFoundError{usagestatisticmonth.Label}
  877. } else if sqlgraph.IsConstraintError(err) {
  878. err = &ConstraintError{msg: err.Error(), wrap: err}
  879. }
  880. return nil, err
  881. }
  882. usmuo.mutation.done = true
  883. return _node, nil
  884. }