mirror of
https://github.com/chaitin/MonkeyCode.git
synced 2026-11-24 21:29:00 +08:00
1591 lines
50 KiB
Go
1591 lines
50 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package db
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect"
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/schema/field"
|
|
"github.com/chaitin/MonkeyCode/backend/db/mcptool"
|
|
"github.com/chaitin/MonkeyCode/backend/db/mcptoolcall"
|
|
"github.com/chaitin/MonkeyCode/backend/db/mcpupstream"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// MCPToolCallCreate is the builder for creating a MCPToolCall entity.
|
|
type MCPToolCallCreate struct {
|
|
config
|
|
mutation *MCPToolCallMutation
|
|
hooks []Hook
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// SetRequestID sets the "request_id" field.
|
|
func (_c *MCPToolCallCreate) SetRequestID(v string) *MCPToolCallCreate {
|
|
_c.mutation.SetRequestID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (_c *MCPToolCallCreate) SetTaskID(v uuid.UUID) *MCPToolCallCreate {
|
|
_c.mutation.SetTaskID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (_c *MCPToolCallCreate) SetUserID(v uuid.UUID) *MCPToolCallCreate {
|
|
_c.mutation.SetUserID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetUpstreamID sets the "upstream_id" field.
|
|
func (_c *MCPToolCallCreate) SetUpstreamID(v uuid.UUID) *MCPToolCallCreate {
|
|
_c.mutation.SetUpstreamID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetToolID sets the "tool_id" field.
|
|
func (_c *MCPToolCallCreate) SetToolID(v uuid.UUID) *MCPToolCallCreate {
|
|
_c.mutation.SetToolID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetToolNameSnapshot sets the "tool_name_snapshot" field.
|
|
func (_c *MCPToolCallCreate) SetToolNameSnapshot(v string) *MCPToolCallCreate {
|
|
_c.mutation.SetToolNameSnapshot(v)
|
|
return _c
|
|
}
|
|
|
|
// SetToolScopeSnapshot sets the "tool_scope_snapshot" field.
|
|
func (_c *MCPToolCallCreate) SetToolScopeSnapshot(v mcptoolcall.ToolScopeSnapshot) *MCPToolCallCreate {
|
|
_c.mutation.SetToolScopeSnapshot(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableToolScopeSnapshot sets the "tool_scope_snapshot" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillableToolScopeSnapshot(v *mcptoolcall.ToolScopeSnapshot) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetToolScopeSnapshot(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetPriceSnapshot sets the "price_snapshot" field.
|
|
func (_c *MCPToolCallCreate) SetPriceSnapshot(v int64) *MCPToolCallCreate {
|
|
_c.mutation.SetPriceSnapshot(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillablePriceSnapshot sets the "price_snapshot" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillablePriceSnapshot(v *int64) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetPriceSnapshot(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (_c *MCPToolCallCreate) SetStatus(v mcptoolcall.Status) *MCPToolCallCreate {
|
|
_c.mutation.SetStatus(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableStatus sets the "status" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillableStatus(v *mcptoolcall.Status) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetStatus(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetArgsJSON sets the "args_json" field.
|
|
func (_c *MCPToolCallCreate) SetArgsJSON(v map[string]interface{}) *MCPToolCallCreate {
|
|
_c.mutation.SetArgsJSON(v)
|
|
return _c
|
|
}
|
|
|
|
// SetResultJSON sets the "result_json" field.
|
|
func (_c *MCPToolCallCreate) SetResultJSON(v map[string]interface{}) *MCPToolCallCreate {
|
|
_c.mutation.SetResultJSON(v)
|
|
return _c
|
|
}
|
|
|
|
// SetErrorMessage sets the "error_message" field.
|
|
func (_c *MCPToolCallCreate) SetErrorMessage(v string) *MCPToolCallCreate {
|
|
_c.mutation.SetErrorMessage(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableErrorMessage sets the "error_message" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillableErrorMessage(v *string) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetErrorMessage(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetUpstreamRequestID sets the "upstream_request_id" field.
|
|
func (_c *MCPToolCallCreate) SetUpstreamRequestID(v string) *MCPToolCallCreate {
|
|
_c.mutation.SetUpstreamRequestID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableUpstreamRequestID sets the "upstream_request_id" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillableUpstreamRequestID(v *string) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetUpstreamRequestID(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetStartedAt sets the "started_at" field.
|
|
func (_c *MCPToolCallCreate) SetStartedAt(v time.Time) *MCPToolCallCreate {
|
|
_c.mutation.SetStartedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetFinishedAt sets the "finished_at" field.
|
|
func (_c *MCPToolCallCreate) SetFinishedAt(v time.Time) *MCPToolCallCreate {
|
|
_c.mutation.SetFinishedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableFinishedAt sets the "finished_at" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillableFinishedAt(v *time.Time) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetFinishedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (_c *MCPToolCallCreate) SetCreatedAt(v time.Time) *MCPToolCallCreate {
|
|
_c.mutation.SetCreatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillableCreatedAt(v *time.Time) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetCreatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (_c *MCPToolCallCreate) SetUpdatedAt(v time.Time) *MCPToolCallCreate {
|
|
_c.mutation.SetUpdatedAt(v)
|
|
return _c
|
|
}
|
|
|
|
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
|
|
func (_c *MCPToolCallCreate) SetNillableUpdatedAt(v *time.Time) *MCPToolCallCreate {
|
|
if v != nil {
|
|
_c.SetUpdatedAt(*v)
|
|
}
|
|
return _c
|
|
}
|
|
|
|
// SetID sets the "id" field.
|
|
func (_c *MCPToolCallCreate) SetID(v uuid.UUID) *MCPToolCallCreate {
|
|
_c.mutation.SetID(v)
|
|
return _c
|
|
}
|
|
|
|
// SetUpstream sets the "upstream" edge to the MCPUpstream entity.
|
|
func (_c *MCPToolCallCreate) SetUpstream(v *MCPUpstream) *MCPToolCallCreate {
|
|
return _c.SetUpstreamID(v.ID)
|
|
}
|
|
|
|
// SetTool sets the "tool" edge to the MCPTool entity.
|
|
func (_c *MCPToolCallCreate) SetTool(v *MCPTool) *MCPToolCallCreate {
|
|
return _c.SetToolID(v.ID)
|
|
}
|
|
|
|
// Mutation returns the MCPToolCallMutation object of the builder.
|
|
func (_c *MCPToolCallCreate) Mutation() *MCPToolCallMutation {
|
|
return _c.mutation
|
|
}
|
|
|
|
// Save creates the MCPToolCall in the database.
|
|
func (_c *MCPToolCallCreate) Save(ctx context.Context) (*MCPToolCall, error) {
|
|
_c.defaults()
|
|
return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
|
|
}
|
|
|
|
// SaveX calls Save and panics if Save returns an error.
|
|
func (_c *MCPToolCallCreate) SaveX(ctx context.Context) *MCPToolCall {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *MCPToolCallCreate) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *MCPToolCallCreate) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// defaults sets the default values of the builder before save.
|
|
func (_c *MCPToolCallCreate) defaults() {
|
|
if _, ok := _c.mutation.ToolScopeSnapshot(); !ok {
|
|
v := mcptoolcall.DefaultToolScopeSnapshot
|
|
_c.mutation.SetToolScopeSnapshot(v)
|
|
}
|
|
if _, ok := _c.mutation.PriceSnapshot(); !ok {
|
|
v := mcptoolcall.DefaultPriceSnapshot
|
|
_c.mutation.SetPriceSnapshot(v)
|
|
}
|
|
if _, ok := _c.mutation.Status(); !ok {
|
|
v := mcptoolcall.DefaultStatus
|
|
_c.mutation.SetStatus(v)
|
|
}
|
|
if _, ok := _c.mutation.ErrorMessage(); !ok {
|
|
v := mcptoolcall.DefaultErrorMessage
|
|
_c.mutation.SetErrorMessage(v)
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
v := mcptoolcall.DefaultCreatedAt()
|
|
_c.mutation.SetCreatedAt(v)
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
v := mcptoolcall.DefaultUpdatedAt()
|
|
_c.mutation.SetUpdatedAt(v)
|
|
}
|
|
}
|
|
|
|
// check runs all checks and user-defined validators on the builder.
|
|
func (_c *MCPToolCallCreate) check() error {
|
|
if _, ok := _c.mutation.RequestID(); !ok {
|
|
return &ValidationError{Name: "request_id", err: errors.New(`db: missing required field "MCPToolCall.request_id"`)}
|
|
}
|
|
if v, ok := _c.mutation.RequestID(); ok {
|
|
if err := mcptoolcall.RequestIDValidator(v); err != nil {
|
|
return &ValidationError{Name: "request_id", err: fmt.Errorf(`db: validator failed for field "MCPToolCall.request_id": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.TaskID(); !ok {
|
|
return &ValidationError{Name: "task_id", err: errors.New(`db: missing required field "MCPToolCall.task_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.UserID(); !ok {
|
|
return &ValidationError{Name: "user_id", err: errors.New(`db: missing required field "MCPToolCall.user_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.UpstreamID(); !ok {
|
|
return &ValidationError{Name: "upstream_id", err: errors.New(`db: missing required field "MCPToolCall.upstream_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.ToolID(); !ok {
|
|
return &ValidationError{Name: "tool_id", err: errors.New(`db: missing required field "MCPToolCall.tool_id"`)}
|
|
}
|
|
if _, ok := _c.mutation.ToolNameSnapshot(); !ok {
|
|
return &ValidationError{Name: "tool_name_snapshot", err: errors.New(`db: missing required field "MCPToolCall.tool_name_snapshot"`)}
|
|
}
|
|
if v, ok := _c.mutation.ToolNameSnapshot(); ok {
|
|
if err := mcptoolcall.ToolNameSnapshotValidator(v); err != nil {
|
|
return &ValidationError{Name: "tool_name_snapshot", err: fmt.Errorf(`db: validator failed for field "MCPToolCall.tool_name_snapshot": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.ToolScopeSnapshot(); !ok {
|
|
return &ValidationError{Name: "tool_scope_snapshot", err: errors.New(`db: missing required field "MCPToolCall.tool_scope_snapshot"`)}
|
|
}
|
|
if v, ok := _c.mutation.ToolScopeSnapshot(); ok {
|
|
if err := mcptoolcall.ToolScopeSnapshotValidator(v); err != nil {
|
|
return &ValidationError{Name: "tool_scope_snapshot", err: fmt.Errorf(`db: validator failed for field "MCPToolCall.tool_scope_snapshot": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.PriceSnapshot(); !ok {
|
|
return &ValidationError{Name: "price_snapshot", err: errors.New(`db: missing required field "MCPToolCall.price_snapshot"`)}
|
|
}
|
|
if _, ok := _c.mutation.Status(); !ok {
|
|
return &ValidationError{Name: "status", err: errors.New(`db: missing required field "MCPToolCall.status"`)}
|
|
}
|
|
if v, ok := _c.mutation.Status(); ok {
|
|
if err := mcptoolcall.StatusValidator(v); err != nil {
|
|
return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "MCPToolCall.status": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.ErrorMessage(); !ok {
|
|
return &ValidationError{Name: "error_message", err: errors.New(`db: missing required field "MCPToolCall.error_message"`)}
|
|
}
|
|
if v, ok := _c.mutation.UpstreamRequestID(); ok {
|
|
if err := mcptoolcall.UpstreamRequestIDValidator(v); err != nil {
|
|
return &ValidationError{Name: "upstream_request_id", err: fmt.Errorf(`db: validator failed for field "MCPToolCall.upstream_request_id": %w`, err)}
|
|
}
|
|
}
|
|
if _, ok := _c.mutation.StartedAt(); !ok {
|
|
return &ValidationError{Name: "started_at", err: errors.New(`db: missing required field "MCPToolCall.started_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.CreatedAt(); !ok {
|
|
return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "MCPToolCall.created_at"`)}
|
|
}
|
|
if _, ok := _c.mutation.UpdatedAt(); !ok {
|
|
return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "MCPToolCall.updated_at"`)}
|
|
}
|
|
if len(_c.mutation.UpstreamIDs()) == 0 {
|
|
return &ValidationError{Name: "upstream", err: errors.New(`db: missing required edge "MCPToolCall.upstream"`)}
|
|
}
|
|
if len(_c.mutation.ToolIDs()) == 0 {
|
|
return &ValidationError{Name: "tool", err: errors.New(`db: missing required edge "MCPToolCall.tool"`)}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (_c *MCPToolCallCreate) sqlSave(ctx context.Context) (*MCPToolCall, error) {
|
|
if err := _c.check(); err != nil {
|
|
return nil, err
|
|
}
|
|
_node, _spec := _c.createSpec()
|
|
if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
|
|
if sqlgraph.IsConstraintError(err) {
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
|
}
|
|
return nil, err
|
|
}
|
|
if _spec.ID.Value != nil {
|
|
if id, ok := _spec.ID.Value.(*uuid.UUID); ok {
|
|
_node.ID = *id
|
|
} else if err := _node.ID.Scan(_spec.ID.Value); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
_c.mutation.id = &_node.ID
|
|
_c.mutation.done = true
|
|
return _node, nil
|
|
}
|
|
|
|
func (_c *MCPToolCallCreate) createSpec() (*MCPToolCall, *sqlgraph.CreateSpec) {
|
|
var (
|
|
_node = &MCPToolCall{config: _c.config}
|
|
_spec = sqlgraph.NewCreateSpec(mcptoolcall.Table, sqlgraph.NewFieldSpec(mcptoolcall.FieldID, field.TypeUUID))
|
|
)
|
|
_spec.OnConflict = _c.conflict
|
|
if id, ok := _c.mutation.ID(); ok {
|
|
_node.ID = id
|
|
_spec.ID.Value = &id
|
|
}
|
|
if value, ok := _c.mutation.RequestID(); ok {
|
|
_spec.SetField(mcptoolcall.FieldRequestID, field.TypeString, value)
|
|
_node.RequestID = value
|
|
}
|
|
if value, ok := _c.mutation.TaskID(); ok {
|
|
_spec.SetField(mcptoolcall.FieldTaskID, field.TypeUUID, value)
|
|
_node.TaskID = value
|
|
}
|
|
if value, ok := _c.mutation.UserID(); ok {
|
|
_spec.SetField(mcptoolcall.FieldUserID, field.TypeUUID, value)
|
|
_node.UserID = value
|
|
}
|
|
if value, ok := _c.mutation.ToolNameSnapshot(); ok {
|
|
_spec.SetField(mcptoolcall.FieldToolNameSnapshot, field.TypeString, value)
|
|
_node.ToolNameSnapshot = value
|
|
}
|
|
if value, ok := _c.mutation.ToolScopeSnapshot(); ok {
|
|
_spec.SetField(mcptoolcall.FieldToolScopeSnapshot, field.TypeEnum, value)
|
|
_node.ToolScopeSnapshot = value
|
|
}
|
|
if value, ok := _c.mutation.PriceSnapshot(); ok {
|
|
_spec.SetField(mcptoolcall.FieldPriceSnapshot, field.TypeInt64, value)
|
|
_node.PriceSnapshot = value
|
|
}
|
|
if value, ok := _c.mutation.Status(); ok {
|
|
_spec.SetField(mcptoolcall.FieldStatus, field.TypeEnum, value)
|
|
_node.Status = value
|
|
}
|
|
if value, ok := _c.mutation.ArgsJSON(); ok {
|
|
_spec.SetField(mcptoolcall.FieldArgsJSON, field.TypeJSON, value)
|
|
_node.ArgsJSON = value
|
|
}
|
|
if value, ok := _c.mutation.ResultJSON(); ok {
|
|
_spec.SetField(mcptoolcall.FieldResultJSON, field.TypeJSON, value)
|
|
_node.ResultJSON = value
|
|
}
|
|
if value, ok := _c.mutation.ErrorMessage(); ok {
|
|
_spec.SetField(mcptoolcall.FieldErrorMessage, field.TypeString, value)
|
|
_node.ErrorMessage = value
|
|
}
|
|
if value, ok := _c.mutation.UpstreamRequestID(); ok {
|
|
_spec.SetField(mcptoolcall.FieldUpstreamRequestID, field.TypeString, value)
|
|
_node.UpstreamRequestID = value
|
|
}
|
|
if value, ok := _c.mutation.StartedAt(); ok {
|
|
_spec.SetField(mcptoolcall.FieldStartedAt, field.TypeTime, value)
|
|
_node.StartedAt = value
|
|
}
|
|
if value, ok := _c.mutation.FinishedAt(); ok {
|
|
_spec.SetField(mcptoolcall.FieldFinishedAt, field.TypeTime, value)
|
|
_node.FinishedAt = &value
|
|
}
|
|
if value, ok := _c.mutation.CreatedAt(); ok {
|
|
_spec.SetField(mcptoolcall.FieldCreatedAt, field.TypeTime, value)
|
|
_node.CreatedAt = value
|
|
}
|
|
if value, ok := _c.mutation.UpdatedAt(); ok {
|
|
_spec.SetField(mcptoolcall.FieldUpdatedAt, field.TypeTime, value)
|
|
_node.UpdatedAt = value
|
|
}
|
|
if nodes := _c.mutation.UpstreamIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: mcptoolcall.UpstreamTable,
|
|
Columns: []string{mcptoolcall.UpstreamColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(mcpupstream.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_node.UpstreamID = nodes[0]
|
|
_spec.Edges = append(_spec.Edges, edge)
|
|
}
|
|
if nodes := _c.mutation.ToolIDs(); len(nodes) > 0 {
|
|
edge := &sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: false,
|
|
Table: mcptoolcall.ToolTable,
|
|
Columns: []string{mcptoolcall.ToolColumn},
|
|
Bidi: false,
|
|
Target: &sqlgraph.EdgeTarget{
|
|
IDSpec: sqlgraph.NewFieldSpec(mcptool.FieldID, field.TypeUUID),
|
|
},
|
|
}
|
|
for _, k := range nodes {
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
}
|
|
_node.ToolID = nodes[0]
|
|
_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.MCPToolCall.Create().
|
|
// SetRequestID(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.MCPToolCallUpsert) {
|
|
// SetRequestID(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *MCPToolCallCreate) OnConflict(opts ...sql.ConflictOption) *MCPToolCallUpsertOne {
|
|
_c.conflict = opts
|
|
return &MCPToolCallUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.MCPToolCall.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *MCPToolCallCreate) OnConflictColumns(columns ...string) *MCPToolCallUpsertOne {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &MCPToolCallUpsertOne{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
type (
|
|
// MCPToolCallUpsertOne is the builder for "upsert"-ing
|
|
// one MCPToolCall node.
|
|
MCPToolCallUpsertOne struct {
|
|
create *MCPToolCallCreate
|
|
}
|
|
|
|
// MCPToolCallUpsert is the "OnConflict" setter.
|
|
MCPToolCallUpsert struct {
|
|
*sql.UpdateSet
|
|
}
|
|
)
|
|
|
|
// SetRequestID sets the "request_id" field.
|
|
func (u *MCPToolCallUpsert) SetRequestID(v string) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldRequestID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateRequestID sets the "request_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateRequestID() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldRequestID)
|
|
return u
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (u *MCPToolCallUpsert) SetTaskID(v uuid.UUID) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldTaskID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateTaskID sets the "task_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateTaskID() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldTaskID)
|
|
return u
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (u *MCPToolCallUpsert) SetUserID(v uuid.UUID) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldUserID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUserID sets the "user_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateUserID() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldUserID)
|
|
return u
|
|
}
|
|
|
|
// SetUpstreamID sets the "upstream_id" field.
|
|
func (u *MCPToolCallUpsert) SetUpstreamID(v uuid.UUID) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldUpstreamID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUpstreamID sets the "upstream_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateUpstreamID() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldUpstreamID)
|
|
return u
|
|
}
|
|
|
|
// SetToolID sets the "tool_id" field.
|
|
func (u *MCPToolCallUpsert) SetToolID(v uuid.UUID) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldToolID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateToolID sets the "tool_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateToolID() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldToolID)
|
|
return u
|
|
}
|
|
|
|
// SetToolNameSnapshot sets the "tool_name_snapshot" field.
|
|
func (u *MCPToolCallUpsert) SetToolNameSnapshot(v string) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldToolNameSnapshot, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateToolNameSnapshot sets the "tool_name_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateToolNameSnapshot() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldToolNameSnapshot)
|
|
return u
|
|
}
|
|
|
|
// SetToolScopeSnapshot sets the "tool_scope_snapshot" field.
|
|
func (u *MCPToolCallUpsert) SetToolScopeSnapshot(v mcptoolcall.ToolScopeSnapshot) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldToolScopeSnapshot, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateToolScopeSnapshot sets the "tool_scope_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateToolScopeSnapshot() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldToolScopeSnapshot)
|
|
return u
|
|
}
|
|
|
|
// SetPriceSnapshot sets the "price_snapshot" field.
|
|
func (u *MCPToolCallUpsert) SetPriceSnapshot(v int64) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldPriceSnapshot, v)
|
|
return u
|
|
}
|
|
|
|
// UpdatePriceSnapshot sets the "price_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdatePriceSnapshot() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldPriceSnapshot)
|
|
return u
|
|
}
|
|
|
|
// AddPriceSnapshot adds v to the "price_snapshot" field.
|
|
func (u *MCPToolCallUpsert) AddPriceSnapshot(v int64) *MCPToolCallUpsert {
|
|
u.Add(mcptoolcall.FieldPriceSnapshot, v)
|
|
return u
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *MCPToolCallUpsert) SetStatus(v mcptoolcall.Status) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldStatus, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateStatus() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldStatus)
|
|
return u
|
|
}
|
|
|
|
// SetArgsJSON sets the "args_json" field.
|
|
func (u *MCPToolCallUpsert) SetArgsJSON(v map[string]interface{}) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldArgsJSON, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateArgsJSON sets the "args_json" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateArgsJSON() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldArgsJSON)
|
|
return u
|
|
}
|
|
|
|
// ClearArgsJSON clears the value of the "args_json" field.
|
|
func (u *MCPToolCallUpsert) ClearArgsJSON() *MCPToolCallUpsert {
|
|
u.SetNull(mcptoolcall.FieldArgsJSON)
|
|
return u
|
|
}
|
|
|
|
// SetResultJSON sets the "result_json" field.
|
|
func (u *MCPToolCallUpsert) SetResultJSON(v map[string]interface{}) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldResultJSON, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateResultJSON sets the "result_json" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateResultJSON() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldResultJSON)
|
|
return u
|
|
}
|
|
|
|
// ClearResultJSON clears the value of the "result_json" field.
|
|
func (u *MCPToolCallUpsert) ClearResultJSON() *MCPToolCallUpsert {
|
|
u.SetNull(mcptoolcall.FieldResultJSON)
|
|
return u
|
|
}
|
|
|
|
// SetErrorMessage sets the "error_message" field.
|
|
func (u *MCPToolCallUpsert) SetErrorMessage(v string) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldErrorMessage, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateErrorMessage() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldErrorMessage)
|
|
return u
|
|
}
|
|
|
|
// SetUpstreamRequestID sets the "upstream_request_id" field.
|
|
func (u *MCPToolCallUpsert) SetUpstreamRequestID(v string) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldUpstreamRequestID, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUpstreamRequestID sets the "upstream_request_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateUpstreamRequestID() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldUpstreamRequestID)
|
|
return u
|
|
}
|
|
|
|
// ClearUpstreamRequestID clears the value of the "upstream_request_id" field.
|
|
func (u *MCPToolCallUpsert) ClearUpstreamRequestID() *MCPToolCallUpsert {
|
|
u.SetNull(mcptoolcall.FieldUpstreamRequestID)
|
|
return u
|
|
}
|
|
|
|
// SetStartedAt sets the "started_at" field.
|
|
func (u *MCPToolCallUpsert) SetStartedAt(v time.Time) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldStartedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateStartedAt sets the "started_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateStartedAt() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldStartedAt)
|
|
return u
|
|
}
|
|
|
|
// SetFinishedAt sets the "finished_at" field.
|
|
func (u *MCPToolCallUpsert) SetFinishedAt(v time.Time) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldFinishedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateFinishedAt() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldFinishedAt)
|
|
return u
|
|
}
|
|
|
|
// ClearFinishedAt clears the value of the "finished_at" field.
|
|
func (u *MCPToolCallUpsert) ClearFinishedAt() *MCPToolCallUpsert {
|
|
u.SetNull(mcptoolcall.FieldFinishedAt)
|
|
return u
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *MCPToolCallUpsert) SetCreatedAt(v time.Time) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldCreatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateCreatedAt() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldCreatedAt)
|
|
return u
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *MCPToolCallUpsert) SetUpdatedAt(v time.Time) *MCPToolCallUpsert {
|
|
u.Set(mcptoolcall.FieldUpdatedAt, v)
|
|
return u
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsert) UpdateUpdatedAt() *MCPToolCallUpsert {
|
|
u.SetExcluded(mcptoolcall.FieldUpdatedAt)
|
|
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.MCPToolCall.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(mcptoolcall.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *MCPToolCallUpsertOne) UpdateNewValues() *MCPToolCallUpsertOne {
|
|
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(mcptoolcall.FieldID)
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.MCPToolCall.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *MCPToolCallUpsertOne) Ignore() *MCPToolCallUpsertOne {
|
|
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 *MCPToolCallUpsertOne) DoNothing() *MCPToolCallUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the MCPToolCallCreate.OnConflict
|
|
// documentation for more info.
|
|
func (u *MCPToolCallUpsertOne) Update(set func(*MCPToolCallUpsert)) *MCPToolCallUpsertOne {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&MCPToolCallUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetRequestID sets the "request_id" field.
|
|
func (u *MCPToolCallUpsertOne) SetRequestID(v string) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetRequestID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRequestID sets the "request_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateRequestID() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateRequestID()
|
|
})
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (u *MCPToolCallUpsertOne) SetTaskID(v uuid.UUID) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetTaskID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTaskID sets the "task_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateTaskID() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateTaskID()
|
|
})
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (u *MCPToolCallUpsertOne) SetUserID(v uuid.UUID) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUserID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUserID sets the "user_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateUserID() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUserID()
|
|
})
|
|
}
|
|
|
|
// SetUpstreamID sets the "upstream_id" field.
|
|
func (u *MCPToolCallUpsertOne) SetUpstreamID(v uuid.UUID) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUpstreamID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpstreamID sets the "upstream_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateUpstreamID() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUpstreamID()
|
|
})
|
|
}
|
|
|
|
// SetToolID sets the "tool_id" field.
|
|
func (u *MCPToolCallUpsertOne) SetToolID(v uuid.UUID) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetToolID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateToolID sets the "tool_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateToolID() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateToolID()
|
|
})
|
|
}
|
|
|
|
// SetToolNameSnapshot sets the "tool_name_snapshot" field.
|
|
func (u *MCPToolCallUpsertOne) SetToolNameSnapshot(v string) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetToolNameSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// UpdateToolNameSnapshot sets the "tool_name_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateToolNameSnapshot() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateToolNameSnapshot()
|
|
})
|
|
}
|
|
|
|
// SetToolScopeSnapshot sets the "tool_scope_snapshot" field.
|
|
func (u *MCPToolCallUpsertOne) SetToolScopeSnapshot(v mcptoolcall.ToolScopeSnapshot) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetToolScopeSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// UpdateToolScopeSnapshot sets the "tool_scope_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateToolScopeSnapshot() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateToolScopeSnapshot()
|
|
})
|
|
}
|
|
|
|
// SetPriceSnapshot sets the "price_snapshot" field.
|
|
func (u *MCPToolCallUpsertOne) SetPriceSnapshot(v int64) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetPriceSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// AddPriceSnapshot adds v to the "price_snapshot" field.
|
|
func (u *MCPToolCallUpsertOne) AddPriceSnapshot(v int64) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.AddPriceSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePriceSnapshot sets the "price_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdatePriceSnapshot() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdatePriceSnapshot()
|
|
})
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *MCPToolCallUpsertOne) SetStatus(v mcptoolcall.Status) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetStatus(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateStatus() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateStatus()
|
|
})
|
|
}
|
|
|
|
// SetArgsJSON sets the "args_json" field.
|
|
func (u *MCPToolCallUpsertOne) SetArgsJSON(v map[string]interface{}) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetArgsJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdateArgsJSON sets the "args_json" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateArgsJSON() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateArgsJSON()
|
|
})
|
|
}
|
|
|
|
// ClearArgsJSON clears the value of the "args_json" field.
|
|
func (u *MCPToolCallUpsertOne) ClearArgsJSON() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearArgsJSON()
|
|
})
|
|
}
|
|
|
|
// SetResultJSON sets the "result_json" field.
|
|
func (u *MCPToolCallUpsertOne) SetResultJSON(v map[string]interface{}) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetResultJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdateResultJSON sets the "result_json" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateResultJSON() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateResultJSON()
|
|
})
|
|
}
|
|
|
|
// ClearResultJSON clears the value of the "result_json" field.
|
|
func (u *MCPToolCallUpsertOne) ClearResultJSON() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearResultJSON()
|
|
})
|
|
}
|
|
|
|
// SetErrorMessage sets the "error_message" field.
|
|
func (u *MCPToolCallUpsertOne) SetErrorMessage(v string) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetErrorMessage(v)
|
|
})
|
|
}
|
|
|
|
// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateErrorMessage() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateErrorMessage()
|
|
})
|
|
}
|
|
|
|
// SetUpstreamRequestID sets the "upstream_request_id" field.
|
|
func (u *MCPToolCallUpsertOne) SetUpstreamRequestID(v string) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUpstreamRequestID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpstreamRequestID sets the "upstream_request_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateUpstreamRequestID() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUpstreamRequestID()
|
|
})
|
|
}
|
|
|
|
// ClearUpstreamRequestID clears the value of the "upstream_request_id" field.
|
|
func (u *MCPToolCallUpsertOne) ClearUpstreamRequestID() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearUpstreamRequestID()
|
|
})
|
|
}
|
|
|
|
// SetStartedAt sets the "started_at" field.
|
|
func (u *MCPToolCallUpsertOne) SetStartedAt(v time.Time) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetStartedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStartedAt sets the "started_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateStartedAt() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateStartedAt()
|
|
})
|
|
}
|
|
|
|
// SetFinishedAt sets the "finished_at" field.
|
|
func (u *MCPToolCallUpsertOne) SetFinishedAt(v time.Time) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetFinishedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateFinishedAt() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateFinishedAt()
|
|
})
|
|
}
|
|
|
|
// ClearFinishedAt clears the value of the "finished_at" field.
|
|
func (u *MCPToolCallUpsertOne) ClearFinishedAt() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearFinishedAt()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *MCPToolCallUpsertOne) SetCreatedAt(v time.Time) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateCreatedAt() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *MCPToolCallUpsertOne) SetUpdatedAt(v time.Time) *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertOne) UpdateUpdatedAt() *MCPToolCallUpsertOne {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *MCPToolCallUpsertOne) Exec(ctx context.Context) error {
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("db: missing options for MCPToolCallCreate.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *MCPToolCallUpsertOne) 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 *MCPToolCallUpsertOne) ID(ctx context.Context) (id uuid.UUID, err error) {
|
|
if u.create.driver.Dialect() == dialect.MySQL {
|
|
// In case of "ON CONFLICT", there is no way to get back non-numeric ID
|
|
// fields from the database since MySQL does not support the RETURNING clause.
|
|
return id, errors.New("db: MCPToolCallUpsertOne.ID is not supported by MySQL driver. Use MCPToolCallUpsertOne.Exec instead")
|
|
}
|
|
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 *MCPToolCallUpsertOne) IDX(ctx context.Context) uuid.UUID {
|
|
id, err := u.ID(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return id
|
|
}
|
|
|
|
// MCPToolCallCreateBulk is the builder for creating many MCPToolCall entities in bulk.
|
|
type MCPToolCallCreateBulk struct {
|
|
config
|
|
err error
|
|
builders []*MCPToolCallCreate
|
|
conflict []sql.ConflictOption
|
|
}
|
|
|
|
// Save creates the MCPToolCall entities in the database.
|
|
func (_c *MCPToolCallCreateBulk) Save(ctx context.Context) ([]*MCPToolCall, error) {
|
|
if _c.err != nil {
|
|
return nil, _c.err
|
|
}
|
|
specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
|
|
nodes := make([]*MCPToolCall, len(_c.builders))
|
|
mutators := make([]Mutator, len(_c.builders))
|
|
for i := range _c.builders {
|
|
func(i int, root context.Context) {
|
|
builder := _c.builders[i]
|
|
builder.defaults()
|
|
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
|
mutation, ok := m.(*MCPToolCallMutation)
|
|
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, _c.builders[i+1].mutation)
|
|
} else {
|
|
spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
|
|
spec.OnConflict = _c.conflict
|
|
// Invoke the actual operation on the latest mutation in the chain.
|
|
if err = sqlgraph.BatchCreate(ctx, _c.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
|
|
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, _c.builders[0].mutation); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return nodes, nil
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_c *MCPToolCallCreateBulk) SaveX(ctx context.Context) []*MCPToolCall {
|
|
v, err := _c.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_c *MCPToolCallCreateBulk) Exec(ctx context.Context) error {
|
|
_, err := _c.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_c *MCPToolCallCreateBulk) ExecX(ctx context.Context) {
|
|
if err := _c.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
|
|
// of the `INSERT` statement. For example:
|
|
//
|
|
// client.MCPToolCall.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.MCPToolCallUpsert) {
|
|
// SetRequestID(v+v).
|
|
// }).
|
|
// Exec(ctx)
|
|
func (_c *MCPToolCallCreateBulk) OnConflict(opts ...sql.ConflictOption) *MCPToolCallUpsertBulk {
|
|
_c.conflict = opts
|
|
return &MCPToolCallUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// OnConflictColumns calls `OnConflict` and configures the columns
|
|
// as conflict target. Using this option is equivalent to using:
|
|
//
|
|
// client.MCPToolCall.Create().
|
|
// OnConflict(sql.ConflictColumns(columns...)).
|
|
// Exec(ctx)
|
|
func (_c *MCPToolCallCreateBulk) OnConflictColumns(columns ...string) *MCPToolCallUpsertBulk {
|
|
_c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
|
|
return &MCPToolCallUpsertBulk{
|
|
create: _c,
|
|
}
|
|
}
|
|
|
|
// MCPToolCallUpsertBulk is the builder for "upsert"-ing
|
|
// a bulk of MCPToolCall nodes.
|
|
type MCPToolCallUpsertBulk struct {
|
|
create *MCPToolCallCreateBulk
|
|
}
|
|
|
|
// UpdateNewValues updates the mutable fields using the new values that
|
|
// were set on create. Using this option is equivalent to using:
|
|
//
|
|
// client.MCPToolCall.Create().
|
|
// OnConflict(
|
|
// sql.ResolveWithNewValues(),
|
|
// sql.ResolveWith(func(u *sql.UpdateSet) {
|
|
// u.SetIgnore(mcptoolcall.FieldID)
|
|
// }),
|
|
// ).
|
|
// Exec(ctx)
|
|
func (u *MCPToolCallUpsertBulk) UpdateNewValues() *MCPToolCallUpsertBulk {
|
|
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(mcptoolcall.FieldID)
|
|
}
|
|
}
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// Ignore sets each column to itself in case of conflict.
|
|
// Using this option is equivalent to using:
|
|
//
|
|
// client.MCPToolCall.Create().
|
|
// OnConflict(sql.ResolveWithIgnore()).
|
|
// Exec(ctx)
|
|
func (u *MCPToolCallUpsertBulk) Ignore() *MCPToolCallUpsertBulk {
|
|
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 *MCPToolCallUpsertBulk) DoNothing() *MCPToolCallUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.DoNothing())
|
|
return u
|
|
}
|
|
|
|
// Update allows overriding fields `UPDATE` values. See the MCPToolCallCreateBulk.OnConflict
|
|
// documentation for more info.
|
|
func (u *MCPToolCallUpsertBulk) Update(set func(*MCPToolCallUpsert)) *MCPToolCallUpsertBulk {
|
|
u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
|
|
set(&MCPToolCallUpsert{UpdateSet: update})
|
|
}))
|
|
return u
|
|
}
|
|
|
|
// SetRequestID sets the "request_id" field.
|
|
func (u *MCPToolCallUpsertBulk) SetRequestID(v string) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetRequestID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateRequestID sets the "request_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateRequestID() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateRequestID()
|
|
})
|
|
}
|
|
|
|
// SetTaskID sets the "task_id" field.
|
|
func (u *MCPToolCallUpsertBulk) SetTaskID(v uuid.UUID) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetTaskID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateTaskID sets the "task_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateTaskID() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateTaskID()
|
|
})
|
|
}
|
|
|
|
// SetUserID sets the "user_id" field.
|
|
func (u *MCPToolCallUpsertBulk) SetUserID(v uuid.UUID) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUserID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUserID sets the "user_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateUserID() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUserID()
|
|
})
|
|
}
|
|
|
|
// SetUpstreamID sets the "upstream_id" field.
|
|
func (u *MCPToolCallUpsertBulk) SetUpstreamID(v uuid.UUID) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUpstreamID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpstreamID sets the "upstream_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateUpstreamID() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUpstreamID()
|
|
})
|
|
}
|
|
|
|
// SetToolID sets the "tool_id" field.
|
|
func (u *MCPToolCallUpsertBulk) SetToolID(v uuid.UUID) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetToolID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateToolID sets the "tool_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateToolID() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateToolID()
|
|
})
|
|
}
|
|
|
|
// SetToolNameSnapshot sets the "tool_name_snapshot" field.
|
|
func (u *MCPToolCallUpsertBulk) SetToolNameSnapshot(v string) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetToolNameSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// UpdateToolNameSnapshot sets the "tool_name_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateToolNameSnapshot() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateToolNameSnapshot()
|
|
})
|
|
}
|
|
|
|
// SetToolScopeSnapshot sets the "tool_scope_snapshot" field.
|
|
func (u *MCPToolCallUpsertBulk) SetToolScopeSnapshot(v mcptoolcall.ToolScopeSnapshot) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetToolScopeSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// UpdateToolScopeSnapshot sets the "tool_scope_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateToolScopeSnapshot() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateToolScopeSnapshot()
|
|
})
|
|
}
|
|
|
|
// SetPriceSnapshot sets the "price_snapshot" field.
|
|
func (u *MCPToolCallUpsertBulk) SetPriceSnapshot(v int64) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetPriceSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// AddPriceSnapshot adds v to the "price_snapshot" field.
|
|
func (u *MCPToolCallUpsertBulk) AddPriceSnapshot(v int64) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.AddPriceSnapshot(v)
|
|
})
|
|
}
|
|
|
|
// UpdatePriceSnapshot sets the "price_snapshot" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdatePriceSnapshot() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdatePriceSnapshot()
|
|
})
|
|
}
|
|
|
|
// SetStatus sets the "status" field.
|
|
func (u *MCPToolCallUpsertBulk) SetStatus(v mcptoolcall.Status) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetStatus(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStatus sets the "status" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateStatus() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateStatus()
|
|
})
|
|
}
|
|
|
|
// SetArgsJSON sets the "args_json" field.
|
|
func (u *MCPToolCallUpsertBulk) SetArgsJSON(v map[string]interface{}) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetArgsJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdateArgsJSON sets the "args_json" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateArgsJSON() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateArgsJSON()
|
|
})
|
|
}
|
|
|
|
// ClearArgsJSON clears the value of the "args_json" field.
|
|
func (u *MCPToolCallUpsertBulk) ClearArgsJSON() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearArgsJSON()
|
|
})
|
|
}
|
|
|
|
// SetResultJSON sets the "result_json" field.
|
|
func (u *MCPToolCallUpsertBulk) SetResultJSON(v map[string]interface{}) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetResultJSON(v)
|
|
})
|
|
}
|
|
|
|
// UpdateResultJSON sets the "result_json" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateResultJSON() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateResultJSON()
|
|
})
|
|
}
|
|
|
|
// ClearResultJSON clears the value of the "result_json" field.
|
|
func (u *MCPToolCallUpsertBulk) ClearResultJSON() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearResultJSON()
|
|
})
|
|
}
|
|
|
|
// SetErrorMessage sets the "error_message" field.
|
|
func (u *MCPToolCallUpsertBulk) SetErrorMessage(v string) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetErrorMessage(v)
|
|
})
|
|
}
|
|
|
|
// UpdateErrorMessage sets the "error_message" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateErrorMessage() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateErrorMessage()
|
|
})
|
|
}
|
|
|
|
// SetUpstreamRequestID sets the "upstream_request_id" field.
|
|
func (u *MCPToolCallUpsertBulk) SetUpstreamRequestID(v string) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUpstreamRequestID(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpstreamRequestID sets the "upstream_request_id" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateUpstreamRequestID() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUpstreamRequestID()
|
|
})
|
|
}
|
|
|
|
// ClearUpstreamRequestID clears the value of the "upstream_request_id" field.
|
|
func (u *MCPToolCallUpsertBulk) ClearUpstreamRequestID() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearUpstreamRequestID()
|
|
})
|
|
}
|
|
|
|
// SetStartedAt sets the "started_at" field.
|
|
func (u *MCPToolCallUpsertBulk) SetStartedAt(v time.Time) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetStartedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateStartedAt sets the "started_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateStartedAt() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateStartedAt()
|
|
})
|
|
}
|
|
|
|
// SetFinishedAt sets the "finished_at" field.
|
|
func (u *MCPToolCallUpsertBulk) SetFinishedAt(v time.Time) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetFinishedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateFinishedAt sets the "finished_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateFinishedAt() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateFinishedAt()
|
|
})
|
|
}
|
|
|
|
// ClearFinishedAt clears the value of the "finished_at" field.
|
|
func (u *MCPToolCallUpsertBulk) ClearFinishedAt() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.ClearFinishedAt()
|
|
})
|
|
}
|
|
|
|
// SetCreatedAt sets the "created_at" field.
|
|
func (u *MCPToolCallUpsertBulk) SetCreatedAt(v time.Time) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetCreatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateCreatedAt() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateCreatedAt()
|
|
})
|
|
}
|
|
|
|
// SetUpdatedAt sets the "updated_at" field.
|
|
func (u *MCPToolCallUpsertBulk) SetUpdatedAt(v time.Time) *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.SetUpdatedAt(v)
|
|
})
|
|
}
|
|
|
|
// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
|
|
func (u *MCPToolCallUpsertBulk) UpdateUpdatedAt() *MCPToolCallUpsertBulk {
|
|
return u.Update(func(s *MCPToolCallUpsert) {
|
|
s.UpdateUpdatedAt()
|
|
})
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (u *MCPToolCallUpsertBulk) 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("db: OnConflict was set for builder %d. Set it on the MCPToolCallCreateBulk instead", i)
|
|
}
|
|
}
|
|
if len(u.create.conflict) == 0 {
|
|
return errors.New("db: missing options for MCPToolCallCreateBulk.OnConflict")
|
|
}
|
|
return u.create.Exec(ctx)
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (u *MCPToolCallUpsertBulk) ExecX(ctx context.Context) {
|
|
if err := u.create.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|