Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
question_update.go25.3 kB
// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "time" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "github.com/Southclaws/storyden/internal/ent/account" "github.com/Southclaws/storyden/internal/ent/predicate" "github.com/Southclaws/storyden/internal/ent/question" "github.com/rs/xid" ) // QuestionUpdate is the builder for updating Question entities. type QuestionUpdate struct { config hooks []Hook mutation *QuestionMutation modifiers []func(*sql.UpdateBuilder) } // Where appends a list predicates to the QuestionUpdate builder. func (_u *QuestionUpdate) Where(ps ...predicate.Question) *QuestionUpdate { _u.mutation.Where(ps...) return _u } // SetIndexedAt sets the "indexed_at" field. func (_u *QuestionUpdate) SetIndexedAt(v time.Time) *QuestionUpdate { _u.mutation.SetIndexedAt(v) return _u } // SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil. func (_u *QuestionUpdate) SetNillableIndexedAt(v *time.Time) *QuestionUpdate { if v != nil { _u.SetIndexedAt(*v) } return _u } // ClearIndexedAt clears the value of the "indexed_at" field. func (_u *QuestionUpdate) ClearIndexedAt() *QuestionUpdate { _u.mutation.ClearIndexedAt() return _u } // SetSlug sets the "slug" field. func (_u *QuestionUpdate) SetSlug(v string) *QuestionUpdate { _u.mutation.SetSlug(v) return _u } // SetNillableSlug sets the "slug" field if the given value is not nil. func (_u *QuestionUpdate) SetNillableSlug(v *string) *QuestionUpdate { if v != nil { _u.SetSlug(*v) } return _u } // SetQuery sets the "query" field. func (_u *QuestionUpdate) SetQuery(v string) *QuestionUpdate { _u.mutation.SetQuery(v) return _u } // SetNillableQuery sets the "query" field if the given value is not nil. func (_u *QuestionUpdate) SetNillableQuery(v *string) *QuestionUpdate { if v != nil { _u.SetQuery(*v) } return _u } // SetResult sets the "result" field. func (_u *QuestionUpdate) SetResult(v string) *QuestionUpdate { _u.mutation.SetResult(v) return _u } // SetNillableResult sets the "result" field if the given value is not nil. func (_u *QuestionUpdate) SetNillableResult(v *string) *QuestionUpdate { if v != nil { _u.SetResult(*v) } return _u } // SetMetadata sets the "metadata" field. func (_u *QuestionUpdate) SetMetadata(v map[string]interface{}) *QuestionUpdate { _u.mutation.SetMetadata(v) return _u } // ClearMetadata clears the value of the "metadata" field. func (_u *QuestionUpdate) ClearMetadata() *QuestionUpdate { _u.mutation.ClearMetadata() return _u } // SetAccountID sets the "account_id" field. func (_u *QuestionUpdate) SetAccountID(v xid.ID) *QuestionUpdate { _u.mutation.SetAccountID(v) return _u } // SetNillableAccountID sets the "account_id" field if the given value is not nil. func (_u *QuestionUpdate) SetNillableAccountID(v *xid.ID) *QuestionUpdate { if v != nil { _u.SetAccountID(*v) } return _u } // ClearAccountID clears the value of the "account_id" field. func (_u *QuestionUpdate) ClearAccountID() *QuestionUpdate { _u.mutation.ClearAccountID() return _u } // SetParentQuestionID sets the "parent_question_id" field. func (_u *QuestionUpdate) SetParentQuestionID(v xid.ID) *QuestionUpdate { _u.mutation.SetParentQuestionID(v) return _u } // SetNillableParentQuestionID sets the "parent_question_id" field if the given value is not nil. func (_u *QuestionUpdate) SetNillableParentQuestionID(v *xid.ID) *QuestionUpdate { if v != nil { _u.SetParentQuestionID(*v) } return _u } // ClearParentQuestionID clears the value of the "parent_question_id" field. func (_u *QuestionUpdate) ClearParentQuestionID() *QuestionUpdate { _u.mutation.ClearParentQuestionID() return _u } // SetAuthorID sets the "author" edge to the Account entity by ID. func (_u *QuestionUpdate) SetAuthorID(id xid.ID) *QuestionUpdate { _u.mutation.SetAuthorID(id) return _u } // SetNillableAuthorID sets the "author" edge to the Account entity by ID if the given value is not nil. func (_u *QuestionUpdate) SetNillableAuthorID(id *xid.ID) *QuestionUpdate { if id != nil { _u = _u.SetAuthorID(*id) } return _u } // SetAuthor sets the "author" edge to the Account entity. func (_u *QuestionUpdate) SetAuthor(v *Account) *QuestionUpdate { return _u.SetAuthorID(v.ID) } // SetParentID sets the "parent" edge to the Question entity by ID. func (_u *QuestionUpdate) SetParentID(id xid.ID) *QuestionUpdate { _u.mutation.SetParentID(id) return _u } // SetNillableParentID sets the "parent" edge to the Question entity by ID if the given value is not nil. func (_u *QuestionUpdate) SetNillableParentID(id *xid.ID) *QuestionUpdate { if id != nil { _u = _u.SetParentID(*id) } return _u } // SetParent sets the "parent" edge to the Question entity. func (_u *QuestionUpdate) SetParent(v *Question) *QuestionUpdate { return _u.SetParentID(v.ID) } // AddParentQuestionIDs adds the "parent_question" edge to the Question entity by IDs. func (_u *QuestionUpdate) AddParentQuestionIDs(ids ...xid.ID) *QuestionUpdate { _u.mutation.AddParentQuestionIDs(ids...) return _u } // AddParentQuestion adds the "parent_question" edges to the Question entity. func (_u *QuestionUpdate) AddParentQuestion(v ...*Question) *QuestionUpdate { ids := make([]xid.ID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddParentQuestionIDs(ids...) } // Mutation returns the QuestionMutation object of the builder. func (_u *QuestionUpdate) Mutation() *QuestionMutation { return _u.mutation } // ClearAuthor clears the "author" edge to the Account entity. func (_u *QuestionUpdate) ClearAuthor() *QuestionUpdate { _u.mutation.ClearAuthor() return _u } // ClearParent clears the "parent" edge to the Question entity. func (_u *QuestionUpdate) ClearParent() *QuestionUpdate { _u.mutation.ClearParent() return _u } // ClearParentQuestion clears all "parent_question" edges to the Question entity. func (_u *QuestionUpdate) ClearParentQuestion() *QuestionUpdate { _u.mutation.ClearParentQuestion() return _u } // RemoveParentQuestionIDs removes the "parent_question" edge to Question entities by IDs. func (_u *QuestionUpdate) RemoveParentQuestionIDs(ids ...xid.ID) *QuestionUpdate { _u.mutation.RemoveParentQuestionIDs(ids...) return _u } // RemoveParentQuestion removes "parent_question" edges to Question entities. func (_u *QuestionUpdate) RemoveParentQuestion(v ...*Question) *QuestionUpdate { ids := make([]xid.ID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveParentQuestionIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. func (_u *QuestionUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *QuestionUpdate) SaveX(ctx context.Context) int { affected, err := _u.Save(ctx) if err != nil { panic(err) } return affected } // Exec executes the query. func (_u *QuestionUpdate) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *QuestionUpdate) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. func (_u *QuestionUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *QuestionUpdate { _u.modifiers = append(_u.modifiers, modifiers...) return _u } func (_u *QuestionUpdate) sqlSave(ctx context.Context) (_node int, err error) { _spec := sqlgraph.NewUpdateSpec(question.Table, question.Columns, sqlgraph.NewFieldSpec(question.FieldID, field.TypeString)) if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.IndexedAt(); ok { _spec.SetField(question.FieldIndexedAt, field.TypeTime, value) } if _u.mutation.IndexedAtCleared() { _spec.ClearField(question.FieldIndexedAt, field.TypeTime) } if value, ok := _u.mutation.Slug(); ok { _spec.SetField(question.FieldSlug, field.TypeString, value) } if value, ok := _u.mutation.Query(); ok { _spec.SetField(question.FieldQuery, field.TypeString, value) } if value, ok := _u.mutation.Result(); ok { _spec.SetField(question.FieldResult, field.TypeString, value) } if value, ok := _u.mutation.Metadata(); ok { _spec.SetField(question.FieldMetadata, field.TypeJSON, value) } if _u.mutation.MetadataCleared() { _spec.ClearField(question.FieldMetadata, field.TypeJSON) } if _u.mutation.AuthorCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.AuthorTable, Columns: []string{question.AuthorColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AuthorIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.AuthorTable, Columns: []string{question.AuthorColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.ParentCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.ParentTable, Columns: []string{question.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.ParentTable, Columns: []string{question.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.ParentQuestionCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: question.ParentQuestionTable, Columns: []string{question.ParentQuestionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedParentQuestionIDs(); len(nodes) > 0 && !_u.mutation.ParentQuestionCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: question.ParentQuestionTable, Columns: []string{question.ParentQuestionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentQuestionIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: question.ParentQuestionTable, Columns: []string{question.ParentQuestionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _spec.AddModifiers(_u.modifiers...) if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{question.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return 0, err } _u.mutation.done = true return _node, nil } // QuestionUpdateOne is the builder for updating a single Question entity. type QuestionUpdateOne struct { config fields []string hooks []Hook mutation *QuestionMutation modifiers []func(*sql.UpdateBuilder) } // SetIndexedAt sets the "indexed_at" field. func (_u *QuestionUpdateOne) SetIndexedAt(v time.Time) *QuestionUpdateOne { _u.mutation.SetIndexedAt(v) return _u } // SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableIndexedAt(v *time.Time) *QuestionUpdateOne { if v != nil { _u.SetIndexedAt(*v) } return _u } // ClearIndexedAt clears the value of the "indexed_at" field. func (_u *QuestionUpdateOne) ClearIndexedAt() *QuestionUpdateOne { _u.mutation.ClearIndexedAt() return _u } // SetSlug sets the "slug" field. func (_u *QuestionUpdateOne) SetSlug(v string) *QuestionUpdateOne { _u.mutation.SetSlug(v) return _u } // SetNillableSlug sets the "slug" field if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableSlug(v *string) *QuestionUpdateOne { if v != nil { _u.SetSlug(*v) } return _u } // SetQuery sets the "query" field. func (_u *QuestionUpdateOne) SetQuery(v string) *QuestionUpdateOne { _u.mutation.SetQuery(v) return _u } // SetNillableQuery sets the "query" field if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableQuery(v *string) *QuestionUpdateOne { if v != nil { _u.SetQuery(*v) } return _u } // SetResult sets the "result" field. func (_u *QuestionUpdateOne) SetResult(v string) *QuestionUpdateOne { _u.mutation.SetResult(v) return _u } // SetNillableResult sets the "result" field if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableResult(v *string) *QuestionUpdateOne { if v != nil { _u.SetResult(*v) } return _u } // SetMetadata sets the "metadata" field. func (_u *QuestionUpdateOne) SetMetadata(v map[string]interface{}) *QuestionUpdateOne { _u.mutation.SetMetadata(v) return _u } // ClearMetadata clears the value of the "metadata" field. func (_u *QuestionUpdateOne) ClearMetadata() *QuestionUpdateOne { _u.mutation.ClearMetadata() return _u } // SetAccountID sets the "account_id" field. func (_u *QuestionUpdateOne) SetAccountID(v xid.ID) *QuestionUpdateOne { _u.mutation.SetAccountID(v) return _u } // SetNillableAccountID sets the "account_id" field if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableAccountID(v *xid.ID) *QuestionUpdateOne { if v != nil { _u.SetAccountID(*v) } return _u } // ClearAccountID clears the value of the "account_id" field. func (_u *QuestionUpdateOne) ClearAccountID() *QuestionUpdateOne { _u.mutation.ClearAccountID() return _u } // SetParentQuestionID sets the "parent_question_id" field. func (_u *QuestionUpdateOne) SetParentQuestionID(v xid.ID) *QuestionUpdateOne { _u.mutation.SetParentQuestionID(v) return _u } // SetNillableParentQuestionID sets the "parent_question_id" field if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableParentQuestionID(v *xid.ID) *QuestionUpdateOne { if v != nil { _u.SetParentQuestionID(*v) } return _u } // ClearParentQuestionID clears the value of the "parent_question_id" field. func (_u *QuestionUpdateOne) ClearParentQuestionID() *QuestionUpdateOne { _u.mutation.ClearParentQuestionID() return _u } // SetAuthorID sets the "author" edge to the Account entity by ID. func (_u *QuestionUpdateOne) SetAuthorID(id xid.ID) *QuestionUpdateOne { _u.mutation.SetAuthorID(id) return _u } // SetNillableAuthorID sets the "author" edge to the Account entity by ID if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableAuthorID(id *xid.ID) *QuestionUpdateOne { if id != nil { _u = _u.SetAuthorID(*id) } return _u } // SetAuthor sets the "author" edge to the Account entity. func (_u *QuestionUpdateOne) SetAuthor(v *Account) *QuestionUpdateOne { return _u.SetAuthorID(v.ID) } // SetParentID sets the "parent" edge to the Question entity by ID. func (_u *QuestionUpdateOne) SetParentID(id xid.ID) *QuestionUpdateOne { _u.mutation.SetParentID(id) return _u } // SetNillableParentID sets the "parent" edge to the Question entity by ID if the given value is not nil. func (_u *QuestionUpdateOne) SetNillableParentID(id *xid.ID) *QuestionUpdateOne { if id != nil { _u = _u.SetParentID(*id) } return _u } // SetParent sets the "parent" edge to the Question entity. func (_u *QuestionUpdateOne) SetParent(v *Question) *QuestionUpdateOne { return _u.SetParentID(v.ID) } // AddParentQuestionIDs adds the "parent_question" edge to the Question entity by IDs. func (_u *QuestionUpdateOne) AddParentQuestionIDs(ids ...xid.ID) *QuestionUpdateOne { _u.mutation.AddParentQuestionIDs(ids...) return _u } // AddParentQuestion adds the "parent_question" edges to the Question entity. func (_u *QuestionUpdateOne) AddParentQuestion(v ...*Question) *QuestionUpdateOne { ids := make([]xid.ID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.AddParentQuestionIDs(ids...) } // Mutation returns the QuestionMutation object of the builder. func (_u *QuestionUpdateOne) Mutation() *QuestionMutation { return _u.mutation } // ClearAuthor clears the "author" edge to the Account entity. func (_u *QuestionUpdateOne) ClearAuthor() *QuestionUpdateOne { _u.mutation.ClearAuthor() return _u } // ClearParent clears the "parent" edge to the Question entity. func (_u *QuestionUpdateOne) ClearParent() *QuestionUpdateOne { _u.mutation.ClearParent() return _u } // ClearParentQuestion clears all "parent_question" edges to the Question entity. func (_u *QuestionUpdateOne) ClearParentQuestion() *QuestionUpdateOne { _u.mutation.ClearParentQuestion() return _u } // RemoveParentQuestionIDs removes the "parent_question" edge to Question entities by IDs. func (_u *QuestionUpdateOne) RemoveParentQuestionIDs(ids ...xid.ID) *QuestionUpdateOne { _u.mutation.RemoveParentQuestionIDs(ids...) return _u } // RemoveParentQuestion removes "parent_question" edges to Question entities. func (_u *QuestionUpdateOne) RemoveParentQuestion(v ...*Question) *QuestionUpdateOne { ids := make([]xid.ID, len(v)) for i := range v { ids[i] = v[i].ID } return _u.RemoveParentQuestionIDs(ids...) } // Where appends a list predicates to the QuestionUpdate builder. func (_u *QuestionUpdateOne) Where(ps ...predicate.Question) *QuestionUpdateOne { _u.mutation.Where(ps...) return _u } // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (_u *QuestionUpdateOne) Select(field string, fields ...string) *QuestionUpdateOne { _u.fields = append([]string{field}, fields...) return _u } // Save executes the query and returns the updated Question entity. func (_u *QuestionUpdateOne) Save(ctx context.Context) (*Question, error) { return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks) } // SaveX is like Save, but panics if an error occurs. func (_u *QuestionUpdateOne) SaveX(ctx context.Context) *Question { node, err := _u.Save(ctx) if err != nil { panic(err) } return node } // Exec executes the query on the entity. func (_u *QuestionUpdateOne) Exec(ctx context.Context) error { _, err := _u.Save(ctx) return err } // ExecX is like Exec, but panics if an error occurs. func (_u *QuestionUpdateOne) ExecX(ctx context.Context) { if err := _u.Exec(ctx); err != nil { panic(err) } } // Modify adds a statement modifier for attaching custom logic to the UPDATE statement. func (_u *QuestionUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *QuestionUpdateOne { _u.modifiers = append(_u.modifiers, modifiers...) return _u } func (_u *QuestionUpdateOne) sqlSave(ctx context.Context) (_node *Question, err error) { _spec := sqlgraph.NewUpdateSpec(question.Table, question.Columns, sqlgraph.NewFieldSpec(question.FieldID, field.TypeString)) id, ok := _u.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Question.id" for update`)} } _spec.Node.ID.Value = id if fields := _u.fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) _spec.Node.Columns = append(_spec.Node.Columns, question.FieldID) for _, f := range fields { if !question.ValidColumn(f) { return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)} } if f != question.FieldID { _spec.Node.Columns = append(_spec.Node.Columns, f) } } } if ps := _u.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { ps[i](selector) } } } if value, ok := _u.mutation.IndexedAt(); ok { _spec.SetField(question.FieldIndexedAt, field.TypeTime, value) } if _u.mutation.IndexedAtCleared() { _spec.ClearField(question.FieldIndexedAt, field.TypeTime) } if value, ok := _u.mutation.Slug(); ok { _spec.SetField(question.FieldSlug, field.TypeString, value) } if value, ok := _u.mutation.Query(); ok { _spec.SetField(question.FieldQuery, field.TypeString, value) } if value, ok := _u.mutation.Result(); ok { _spec.SetField(question.FieldResult, field.TypeString, value) } if value, ok := _u.mutation.Metadata(); ok { _spec.SetField(question.FieldMetadata, field.TypeJSON, value) } if _u.mutation.MetadataCleared() { _spec.ClearField(question.FieldMetadata, field.TypeJSON) } if _u.mutation.AuthorCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.AuthorTable, Columns: []string{question.AuthorColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.AuthorIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.AuthorTable, Columns: []string{question.AuthorColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.ParentCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.ParentTable, Columns: []string{question.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, Table: question.ParentTable, Columns: []string{question.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } if _u.mutation.ParentQuestionCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: question.ParentQuestionTable, Columns: []string{question.ParentQuestionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.RemovedParentQuestionIDs(); len(nodes) > 0 && !_u.mutation.ParentQuestionCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: question.ParentQuestionTable, Columns: []string{question.ParentQuestionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } if nodes := _u.mutation.ParentQuestionIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, Table: question.ParentQuestionTable, Columns: []string{question.ParentQuestionColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString), }, } for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } _spec.AddModifiers(_u.modifiers...) _node = &Question{config: _u.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{question.Label} } else if sqlgraph.IsConstraintError(err) { err = &ConstraintError{msg: err.Error(), wrap: err} } return nil, err } _u.mutation.done = true return _node, nil }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server