123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/msg"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // MsgCreate is the builder for creating a Msg entity.
- type MsgCreate struct {
- config
- mutation *MsgMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (mc *MsgCreate) SetCreatedAt(t time.Time) *MsgCreate {
- mc.mutation.SetCreatedAt(t)
- return mc
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableCreatedAt(t *time.Time) *MsgCreate {
- if t != nil {
- mc.SetCreatedAt(*t)
- }
- return mc
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (mc *MsgCreate) SetUpdatedAt(t time.Time) *MsgCreate {
- mc.mutation.SetUpdatedAt(t)
- return mc
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableUpdatedAt(t *time.Time) *MsgCreate {
- if t != nil {
- mc.SetUpdatedAt(*t)
- }
- return mc
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (mc *MsgCreate) SetDeletedAt(t time.Time) *MsgCreate {
- mc.mutation.SetDeletedAt(t)
- return mc
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableDeletedAt(t *time.Time) *MsgCreate {
- if t != nil {
- mc.SetDeletedAt(*t)
- }
- return mc
- }
- // SetStatus sets the "status" field.
- func (mc *MsgCreate) SetStatus(u uint8) *MsgCreate {
- mc.mutation.SetStatus(u)
- return mc
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableStatus(u *uint8) *MsgCreate {
- if u != nil {
- mc.SetStatus(*u)
- }
- return mc
- }
- // SetFromwxid sets the "fromwxid" field.
- func (mc *MsgCreate) SetFromwxid(s string) *MsgCreate {
- mc.mutation.SetFromwxid(s)
- return mc
- }
- // SetNillableFromwxid sets the "fromwxid" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableFromwxid(s *string) *MsgCreate {
- if s != nil {
- mc.SetFromwxid(*s)
- }
- return mc
- }
- // SetToid sets the "toid" field.
- func (mc *MsgCreate) SetToid(s string) *MsgCreate {
- mc.mutation.SetToid(s)
- return mc
- }
- // SetNillableToid sets the "toid" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableToid(s *string) *MsgCreate {
- if s != nil {
- mc.SetToid(*s)
- }
- return mc
- }
- // SetMsgtype sets the "msgtype" field.
- func (mc *MsgCreate) SetMsgtype(i int32) *MsgCreate {
- mc.mutation.SetMsgtype(i)
- return mc
- }
- // SetNillableMsgtype sets the "msgtype" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableMsgtype(i *int32) *MsgCreate {
- if i != nil {
- mc.SetMsgtype(*i)
- }
- return mc
- }
- // SetMsg sets the "msg" field.
- func (mc *MsgCreate) SetMsg(s string) *MsgCreate {
- mc.mutation.SetMsg(s)
- return mc
- }
- // SetNillableMsg sets the "msg" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableMsg(s *string) *MsgCreate {
- if s != nil {
- mc.SetMsg(*s)
- }
- return mc
- }
- // SetBatchNo sets the "batch_no" field.
- func (mc *MsgCreate) SetBatchNo(s string) *MsgCreate {
- mc.mutation.SetBatchNo(s)
- return mc
- }
- // SetNillableBatchNo sets the "batch_no" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableBatchNo(s *string) *MsgCreate {
- if s != nil {
- mc.SetBatchNo(*s)
- }
- return mc
- }
- // SetCtype sets the "ctype" field.
- func (mc *MsgCreate) SetCtype(u uint64) *MsgCreate {
- mc.mutation.SetCtype(u)
- return mc
- }
- // SetNillableCtype sets the "ctype" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableCtype(u *uint64) *MsgCreate {
- if u != nil {
- mc.SetCtype(*u)
- }
- return mc
- }
- // SetCc sets the "cc" field.
- func (mc *MsgCreate) SetCc(s string) *MsgCreate {
- mc.mutation.SetCc(s)
- return mc
- }
- // SetNillableCc sets the "cc" field if the given value is not nil.
- func (mc *MsgCreate) SetNillableCc(s *string) *MsgCreate {
- if s != nil {
- mc.SetCc(*s)
- }
- return mc
- }
- // SetPhone sets the "phone" field.
- func (mc *MsgCreate) SetPhone(s string) *MsgCreate {
- mc.mutation.SetPhone(s)
- return mc
- }
- // SetNillablePhone sets the "phone" field if the given value is not nil.
- func (mc *MsgCreate) SetNillablePhone(s *string) *MsgCreate {
- if s != nil {
- mc.SetPhone(*s)
- }
- return mc
- }
- // SetID sets the "id" field.
- func (mc *MsgCreate) SetID(u uint64) *MsgCreate {
- mc.mutation.SetID(u)
- return mc
- }
- // Mutation returns the MsgMutation object of the builder.
- func (mc *MsgCreate) Mutation() *MsgMutation {
- return mc.mutation
- }
- // Save creates the Msg in the database.
- func (mc *MsgCreate) Save(ctx context.Context) (*Msg, error) {
- if err := mc.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, mc.sqlSave, mc.mutation, mc.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (mc *MsgCreate) SaveX(ctx context.Context) *Msg {
- v, err := mc.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (mc *MsgCreate) Exec(ctx context.Context) error {
- _, err := mc.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (mc *MsgCreate) ExecX(ctx context.Context) {
- if err := mc.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (mc *MsgCreate) defaults() error {
- if _, ok := mc.mutation.CreatedAt(); !ok {
- if msg.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized msg.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := msg.DefaultCreatedAt()
- mc.mutation.SetCreatedAt(v)
- }
- if _, ok := mc.mutation.UpdatedAt(); !ok {
- if msg.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized msg.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := msg.DefaultUpdatedAt()
- mc.mutation.SetUpdatedAt(v)
- }
- if _, ok := mc.mutation.Ctype(); !ok {
- v := msg.DefaultCtype
- mc.mutation.SetCtype(v)
- }
- if _, ok := mc.mutation.Cc(); !ok {
- v := msg.DefaultCc
- mc.mutation.SetCc(v)
- }
- if _, ok := mc.mutation.Phone(); !ok {
- v := msg.DefaultPhone
- mc.mutation.SetPhone(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (mc *MsgCreate) check() error {
- if _, ok := mc.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Msg.created_at"`)}
- }
- if _, ok := mc.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Msg.updated_at"`)}
- }
- if _, ok := mc.mutation.Ctype(); !ok {
- return &ValidationError{Name: "ctype", err: errors.New(`ent: missing required field "Msg.ctype"`)}
- }
- if _, ok := mc.mutation.Cc(); !ok {
- return &ValidationError{Name: "cc", err: errors.New(`ent: missing required field "Msg.cc"`)}
- }
- if _, ok := mc.mutation.Phone(); !ok {
- return &ValidationError{Name: "phone", err: errors.New(`ent: missing required field "Msg.phone"`)}
- }
- return nil
- }
- func (mc *MsgCreate) sqlSave(ctx context.Context) (*Msg, error) {
- if err := mc.check(); err != nil {
- return nil, err
- }
- _node, _spec := mc.createSpec()
- if err := sqlgraph.CreateNode(ctx, mc.driver, _spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- if _spec.ID.Value != _node.ID {
- id := _spec.ID.Value.(int64)
- _node.ID = uint64(id)
- }
- mc.mutation.id = &_node.ID
- mc.mutation.done = true
- return _node, nil
- }
- func (mc *MsgCreate) createSpec() (*Msg, *sqlgraph.CreateSpec) {
- var (
- _node = &Msg{config: mc.config}
- _spec = sqlgraph.NewCreateSpec(msg.Table, sqlgraph.NewFieldSpec(msg.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = mc.conflict
- if id, ok := mc.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := mc.mutation.CreatedAt(); ok {
- _spec.SetField(msg.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := mc.mutation.UpdatedAt(); ok {
- _spec.SetField(msg.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := mc.mutation.DeletedAt(); ok {
- _spec.SetField(msg.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = value
- }
- if value, ok := mc.mutation.Status(); ok {
- _spec.SetField(msg.FieldStatus, field.TypeUint8, value)
- _node.Status = value
- }
- if value, ok := mc.mutation.Fromwxid(); ok {
- _spec.SetField(msg.FieldFromwxid, field.TypeString, value)
- _node.Fromwxid = value
- }
- if value, ok := mc.mutation.Toid(); ok {
- _spec.SetField(msg.FieldToid, field.TypeString, value)
- _node.Toid = value
- }
- if value, ok := mc.mutation.Msgtype(); ok {
- _spec.SetField(msg.FieldMsgtype, field.TypeInt32, value)
- _node.Msgtype = value
- }
- if value, ok := mc.mutation.Msg(); ok {
- _spec.SetField(msg.FieldMsg, field.TypeString, value)
- _node.Msg = value
- }
- if value, ok := mc.mutation.BatchNo(); ok {
- _spec.SetField(msg.FieldBatchNo, field.TypeString, value)
- _node.BatchNo = value
- }
- if value, ok := mc.mutation.Ctype(); ok {
- _spec.SetField(msg.FieldCtype, field.TypeUint64, value)
- _node.Ctype = value
- }
- if value, ok := mc.mutation.Cc(); ok {
- _spec.SetField(msg.FieldCc, field.TypeString, value)
- _node.Cc = value
- }
- if value, ok := mc.mutation.Phone(); ok {
- _spec.SetField(msg.FieldPhone, field.TypeString, value)
- _node.Phone = value
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Msg.Create().
- // SetCreatedAt(v).
- // OnConflict(
- // // Update the row with the new values
- // // the was proposed for insertion.
- // sql.ResolveWithNewValues(),
- // ).
- // // Override some of the fields with custom
- // // update values.
- // Update(func(u *ent.MsgUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (mc *MsgCreate) OnConflict(opts ...sql.ConflictOption) *MsgUpsertOne {
- mc.conflict = opts
- return &MsgUpsertOne{
- create: mc,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Msg.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (mc *MsgCreate) OnConflictColumns(columns ...string) *MsgUpsertOne {
- mc.conflict = append(mc.conflict, sql.ConflictColumns(columns...))
- return &MsgUpsertOne{
- create: mc,
- }
- }
- type (
- // MsgUpsertOne is the builder for "upsert"-ing
- // one Msg node.
- MsgUpsertOne struct {
- create *MsgCreate
- }
- // MsgUpsert is the "OnConflict" setter.
- MsgUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *MsgUpsert) SetUpdatedAt(v time.Time) *MsgUpsert {
- u.Set(msg.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateUpdatedAt() *MsgUpsert {
- u.SetExcluded(msg.FieldUpdatedAt)
- return u
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *MsgUpsert) SetDeletedAt(v time.Time) *MsgUpsert {
- u.Set(msg.FieldDeletedAt, v)
- return u
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateDeletedAt() *MsgUpsert {
- u.SetExcluded(msg.FieldDeletedAt)
- return u
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *MsgUpsert) ClearDeletedAt() *MsgUpsert {
- u.SetNull(msg.FieldDeletedAt)
- return u
- }
- // SetStatus sets the "status" field.
- func (u *MsgUpsert) SetStatus(v uint8) *MsgUpsert {
- u.Set(msg.FieldStatus, v)
- return u
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateStatus() *MsgUpsert {
- u.SetExcluded(msg.FieldStatus)
- return u
- }
- // AddStatus adds v to the "status" field.
- func (u *MsgUpsert) AddStatus(v uint8) *MsgUpsert {
- u.Add(msg.FieldStatus, v)
- return u
- }
- // ClearStatus clears the value of the "status" field.
- func (u *MsgUpsert) ClearStatus() *MsgUpsert {
- u.SetNull(msg.FieldStatus)
- return u
- }
- // SetFromwxid sets the "fromwxid" field.
- func (u *MsgUpsert) SetFromwxid(v string) *MsgUpsert {
- u.Set(msg.FieldFromwxid, v)
- return u
- }
- // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateFromwxid() *MsgUpsert {
- u.SetExcluded(msg.FieldFromwxid)
- return u
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (u *MsgUpsert) ClearFromwxid() *MsgUpsert {
- u.SetNull(msg.FieldFromwxid)
- return u
- }
- // SetToid sets the "toid" field.
- func (u *MsgUpsert) SetToid(v string) *MsgUpsert {
- u.Set(msg.FieldToid, v)
- return u
- }
- // UpdateToid sets the "toid" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateToid() *MsgUpsert {
- u.SetExcluded(msg.FieldToid)
- return u
- }
- // ClearToid clears the value of the "toid" field.
- func (u *MsgUpsert) ClearToid() *MsgUpsert {
- u.SetNull(msg.FieldToid)
- return u
- }
- // SetMsgtype sets the "msgtype" field.
- func (u *MsgUpsert) SetMsgtype(v int32) *MsgUpsert {
- u.Set(msg.FieldMsgtype, v)
- return u
- }
- // UpdateMsgtype sets the "msgtype" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateMsgtype() *MsgUpsert {
- u.SetExcluded(msg.FieldMsgtype)
- return u
- }
- // AddMsgtype adds v to the "msgtype" field.
- func (u *MsgUpsert) AddMsgtype(v int32) *MsgUpsert {
- u.Add(msg.FieldMsgtype, v)
- return u
- }
- // ClearMsgtype clears the value of the "msgtype" field.
- func (u *MsgUpsert) ClearMsgtype() *MsgUpsert {
- u.SetNull(msg.FieldMsgtype)
- return u
- }
- // SetMsg sets the "msg" field.
- func (u *MsgUpsert) SetMsg(v string) *MsgUpsert {
- u.Set(msg.FieldMsg, v)
- return u
- }
- // UpdateMsg sets the "msg" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateMsg() *MsgUpsert {
- u.SetExcluded(msg.FieldMsg)
- return u
- }
- // ClearMsg clears the value of the "msg" field.
- func (u *MsgUpsert) ClearMsg() *MsgUpsert {
- u.SetNull(msg.FieldMsg)
- return u
- }
- // SetBatchNo sets the "batch_no" field.
- func (u *MsgUpsert) SetBatchNo(v string) *MsgUpsert {
- u.Set(msg.FieldBatchNo, v)
- return u
- }
- // UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateBatchNo() *MsgUpsert {
- u.SetExcluded(msg.FieldBatchNo)
- return u
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (u *MsgUpsert) ClearBatchNo() *MsgUpsert {
- u.SetNull(msg.FieldBatchNo)
- return u
- }
- // SetCtype sets the "ctype" field.
- func (u *MsgUpsert) SetCtype(v uint64) *MsgUpsert {
- u.Set(msg.FieldCtype, v)
- return u
- }
- // UpdateCtype sets the "ctype" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateCtype() *MsgUpsert {
- u.SetExcluded(msg.FieldCtype)
- return u
- }
- // AddCtype adds v to the "ctype" field.
- func (u *MsgUpsert) AddCtype(v uint64) *MsgUpsert {
- u.Add(msg.FieldCtype, v)
- return u
- }
- // SetCc sets the "cc" field.
- func (u *MsgUpsert) SetCc(v string) *MsgUpsert {
- u.Set(msg.FieldCc, v)
- return u
- }
- // UpdateCc sets the "cc" field to the value that was provided on create.
- func (u *MsgUpsert) UpdateCc() *MsgUpsert {
- u.SetExcluded(msg.FieldCc)
- return u
- }
- // SetPhone sets the "phone" field.
- func (u *MsgUpsert) SetPhone(v string) *MsgUpsert {
- u.Set(msg.FieldPhone, v)
- return u
- }
- // UpdatePhone sets the "phone" field to the value that was provided on create.
- func (u *MsgUpsert) UpdatePhone() *MsgUpsert {
- u.SetExcluded(msg.FieldPhone)
- return u
- }
- // UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
- // Using this option is equivalent to using:
- //
- // client.Msg.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(msg.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *MsgUpsertOne) UpdateNewValues() *MsgUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- if _, exists := u.create.mutation.ID(); exists {
- s.SetIgnore(msg.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(msg.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Msg.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *MsgUpsertOne) Ignore() *MsgUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- // DoNothing configures the conflict_action to `DO NOTHING`.
- // Supported only by SQLite and PostgreSQL.
- func (u *MsgUpsertOne) DoNothing() *MsgUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the MsgCreate.OnConflict
- // documentation for more info.
- func (u *MsgUpsertOne) Update(set func(*MsgUpsert)) *MsgUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&MsgUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *MsgUpsertOne) SetUpdatedAt(v time.Time) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateUpdatedAt() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *MsgUpsertOne) SetDeletedAt(v time.Time) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateDeletedAt() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *MsgUpsertOne) ClearDeletedAt() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *MsgUpsertOne) SetStatus(v uint8) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *MsgUpsertOne) AddStatus(v uint8) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateStatus() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *MsgUpsertOne) ClearStatus() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.ClearStatus()
- })
- }
- // SetFromwxid sets the "fromwxid" field.
- func (u *MsgUpsertOne) SetFromwxid(v string) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetFromwxid(v)
- })
- }
- // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateFromwxid() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateFromwxid()
- })
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (u *MsgUpsertOne) ClearFromwxid() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.ClearFromwxid()
- })
- }
- // SetToid sets the "toid" field.
- func (u *MsgUpsertOne) SetToid(v string) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetToid(v)
- })
- }
- // UpdateToid sets the "toid" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateToid() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateToid()
- })
- }
- // ClearToid clears the value of the "toid" field.
- func (u *MsgUpsertOne) ClearToid() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.ClearToid()
- })
- }
- // SetMsgtype sets the "msgtype" field.
- func (u *MsgUpsertOne) SetMsgtype(v int32) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetMsgtype(v)
- })
- }
- // AddMsgtype adds v to the "msgtype" field.
- func (u *MsgUpsertOne) AddMsgtype(v int32) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.AddMsgtype(v)
- })
- }
- // UpdateMsgtype sets the "msgtype" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateMsgtype() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateMsgtype()
- })
- }
- // ClearMsgtype clears the value of the "msgtype" field.
- func (u *MsgUpsertOne) ClearMsgtype() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.ClearMsgtype()
- })
- }
- // SetMsg sets the "msg" field.
- func (u *MsgUpsertOne) SetMsg(v string) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetMsg(v)
- })
- }
- // UpdateMsg sets the "msg" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateMsg() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateMsg()
- })
- }
- // ClearMsg clears the value of the "msg" field.
- func (u *MsgUpsertOne) ClearMsg() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.ClearMsg()
- })
- }
- // SetBatchNo sets the "batch_no" field.
- func (u *MsgUpsertOne) SetBatchNo(v string) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetBatchNo(v)
- })
- }
- // UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateBatchNo() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateBatchNo()
- })
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (u *MsgUpsertOne) ClearBatchNo() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.ClearBatchNo()
- })
- }
- // SetCtype sets the "ctype" field.
- func (u *MsgUpsertOne) SetCtype(v uint64) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetCtype(v)
- })
- }
- // AddCtype adds v to the "ctype" field.
- func (u *MsgUpsertOne) AddCtype(v uint64) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.AddCtype(v)
- })
- }
- // UpdateCtype sets the "ctype" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateCtype() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateCtype()
- })
- }
- // SetCc sets the "cc" field.
- func (u *MsgUpsertOne) SetCc(v string) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetCc(v)
- })
- }
- // UpdateCc sets the "cc" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdateCc() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateCc()
- })
- }
- // SetPhone sets the "phone" field.
- func (u *MsgUpsertOne) SetPhone(v string) *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.SetPhone(v)
- })
- }
- // UpdatePhone sets the "phone" field to the value that was provided on create.
- func (u *MsgUpsertOne) UpdatePhone() *MsgUpsertOne {
- return u.Update(func(s *MsgUpsert) {
- s.UpdatePhone()
- })
- }
- // Exec executes the query.
- func (u *MsgUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for MsgCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *MsgUpsertOne) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // Exec executes the UPSERT query and returns the inserted/updated ID.
- func (u *MsgUpsertOne) ID(ctx context.Context) (id uint64, err error) {
- node, err := u.create.Save(ctx)
- if err != nil {
- return id, err
- }
- return node.ID, nil
- }
- // IDX is like ID, but panics if an error occurs.
- func (u *MsgUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // MsgCreateBulk is the builder for creating many Msg entities in bulk.
- type MsgCreateBulk struct {
- config
- err error
- builders []*MsgCreate
- conflict []sql.ConflictOption
- }
- // Save creates the Msg entities in the database.
- func (mcb *MsgCreateBulk) Save(ctx context.Context) ([]*Msg, error) {
- if mcb.err != nil {
- return nil, mcb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(mcb.builders))
- nodes := make([]*Msg, len(mcb.builders))
- mutators := make([]Mutator, len(mcb.builders))
- for i := range mcb.builders {
- func(i int, root context.Context) {
- builder := mcb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*MsgMutation)
- if !ok {
- return nil, fmt.Errorf("unexpected mutation type %T", m)
- }
- if err := builder.check(); err != nil {
- return nil, err
- }
- builder.mutation = mutation
- var err error
- nodes[i], specs[i] = builder.createSpec()
- if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, mcb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = mcb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, mcb.driver, spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- }
- }
- if err != nil {
- return nil, err
- }
- mutation.id = &nodes[i].ID
- if specs[i].ID.Value != nil && nodes[i].ID == 0 {
- id := specs[i].ID.Value.(int64)
- nodes[i].ID = uint64(id)
- }
- mutation.done = true
- return nodes[i], nil
- })
- for i := len(builder.hooks) - 1; i >= 0; i-- {
- mut = builder.hooks[i](mut)
- }
- mutators[i] = mut
- }(i, ctx)
- }
- if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, mcb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (mcb *MsgCreateBulk) SaveX(ctx context.Context) []*Msg {
- v, err := mcb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (mcb *MsgCreateBulk) Exec(ctx context.Context) error {
- _, err := mcb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (mcb *MsgCreateBulk) ExecX(ctx context.Context) {
- if err := mcb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Msg.CreateBulk(builders...).
- // OnConflict(
- // // Update the row with the new values
- // // the was proposed for insertion.
- // sql.ResolveWithNewValues(),
- // ).
- // // Override some of the fields with custom
- // // update values.
- // Update(func(u *ent.MsgUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (mcb *MsgCreateBulk) OnConflict(opts ...sql.ConflictOption) *MsgUpsertBulk {
- mcb.conflict = opts
- return &MsgUpsertBulk{
- create: mcb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Msg.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (mcb *MsgCreateBulk) OnConflictColumns(columns ...string) *MsgUpsertBulk {
- mcb.conflict = append(mcb.conflict, sql.ConflictColumns(columns...))
- return &MsgUpsertBulk{
- create: mcb,
- }
- }
- // MsgUpsertBulk is the builder for "upsert"-ing
- // a bulk of Msg nodes.
- type MsgUpsertBulk struct {
- create *MsgCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.Msg.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(msg.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *MsgUpsertBulk) UpdateNewValues() *MsgUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
- for _, b := range u.create.builders {
- if _, exists := b.mutation.ID(); exists {
- s.SetIgnore(msg.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(msg.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Msg.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *MsgUpsertBulk) Ignore() *MsgUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
- }
- // DoNothing configures the conflict_action to `DO NOTHING`.
- // Supported only by SQLite and PostgreSQL.
- func (u *MsgUpsertBulk) DoNothing() *MsgUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the MsgCreateBulk.OnConflict
- // documentation for more info.
- func (u *MsgUpsertBulk) Update(set func(*MsgUpsert)) *MsgUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&MsgUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *MsgUpsertBulk) SetUpdatedAt(v time.Time) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateUpdatedAt() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *MsgUpsertBulk) SetDeletedAt(v time.Time) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateDeletedAt() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *MsgUpsertBulk) ClearDeletedAt() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetStatus sets the "status" field.
- func (u *MsgUpsertBulk) SetStatus(v uint8) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *MsgUpsertBulk) AddStatus(v uint8) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateStatus() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *MsgUpsertBulk) ClearStatus() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.ClearStatus()
- })
- }
- // SetFromwxid sets the "fromwxid" field.
- func (u *MsgUpsertBulk) SetFromwxid(v string) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetFromwxid(v)
- })
- }
- // UpdateFromwxid sets the "fromwxid" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateFromwxid() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateFromwxid()
- })
- }
- // ClearFromwxid clears the value of the "fromwxid" field.
- func (u *MsgUpsertBulk) ClearFromwxid() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.ClearFromwxid()
- })
- }
- // SetToid sets the "toid" field.
- func (u *MsgUpsertBulk) SetToid(v string) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetToid(v)
- })
- }
- // UpdateToid sets the "toid" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateToid() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateToid()
- })
- }
- // ClearToid clears the value of the "toid" field.
- func (u *MsgUpsertBulk) ClearToid() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.ClearToid()
- })
- }
- // SetMsgtype sets the "msgtype" field.
- func (u *MsgUpsertBulk) SetMsgtype(v int32) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetMsgtype(v)
- })
- }
- // AddMsgtype adds v to the "msgtype" field.
- func (u *MsgUpsertBulk) AddMsgtype(v int32) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.AddMsgtype(v)
- })
- }
- // UpdateMsgtype sets the "msgtype" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateMsgtype() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateMsgtype()
- })
- }
- // ClearMsgtype clears the value of the "msgtype" field.
- func (u *MsgUpsertBulk) ClearMsgtype() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.ClearMsgtype()
- })
- }
- // SetMsg sets the "msg" field.
- func (u *MsgUpsertBulk) SetMsg(v string) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetMsg(v)
- })
- }
- // UpdateMsg sets the "msg" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateMsg() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateMsg()
- })
- }
- // ClearMsg clears the value of the "msg" field.
- func (u *MsgUpsertBulk) ClearMsg() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.ClearMsg()
- })
- }
- // SetBatchNo sets the "batch_no" field.
- func (u *MsgUpsertBulk) SetBatchNo(v string) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetBatchNo(v)
- })
- }
- // UpdateBatchNo sets the "batch_no" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateBatchNo() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateBatchNo()
- })
- }
- // ClearBatchNo clears the value of the "batch_no" field.
- func (u *MsgUpsertBulk) ClearBatchNo() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.ClearBatchNo()
- })
- }
- // SetCtype sets the "ctype" field.
- func (u *MsgUpsertBulk) SetCtype(v uint64) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetCtype(v)
- })
- }
- // AddCtype adds v to the "ctype" field.
- func (u *MsgUpsertBulk) AddCtype(v uint64) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.AddCtype(v)
- })
- }
- // UpdateCtype sets the "ctype" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateCtype() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateCtype()
- })
- }
- // SetCc sets the "cc" field.
- func (u *MsgUpsertBulk) SetCc(v string) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetCc(v)
- })
- }
- // UpdateCc sets the "cc" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdateCc() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdateCc()
- })
- }
- // SetPhone sets the "phone" field.
- func (u *MsgUpsertBulk) SetPhone(v string) *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.SetPhone(v)
- })
- }
- // UpdatePhone sets the "phone" field to the value that was provided on create.
- func (u *MsgUpsertBulk) UpdatePhone() *MsgUpsertBulk {
- return u.Update(func(s *MsgUpsert) {
- s.UpdatePhone()
- })
- }
- // Exec executes the query.
- func (u *MsgUpsertBulk) Exec(ctx context.Context) error {
- if u.create.err != nil {
- return u.create.err
- }
- for i, b := range u.create.builders {
- if len(b.conflict) != 0 {
- return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the MsgCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for MsgCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *MsgUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|