123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317 |
- // Code generated by ent, DO NOT EDIT.
- package ent
- import (
- "context"
- "errors"
- "fmt"
- "time"
- "wechat-api/ent/agent"
- "wechat-api/ent/token"
- "wechat-api/ent/whatsapp"
- "wechat-api/ent/wx"
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
- )
- // AgentCreate is the builder for creating a Agent entity.
- type AgentCreate struct {
- config
- mutation *AgentMutation
- hooks []Hook
- conflict []sql.ConflictOption
- }
- // SetCreatedAt sets the "created_at" field.
- func (ac *AgentCreate) SetCreatedAt(t time.Time) *AgentCreate {
- ac.mutation.SetCreatedAt(t)
- return ac
- }
- // SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableCreatedAt(t *time.Time) *AgentCreate {
- if t != nil {
- ac.SetCreatedAt(*t)
- }
- return ac
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (ac *AgentCreate) SetUpdatedAt(t time.Time) *AgentCreate {
- ac.mutation.SetUpdatedAt(t)
- return ac
- }
- // SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableUpdatedAt(t *time.Time) *AgentCreate {
- if t != nil {
- ac.SetUpdatedAt(*t)
- }
- return ac
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (ac *AgentCreate) SetDeletedAt(t time.Time) *AgentCreate {
- ac.mutation.SetDeletedAt(t)
- return ac
- }
- // SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableDeletedAt(t *time.Time) *AgentCreate {
- if t != nil {
- ac.SetDeletedAt(*t)
- }
- return ac
- }
- // SetName sets the "name" field.
- func (ac *AgentCreate) SetName(s string) *AgentCreate {
- ac.mutation.SetName(s)
- return ac
- }
- // SetRole sets the "role" field.
- func (ac *AgentCreate) SetRole(s string) *AgentCreate {
- ac.mutation.SetRole(s)
- return ac
- }
- // SetStatus sets the "status" field.
- func (ac *AgentCreate) SetStatus(i int) *AgentCreate {
- ac.mutation.SetStatus(i)
- return ac
- }
- // SetNillableStatus sets the "status" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableStatus(i *int) *AgentCreate {
- if i != nil {
- ac.SetStatus(*i)
- }
- return ac
- }
- // SetBackground sets the "background" field.
- func (ac *AgentCreate) SetBackground(s string) *AgentCreate {
- ac.mutation.SetBackground(s)
- return ac
- }
- // SetNillableBackground sets the "background" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableBackground(s *string) *AgentCreate {
- if s != nil {
- ac.SetBackground(*s)
- }
- return ac
- }
- // SetExamples sets the "examples" field.
- func (ac *AgentCreate) SetExamples(s string) *AgentCreate {
- ac.mutation.SetExamples(s)
- return ac
- }
- // SetNillableExamples sets the "examples" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableExamples(s *string) *AgentCreate {
- if s != nil {
- ac.SetExamples(*s)
- }
- return ac
- }
- // SetOrganizationID sets the "organization_id" field.
- func (ac *AgentCreate) SetOrganizationID(u uint64) *AgentCreate {
- ac.mutation.SetOrganizationID(u)
- return ac
- }
- // SetDatasetID sets the "dataset_id" field.
- func (ac *AgentCreate) SetDatasetID(s string) *AgentCreate {
- ac.mutation.SetDatasetID(s)
- return ac
- }
- // SetNillableDatasetID sets the "dataset_id" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableDatasetID(s *string) *AgentCreate {
- if s != nil {
- ac.SetDatasetID(*s)
- }
- return ac
- }
- // SetCollectionID sets the "collection_id" field.
- func (ac *AgentCreate) SetCollectionID(s string) *AgentCreate {
- ac.mutation.SetCollectionID(s)
- return ac
- }
- // SetNillableCollectionID sets the "collection_id" field if the given value is not nil.
- func (ac *AgentCreate) SetNillableCollectionID(s *string) *AgentCreate {
- if s != nil {
- ac.SetCollectionID(*s)
- }
- return ac
- }
- // SetID sets the "id" field.
- func (ac *AgentCreate) SetID(u uint64) *AgentCreate {
- ac.mutation.SetID(u)
- return ac
- }
- // AddWxAgentIDs adds the "wx_agent" edge to the Wx entity by IDs.
- func (ac *AgentCreate) AddWxAgentIDs(ids ...uint64) *AgentCreate {
- ac.mutation.AddWxAgentIDs(ids...)
- return ac
- }
- // AddWxAgent adds the "wx_agent" edges to the Wx entity.
- func (ac *AgentCreate) AddWxAgent(w ...*Wx) *AgentCreate {
- ids := make([]uint64, len(w))
- for i := range w {
- ids[i] = w[i].ID
- }
- return ac.AddWxAgentIDs(ids...)
- }
- // AddTokenAgentIDs adds the "token_agent" edge to the Token entity by IDs.
- func (ac *AgentCreate) AddTokenAgentIDs(ids ...uint64) *AgentCreate {
- ac.mutation.AddTokenAgentIDs(ids...)
- return ac
- }
- // AddTokenAgent adds the "token_agent" edges to the Token entity.
- func (ac *AgentCreate) AddTokenAgent(t ...*Token) *AgentCreate {
- ids := make([]uint64, len(t))
- for i := range t {
- ids[i] = t[i].ID
- }
- return ac.AddTokenAgentIDs(ids...)
- }
- // AddWaAgentIDs adds the "wa_agent" edge to the Whatsapp entity by IDs.
- func (ac *AgentCreate) AddWaAgentIDs(ids ...uint64) *AgentCreate {
- ac.mutation.AddWaAgentIDs(ids...)
- return ac
- }
- // AddWaAgent adds the "wa_agent" edges to the Whatsapp entity.
- func (ac *AgentCreate) AddWaAgent(w ...*Whatsapp) *AgentCreate {
- ids := make([]uint64, len(w))
- for i := range w {
- ids[i] = w[i].ID
- }
- return ac.AddWaAgentIDs(ids...)
- }
- // Mutation returns the AgentMutation object of the builder.
- func (ac *AgentCreate) Mutation() *AgentMutation {
- return ac.mutation
- }
- // Save creates the Agent in the database.
- func (ac *AgentCreate) Save(ctx context.Context) (*Agent, error) {
- if err := ac.defaults(); err != nil {
- return nil, err
- }
- return withHooks(ctx, ac.sqlSave, ac.mutation, ac.hooks)
- }
- // SaveX calls Save and panics if Save returns an error.
- func (ac *AgentCreate) SaveX(ctx context.Context) *Agent {
- v, err := ac.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (ac *AgentCreate) Exec(ctx context.Context) error {
- _, err := ac.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (ac *AgentCreate) ExecX(ctx context.Context) {
- if err := ac.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // defaults sets the default values of the builder before save.
- func (ac *AgentCreate) defaults() error {
- if _, ok := ac.mutation.CreatedAt(); !ok {
- if agent.DefaultCreatedAt == nil {
- return fmt.Errorf("ent: uninitialized agent.DefaultCreatedAt (forgotten import ent/runtime?)")
- }
- v := agent.DefaultCreatedAt()
- ac.mutation.SetCreatedAt(v)
- }
- if _, ok := ac.mutation.UpdatedAt(); !ok {
- if agent.DefaultUpdatedAt == nil {
- return fmt.Errorf("ent: uninitialized agent.DefaultUpdatedAt (forgotten import ent/runtime?)")
- }
- v := agent.DefaultUpdatedAt()
- ac.mutation.SetUpdatedAt(v)
- }
- if _, ok := ac.mutation.Status(); !ok {
- v := agent.DefaultStatus
- ac.mutation.SetStatus(v)
- }
- if _, ok := ac.mutation.Background(); !ok {
- v := agent.DefaultBackground
- ac.mutation.SetBackground(v)
- }
- if _, ok := ac.mutation.Examples(); !ok {
- v := agent.DefaultExamples
- ac.mutation.SetExamples(v)
- }
- if _, ok := ac.mutation.DatasetID(); !ok {
- v := agent.DefaultDatasetID
- ac.mutation.SetDatasetID(v)
- }
- if _, ok := ac.mutation.CollectionID(); !ok {
- v := agent.DefaultCollectionID
- ac.mutation.SetCollectionID(v)
- }
- return nil
- }
- // check runs all checks and user-defined validators on the builder.
- func (ac *AgentCreate) check() error {
- if _, ok := ac.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Agent.created_at"`)}
- }
- if _, ok := ac.mutation.UpdatedAt(); !ok {
- return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Agent.updated_at"`)}
- }
- if _, ok := ac.mutation.Name(); !ok {
- return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Agent.name"`)}
- }
- if v, ok := ac.mutation.Name(); ok {
- if err := agent.NameValidator(v); err != nil {
- return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Agent.name": %w`, err)}
- }
- }
- if _, ok := ac.mutation.Role(); !ok {
- return &ValidationError{Name: "role", err: errors.New(`ent: missing required field "Agent.role"`)}
- }
- if v, ok := ac.mutation.Status(); ok {
- if err := agent.StatusValidator(v); err != nil {
- return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Agent.status": %w`, err)}
- }
- }
- if _, ok := ac.mutation.OrganizationID(); !ok {
- return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "Agent.organization_id"`)}
- }
- if v, ok := ac.mutation.OrganizationID(); ok {
- if err := agent.OrganizationIDValidator(v); err != nil {
- return &ValidationError{Name: "organization_id", err: fmt.Errorf(`ent: validator failed for field "Agent.organization_id": %w`, err)}
- }
- }
- if _, ok := ac.mutation.DatasetID(); !ok {
- return &ValidationError{Name: "dataset_id", err: errors.New(`ent: missing required field "Agent.dataset_id"`)}
- }
- if v, ok := ac.mutation.DatasetID(); ok {
- if err := agent.DatasetIDValidator(v); err != nil {
- return &ValidationError{Name: "dataset_id", err: fmt.Errorf(`ent: validator failed for field "Agent.dataset_id": %w`, err)}
- }
- }
- if _, ok := ac.mutation.CollectionID(); !ok {
- return &ValidationError{Name: "collection_id", err: errors.New(`ent: missing required field "Agent.collection_id"`)}
- }
- if v, ok := ac.mutation.CollectionID(); ok {
- if err := agent.CollectionIDValidator(v); err != nil {
- return &ValidationError{Name: "collection_id", err: fmt.Errorf(`ent: validator failed for field "Agent.collection_id": %w`, err)}
- }
- }
- return nil
- }
- func (ac *AgentCreate) sqlSave(ctx context.Context) (*Agent, error) {
- if err := ac.check(); err != nil {
- return nil, err
- }
- _node, _spec := ac.createSpec()
- if err := sqlgraph.CreateNode(ctx, ac.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)
- }
- ac.mutation.id = &_node.ID
- ac.mutation.done = true
- return _node, nil
- }
- func (ac *AgentCreate) createSpec() (*Agent, *sqlgraph.CreateSpec) {
- var (
- _node = &Agent{config: ac.config}
- _spec = sqlgraph.NewCreateSpec(agent.Table, sqlgraph.NewFieldSpec(agent.FieldID, field.TypeUint64))
- )
- _spec.OnConflict = ac.conflict
- if id, ok := ac.mutation.ID(); ok {
- _node.ID = id
- _spec.ID.Value = id
- }
- if value, ok := ac.mutation.CreatedAt(); ok {
- _spec.SetField(agent.FieldCreatedAt, field.TypeTime, value)
- _node.CreatedAt = value
- }
- if value, ok := ac.mutation.UpdatedAt(); ok {
- _spec.SetField(agent.FieldUpdatedAt, field.TypeTime, value)
- _node.UpdatedAt = value
- }
- if value, ok := ac.mutation.DeletedAt(); ok {
- _spec.SetField(agent.FieldDeletedAt, field.TypeTime, value)
- _node.DeletedAt = value
- }
- if value, ok := ac.mutation.Name(); ok {
- _spec.SetField(agent.FieldName, field.TypeString, value)
- _node.Name = value
- }
- if value, ok := ac.mutation.Role(); ok {
- _spec.SetField(agent.FieldRole, field.TypeString, value)
- _node.Role = value
- }
- if value, ok := ac.mutation.Status(); ok {
- _spec.SetField(agent.FieldStatus, field.TypeInt, value)
- _node.Status = value
- }
- if value, ok := ac.mutation.Background(); ok {
- _spec.SetField(agent.FieldBackground, field.TypeString, value)
- _node.Background = value
- }
- if value, ok := ac.mutation.Examples(); ok {
- _spec.SetField(agent.FieldExamples, field.TypeString, value)
- _node.Examples = value
- }
- if value, ok := ac.mutation.OrganizationID(); ok {
- _spec.SetField(agent.FieldOrganizationID, field.TypeUint64, value)
- _node.OrganizationID = value
- }
- if value, ok := ac.mutation.DatasetID(); ok {
- _spec.SetField(agent.FieldDatasetID, field.TypeString, value)
- _node.DatasetID = value
- }
- if value, ok := ac.mutation.CollectionID(); ok {
- _spec.SetField(agent.FieldCollectionID, field.TypeString, value)
- _node.CollectionID = value
- }
- if nodes := ac.mutation.WxAgentIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: agent.WxAgentTable,
- Columns: []string{agent.WxAgentColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(wx.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := ac.mutation.TokenAgentIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: agent.TokenAgentTable,
- Columns: []string{agent.TokenAgentColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(token.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- if nodes := ac.mutation.WaAgentIDs(); len(nodes) > 0 {
- edge := &sqlgraph.EdgeSpec{
- Rel: sqlgraph.O2M,
- Inverse: false,
- Table: agent.WaAgentTable,
- Columns: []string{agent.WaAgentColumn},
- Bidi: false,
- Target: &sqlgraph.EdgeTarget{
- IDSpec: sqlgraph.NewFieldSpec(whatsapp.FieldID, field.TypeUint64),
- },
- }
- for _, k := range nodes {
- edge.Target.Nodes = append(edge.Target.Nodes, k)
- }
- _spec.Edges = append(_spec.Edges, edge)
- }
- return _node, _spec
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Agent.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.AgentUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (ac *AgentCreate) OnConflict(opts ...sql.ConflictOption) *AgentUpsertOne {
- ac.conflict = opts
- return &AgentUpsertOne{
- create: ac,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Agent.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (ac *AgentCreate) OnConflictColumns(columns ...string) *AgentUpsertOne {
- ac.conflict = append(ac.conflict, sql.ConflictColumns(columns...))
- return &AgentUpsertOne{
- create: ac,
- }
- }
- type (
- // AgentUpsertOne is the builder for "upsert"-ing
- // one Agent node.
- AgentUpsertOne struct {
- create *AgentCreate
- }
- // AgentUpsert is the "OnConflict" setter.
- AgentUpsert struct {
- *sql.UpdateSet
- }
- )
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AgentUpsert) SetUpdatedAt(v time.Time) *AgentUpsert {
- u.Set(agent.FieldUpdatedAt, v)
- return u
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateUpdatedAt() *AgentUpsert {
- u.SetExcluded(agent.FieldUpdatedAt)
- return u
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *AgentUpsert) SetDeletedAt(v time.Time) *AgentUpsert {
- u.Set(agent.FieldDeletedAt, v)
- return u
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateDeletedAt() *AgentUpsert {
- u.SetExcluded(agent.FieldDeletedAt)
- return u
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *AgentUpsert) ClearDeletedAt() *AgentUpsert {
- u.SetNull(agent.FieldDeletedAt)
- return u
- }
- // SetName sets the "name" field.
- func (u *AgentUpsert) SetName(v string) *AgentUpsert {
- u.Set(agent.FieldName, v)
- return u
- }
- // UpdateName sets the "name" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateName() *AgentUpsert {
- u.SetExcluded(agent.FieldName)
- return u
- }
- // SetRole sets the "role" field.
- func (u *AgentUpsert) SetRole(v string) *AgentUpsert {
- u.Set(agent.FieldRole, v)
- return u
- }
- // UpdateRole sets the "role" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateRole() *AgentUpsert {
- u.SetExcluded(agent.FieldRole)
- return u
- }
- // SetStatus sets the "status" field.
- func (u *AgentUpsert) SetStatus(v int) *AgentUpsert {
- u.Set(agent.FieldStatus, v)
- return u
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateStatus() *AgentUpsert {
- u.SetExcluded(agent.FieldStatus)
- return u
- }
- // AddStatus adds v to the "status" field.
- func (u *AgentUpsert) AddStatus(v int) *AgentUpsert {
- u.Add(agent.FieldStatus, v)
- return u
- }
- // ClearStatus clears the value of the "status" field.
- func (u *AgentUpsert) ClearStatus() *AgentUpsert {
- u.SetNull(agent.FieldStatus)
- return u
- }
- // SetBackground sets the "background" field.
- func (u *AgentUpsert) SetBackground(v string) *AgentUpsert {
- u.Set(agent.FieldBackground, v)
- return u
- }
- // UpdateBackground sets the "background" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateBackground() *AgentUpsert {
- u.SetExcluded(agent.FieldBackground)
- return u
- }
- // ClearBackground clears the value of the "background" field.
- func (u *AgentUpsert) ClearBackground() *AgentUpsert {
- u.SetNull(agent.FieldBackground)
- return u
- }
- // SetExamples sets the "examples" field.
- func (u *AgentUpsert) SetExamples(v string) *AgentUpsert {
- u.Set(agent.FieldExamples, v)
- return u
- }
- // UpdateExamples sets the "examples" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateExamples() *AgentUpsert {
- u.SetExcluded(agent.FieldExamples)
- return u
- }
- // ClearExamples clears the value of the "examples" field.
- func (u *AgentUpsert) ClearExamples() *AgentUpsert {
- u.SetNull(agent.FieldExamples)
- return u
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *AgentUpsert) SetOrganizationID(v uint64) *AgentUpsert {
- u.Set(agent.FieldOrganizationID, v)
- return u
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateOrganizationID() *AgentUpsert {
- u.SetExcluded(agent.FieldOrganizationID)
- return u
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *AgentUpsert) AddOrganizationID(v uint64) *AgentUpsert {
- u.Add(agent.FieldOrganizationID, v)
- return u
- }
- // SetDatasetID sets the "dataset_id" field.
- func (u *AgentUpsert) SetDatasetID(v string) *AgentUpsert {
- u.Set(agent.FieldDatasetID, v)
- return u
- }
- // UpdateDatasetID sets the "dataset_id" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateDatasetID() *AgentUpsert {
- u.SetExcluded(agent.FieldDatasetID)
- return u
- }
- // SetCollectionID sets the "collection_id" field.
- func (u *AgentUpsert) SetCollectionID(v string) *AgentUpsert {
- u.Set(agent.FieldCollectionID, v)
- return u
- }
- // UpdateCollectionID sets the "collection_id" field to the value that was provided on create.
- func (u *AgentUpsert) UpdateCollectionID() *AgentUpsert {
- u.SetExcluded(agent.FieldCollectionID)
- 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.Agent.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(agent.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *AgentUpsertOne) UpdateNewValues() *AgentUpsertOne {
- 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(agent.FieldID)
- }
- if _, exists := u.create.mutation.CreatedAt(); exists {
- s.SetIgnore(agent.FieldCreatedAt)
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Agent.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *AgentUpsertOne) Ignore() *AgentUpsertOne {
- 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 *AgentUpsertOne) DoNothing() *AgentUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the AgentCreate.OnConflict
- // documentation for more info.
- func (u *AgentUpsertOne) Update(set func(*AgentUpsert)) *AgentUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&AgentUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AgentUpsertOne) SetUpdatedAt(v time.Time) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateUpdatedAt() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *AgentUpsertOne) SetDeletedAt(v time.Time) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateDeletedAt() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *AgentUpsertOne) ClearDeletedAt() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetName sets the "name" field.
- func (u *AgentUpsertOne) SetName(v string) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetName(v)
- })
- }
- // UpdateName sets the "name" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateName() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateName()
- })
- }
- // SetRole sets the "role" field.
- func (u *AgentUpsertOne) SetRole(v string) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetRole(v)
- })
- }
- // UpdateRole sets the "role" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateRole() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateRole()
- })
- }
- // SetStatus sets the "status" field.
- func (u *AgentUpsertOne) SetStatus(v int) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *AgentUpsertOne) AddStatus(v int) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateStatus() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *AgentUpsertOne) ClearStatus() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.ClearStatus()
- })
- }
- // SetBackground sets the "background" field.
- func (u *AgentUpsertOne) SetBackground(v string) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetBackground(v)
- })
- }
- // UpdateBackground sets the "background" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateBackground() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateBackground()
- })
- }
- // ClearBackground clears the value of the "background" field.
- func (u *AgentUpsertOne) ClearBackground() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.ClearBackground()
- })
- }
- // SetExamples sets the "examples" field.
- func (u *AgentUpsertOne) SetExamples(v string) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetExamples(v)
- })
- }
- // UpdateExamples sets the "examples" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateExamples() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateExamples()
- })
- }
- // ClearExamples clears the value of the "examples" field.
- func (u *AgentUpsertOne) ClearExamples() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.ClearExamples()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *AgentUpsertOne) SetOrganizationID(v uint64) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *AgentUpsertOne) AddOrganizationID(v uint64) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateOrganizationID() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // SetDatasetID sets the "dataset_id" field.
- func (u *AgentUpsertOne) SetDatasetID(v string) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetDatasetID(v)
- })
- }
- // UpdateDatasetID sets the "dataset_id" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateDatasetID() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateDatasetID()
- })
- }
- // SetCollectionID sets the "collection_id" field.
- func (u *AgentUpsertOne) SetCollectionID(v string) *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.SetCollectionID(v)
- })
- }
- // UpdateCollectionID sets the "collection_id" field to the value that was provided on create.
- func (u *AgentUpsertOne) UpdateCollectionID() *AgentUpsertOne {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateCollectionID()
- })
- }
- // Exec executes the query.
- func (u *AgentUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for AgentCreate.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *AgentUpsertOne) 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 *AgentUpsertOne) 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 *AgentUpsertOne) IDX(ctx context.Context) uint64 {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
- }
- // AgentCreateBulk is the builder for creating many Agent entities in bulk.
- type AgentCreateBulk struct {
- config
- err error
- builders []*AgentCreate
- conflict []sql.ConflictOption
- }
- // Save creates the Agent entities in the database.
- func (acb *AgentCreateBulk) Save(ctx context.Context) ([]*Agent, error) {
- if acb.err != nil {
- return nil, acb.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(acb.builders))
- nodes := make([]*Agent, len(acb.builders))
- mutators := make([]Mutator, len(acb.builders))
- for i := range acb.builders {
- func(i int, root context.Context) {
- builder := acb.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*AgentMutation)
- 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, acb.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = acb.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, acb.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, acb.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
- }
- // SaveX is like Save, but panics if an error occurs.
- func (acb *AgentCreateBulk) SaveX(ctx context.Context) []*Agent {
- v, err := acb.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
- }
- // Exec executes the query.
- func (acb *AgentCreateBulk) Exec(ctx context.Context) error {
- _, err := acb.Save(ctx)
- return err
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (acb *AgentCreateBulk) ExecX(ctx context.Context) {
- if err := acb.Exec(ctx); err != nil {
- panic(err)
- }
- }
- // OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
- // of the `INSERT` statement. For example:
- //
- // client.Agent.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.AgentUpsert) {
- // SetCreatedAt(v+v).
- // }).
- // Exec(ctx)
- func (acb *AgentCreateBulk) OnConflict(opts ...sql.ConflictOption) *AgentUpsertBulk {
- acb.conflict = opts
- return &AgentUpsertBulk{
- create: acb,
- }
- }
- // OnConflictColumns calls `OnConflict` and configures the columns
- // as conflict target. Using this option is equivalent to using:
- //
- // client.Agent.Create().
- // OnConflict(sql.ConflictColumns(columns...)).
- // Exec(ctx)
- func (acb *AgentCreateBulk) OnConflictColumns(columns ...string) *AgentUpsertBulk {
- acb.conflict = append(acb.conflict, sql.ConflictColumns(columns...))
- return &AgentUpsertBulk{
- create: acb,
- }
- }
- // AgentUpsertBulk is the builder for "upsert"-ing
- // a bulk of Agent nodes.
- type AgentUpsertBulk struct {
- create *AgentCreateBulk
- }
- // UpdateNewValues updates the mutable fields using the new values that
- // were set on create. Using this option is equivalent to using:
- //
- // client.Agent.Create().
- // OnConflict(
- // sql.ResolveWithNewValues(),
- // sql.ResolveWith(func(u *sql.UpdateSet) {
- // u.SetIgnore(agent.FieldID)
- // }),
- // ).
- // Exec(ctx)
- func (u *AgentUpsertBulk) UpdateNewValues() *AgentUpsertBulk {
- 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(agent.FieldID)
- }
- if _, exists := b.mutation.CreatedAt(); exists {
- s.SetIgnore(agent.FieldCreatedAt)
- }
- }
- }))
- return u
- }
- // Ignore sets each column to itself in case of conflict.
- // Using this option is equivalent to using:
- //
- // client.Agent.Create().
- // OnConflict(sql.ResolveWithIgnore()).
- // Exec(ctx)
- func (u *AgentUpsertBulk) Ignore() *AgentUpsertBulk {
- 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 *AgentUpsertBulk) DoNothing() *AgentUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
- }
- // Update allows overriding fields `UPDATE` values. See the AgentCreateBulk.OnConflict
- // documentation for more info.
- func (u *AgentUpsertBulk) Update(set func(*AgentUpsert)) *AgentUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&AgentUpsert{UpdateSet: update})
- }))
- return u
- }
- // SetUpdatedAt sets the "updated_at" field.
- func (u *AgentUpsertBulk) SetUpdatedAt(v time.Time) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetUpdatedAt(v)
- })
- }
- // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateUpdatedAt() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateUpdatedAt()
- })
- }
- // SetDeletedAt sets the "deleted_at" field.
- func (u *AgentUpsertBulk) SetDeletedAt(v time.Time) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetDeletedAt(v)
- })
- }
- // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateDeletedAt() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateDeletedAt()
- })
- }
- // ClearDeletedAt clears the value of the "deleted_at" field.
- func (u *AgentUpsertBulk) ClearDeletedAt() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.ClearDeletedAt()
- })
- }
- // SetName sets the "name" field.
- func (u *AgentUpsertBulk) SetName(v string) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetName(v)
- })
- }
- // UpdateName sets the "name" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateName() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateName()
- })
- }
- // SetRole sets the "role" field.
- func (u *AgentUpsertBulk) SetRole(v string) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetRole(v)
- })
- }
- // UpdateRole sets the "role" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateRole() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateRole()
- })
- }
- // SetStatus sets the "status" field.
- func (u *AgentUpsertBulk) SetStatus(v int) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetStatus(v)
- })
- }
- // AddStatus adds v to the "status" field.
- func (u *AgentUpsertBulk) AddStatus(v int) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.AddStatus(v)
- })
- }
- // UpdateStatus sets the "status" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateStatus() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateStatus()
- })
- }
- // ClearStatus clears the value of the "status" field.
- func (u *AgentUpsertBulk) ClearStatus() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.ClearStatus()
- })
- }
- // SetBackground sets the "background" field.
- func (u *AgentUpsertBulk) SetBackground(v string) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetBackground(v)
- })
- }
- // UpdateBackground sets the "background" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateBackground() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateBackground()
- })
- }
- // ClearBackground clears the value of the "background" field.
- func (u *AgentUpsertBulk) ClearBackground() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.ClearBackground()
- })
- }
- // SetExamples sets the "examples" field.
- func (u *AgentUpsertBulk) SetExamples(v string) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetExamples(v)
- })
- }
- // UpdateExamples sets the "examples" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateExamples() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateExamples()
- })
- }
- // ClearExamples clears the value of the "examples" field.
- func (u *AgentUpsertBulk) ClearExamples() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.ClearExamples()
- })
- }
- // SetOrganizationID sets the "organization_id" field.
- func (u *AgentUpsertBulk) SetOrganizationID(v uint64) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetOrganizationID(v)
- })
- }
- // AddOrganizationID adds v to the "organization_id" field.
- func (u *AgentUpsertBulk) AddOrganizationID(v uint64) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.AddOrganizationID(v)
- })
- }
- // UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateOrganizationID() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateOrganizationID()
- })
- }
- // SetDatasetID sets the "dataset_id" field.
- func (u *AgentUpsertBulk) SetDatasetID(v string) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetDatasetID(v)
- })
- }
- // UpdateDatasetID sets the "dataset_id" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateDatasetID() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateDatasetID()
- })
- }
- // SetCollectionID sets the "collection_id" field.
- func (u *AgentUpsertBulk) SetCollectionID(v string) *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.SetCollectionID(v)
- })
- }
- // UpdateCollectionID sets the "collection_id" field to the value that was provided on create.
- func (u *AgentUpsertBulk) UpdateCollectionID() *AgentUpsertBulk {
- return u.Update(func(s *AgentUpsert) {
- s.UpdateCollectionID()
- })
- }
- // Exec executes the query.
- func (u *AgentUpsertBulk) 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 AgentCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for AgentCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
- }
- // ExecX is like Exec, but panics if an error occurs.
- func (u *AgentUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
- }
|