// Code generated by ent, DO NOT EDIT. package ent import ( "context" "errors" "fmt" "sync" "code.gurenya.net/carlsmei/muninn-aio/ent/link" "code.gurenya.net/carlsmei/muninn-aio/ent/predicate" "code.gurenya.net/carlsmei/muninn-aio/ent/user" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/google/uuid" ) const ( // Operation types. OpCreate = ent.OpCreate OpDelete = ent.OpDelete OpDeleteOne = ent.OpDeleteOne OpUpdate = ent.OpUpdate OpUpdateOne = ent.OpUpdateOne // Node types. TypeLink = "Link" TypeUser = "User" ) // LinkMutation represents an operation that mutates the Link nodes in the graph. type LinkMutation struct { config op Op typ string id *uuid.UUID key *string original_url *string clearedFields map[string]struct{} owner map[uuid.UUID]struct{} removedowner map[uuid.UUID]struct{} clearedowner bool done bool oldValue func(context.Context) (*Link, error) predicates []predicate.Link } var _ ent.Mutation = (*LinkMutation)(nil) // linkOption allows management of the mutation configuration using functional options. type linkOption func(*LinkMutation) // newLinkMutation creates new mutation for the Link entity. func newLinkMutation(c config, op Op, opts ...linkOption) *LinkMutation { m := &LinkMutation{ config: c, op: op, typ: TypeLink, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withLinkID sets the ID field of the mutation. func withLinkID(id uuid.UUID) linkOption { return func(m *LinkMutation) { var ( err error once sync.Once value *Link ) m.oldValue = func(ctx context.Context) (*Link, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().Link.Get(ctx, id) } }) return value, err } m.id = &id } } // withLink sets the old Link of the mutation. func withLink(node *Link) linkOption { return func(m *LinkMutation) { m.oldValue = func(context.Context) (*Link, error) { return node, nil } m.id = &node.ID } } // Client returns a new `ent.Client` from the mutation. If the mutation was // executed in a transaction (ent.Tx), a transactional client is returned. func (m LinkMutation) Client() *Client { client := &Client{config: m.config} client.init() return client } // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. func (m LinkMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() return tx, nil } // SetID sets the value of the id field. Note that this // operation is only accepted on creation of Link entities. func (m *LinkMutation) SetID(id uuid.UUID) { m.id = &id } // ID returns the ID value in the mutation. Note that the ID is only available // if it was provided to the builder or after it was returned from the database. func (m *LinkMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *LinkMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().Link.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetKey sets the "key" field. func (m *LinkMutation) SetKey(s string) { m.key = &s } // Key returns the value of the "key" field in the mutation. func (m *LinkMutation) Key() (r string, exists bool) { v := m.key if v == nil { return } return *v, true } // OldKey returns the old "key" field's value of the Link entity. // If the Link object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *LinkMutation) OldKey(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldKey is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldKey requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldKey: %w", err) } return oldValue.Key, nil } // ResetKey resets all changes to the "key" field. func (m *LinkMutation) ResetKey() { m.key = nil } // SetOriginalURL sets the "original_url" field. func (m *LinkMutation) SetOriginalURL(s string) { m.original_url = &s } // OriginalURL returns the value of the "original_url" field in the mutation. func (m *LinkMutation) OriginalURL() (r string, exists bool) { v := m.original_url if v == nil { return } return *v, true } // OldOriginalURL returns the old "original_url" field's value of the Link entity. // If the Link object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *LinkMutation) OldOriginalURL(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldOriginalURL is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldOriginalURL requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldOriginalURL: %w", err) } return oldValue.OriginalURL, nil } // ResetOriginalURL resets all changes to the "original_url" field. func (m *LinkMutation) ResetOriginalURL() { m.original_url = nil } // AddOwnerIDs adds the "owner" edge to the User entity by ids. func (m *LinkMutation) AddOwnerIDs(ids ...uuid.UUID) { if m.owner == nil { m.owner = make(map[uuid.UUID]struct{}) } for i := range ids { m.owner[ids[i]] = struct{}{} } } // ClearOwner clears the "owner" edge to the User entity. func (m *LinkMutation) ClearOwner() { m.clearedowner = true } // OwnerCleared reports if the "owner" edge to the User entity was cleared. func (m *LinkMutation) OwnerCleared() bool { return m.clearedowner } // RemoveOwnerIDs removes the "owner" edge to the User entity by IDs. func (m *LinkMutation) RemoveOwnerIDs(ids ...uuid.UUID) { if m.removedowner == nil { m.removedowner = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.owner, ids[i]) m.removedowner[ids[i]] = struct{}{} } } // RemovedOwner returns the removed IDs of the "owner" edge to the User entity. func (m *LinkMutation) RemovedOwnerIDs() (ids []uuid.UUID) { for id := range m.removedowner { ids = append(ids, id) } return } // OwnerIDs returns the "owner" edge IDs in the mutation. func (m *LinkMutation) OwnerIDs() (ids []uuid.UUID) { for id := range m.owner { ids = append(ids, id) } return } // ResetOwner resets all changes to the "owner" edge. func (m *LinkMutation) ResetOwner() { m.owner = nil m.clearedowner = false m.removedowner = nil } // Where appends a list predicates to the LinkMutation builder. func (m *LinkMutation) Where(ps ...predicate.Link) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the LinkMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *LinkMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.Link, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *LinkMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *LinkMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (Link). func (m *LinkMutation) Type() string { return m.typ } // Fields returns all fields that were changed during this mutation. Note that in // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *LinkMutation) Fields() []string { fields := make([]string, 0, 2) if m.key != nil { fields = append(fields, link.FieldKey) } if m.original_url != nil { fields = append(fields, link.FieldOriginalURL) } return fields } // Field returns the value of a field with the given name. The second boolean // return value indicates that this field was not set, or was not defined in the // schema. func (m *LinkMutation) Field(name string) (ent.Value, bool) { switch name { case link.FieldKey: return m.Key() case link.FieldOriginalURL: return m.OriginalURL() } return nil, false } // OldField returns the old value of the field from the database. An error is // returned if the mutation operation is not UpdateOne, or the query to the // database failed. func (m *LinkMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case link.FieldKey: return m.OldKey(ctx) case link.FieldOriginalURL: return m.OldOriginalURL(ctx) } return nil, fmt.Errorf("unknown Link field %s", name) } // SetField sets the value of a field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. func (m *LinkMutation) SetField(name string, value ent.Value) error { switch name { case link.FieldKey: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetKey(v) return nil case link.FieldOriginalURL: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetOriginalURL(v) return nil } return fmt.Errorf("unknown Link field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *LinkMutation) AddedFields() []string { return nil } // AddedField returns the numeric value that was incremented/decremented on a field // with the given name. The second boolean return value indicates that this field // was not set, or was not defined in the schema. func (m *LinkMutation) AddedField(name string) (ent.Value, bool) { return nil, false } // AddField adds the value to the field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. func (m *LinkMutation) AddField(name string, value ent.Value) error { switch name { } return fmt.Errorf("unknown Link numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *LinkMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *LinkMutation) FieldCleared(name string) bool { _, ok := m.clearedFields[name] return ok } // ClearField clears the value of the field with the given name. It returns an // error if the field is not defined in the schema. func (m *LinkMutation) ClearField(name string) error { return fmt.Errorf("unknown Link nullable field %s", name) } // ResetField resets all changes in the mutation for the field with the given name. // It returns an error if the field is not defined in the schema. func (m *LinkMutation) ResetField(name string) error { switch name { case link.FieldKey: m.ResetKey() return nil case link.FieldOriginalURL: m.ResetOriginalURL() return nil } return fmt.Errorf("unknown Link field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *LinkMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.owner != nil { edges = append(edges, link.EdgeOwner) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *LinkMutation) AddedIDs(name string) []ent.Value { switch name { case link.EdgeOwner: ids := make([]ent.Value, 0, len(m.owner)) for id := range m.owner { ids = append(ids, id) } return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *LinkMutation) RemovedEdges() []string { edges := make([]string, 0, 1) if m.removedowner != nil { edges = append(edges, link.EdgeOwner) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *LinkMutation) RemovedIDs(name string) []ent.Value { switch name { case link.EdgeOwner: ids := make([]ent.Value, 0, len(m.removedowner)) for id := range m.removedowner { ids = append(ids, id) } return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *LinkMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedowner { edges = append(edges, link.EdgeOwner) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *LinkMutation) EdgeCleared(name string) bool { switch name { case link.EdgeOwner: return m.clearedowner } return false } // ClearEdge clears the value of the edge with the given name. It returns an error // if that edge is not defined in the schema. func (m *LinkMutation) ClearEdge(name string) error { switch name { } return fmt.Errorf("unknown Link unique edge %s", name) } // ResetEdge resets all changes to the edge with the given name in this mutation. // It returns an error if the edge is not defined in the schema. func (m *LinkMutation) ResetEdge(name string) error { switch name { case link.EdgeOwner: m.ResetOwner() return nil } return fmt.Errorf("unknown Link edge %s", name) } // UserMutation represents an operation that mutates the User nodes in the graph. type UserMutation struct { config op Op typ string id *uuid.UUID telegram_id *int64 addtelegram_id *int64 clearedFields map[string]struct{} links map[uuid.UUID]struct{} removedlinks map[uuid.UUID]struct{} clearedlinks bool done bool oldValue func(context.Context) (*User, error) predicates []predicate.User } var _ ent.Mutation = (*UserMutation)(nil) // userOption allows management of the mutation configuration using functional options. type userOption func(*UserMutation) // newUserMutation creates new mutation for the User entity. func newUserMutation(c config, op Op, opts ...userOption) *UserMutation { m := &UserMutation{ config: c, op: op, typ: TypeUser, clearedFields: make(map[string]struct{}), } for _, opt := range opts { opt(m) } return m } // withUserID sets the ID field of the mutation. func withUserID(id uuid.UUID) userOption { return func(m *UserMutation) { var ( err error once sync.Once value *User ) m.oldValue = func(ctx context.Context) (*User, error) { once.Do(func() { if m.done { err = errors.New("querying old values post mutation is not allowed") } else { value, err = m.Client().User.Get(ctx, id) } }) return value, err } m.id = &id } } // withUser sets the old User of the mutation. func withUser(node *User) userOption { return func(m *UserMutation) { m.oldValue = func(context.Context) (*User, error) { return node, nil } m.id = &node.ID } } // Client returns a new `ent.Client` from the mutation. If the mutation was // executed in a transaction (ent.Tx), a transactional client is returned. func (m UserMutation) Client() *Client { client := &Client{config: m.config} client.init() return client } // Tx returns an `ent.Tx` for mutations that were executed in transactions; // it returns an error otherwise. func (m UserMutation) Tx() (*Tx, error) { if _, ok := m.driver.(*txDriver); !ok { return nil, errors.New("ent: mutation is not running in a transaction") } tx := &Tx{config: m.config} tx.init() return tx, nil } // SetID sets the value of the id field. Note that this // operation is only accepted on creation of User entities. func (m *UserMutation) SetID(id uuid.UUID) { m.id = &id } // ID returns the ID value in the mutation. Note that the ID is only available // if it was provided to the builder or after it was returned from the database. func (m *UserMutation) ID() (id uuid.UUID, exists bool) { if m.id == nil { return } return *m.id, true } // IDs queries the database and returns the entity ids that match the mutation's predicate. // That means, if the mutation is applied within a transaction with an isolation level such // as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated // or updated by the mutation. func (m *UserMutation) IDs(ctx context.Context) ([]uuid.UUID, error) { switch { case m.op.Is(OpUpdateOne | OpDeleteOne): id, exists := m.ID() if exists { return []uuid.UUID{id}, nil } fallthrough case m.op.Is(OpUpdate | OpDelete): return m.Client().User.Query().Where(m.predicates...).IDs(ctx) default: return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } } // SetTelegramID sets the "telegram_id" field. func (m *UserMutation) SetTelegramID(i int64) { m.telegram_id = &i m.addtelegram_id = nil } // TelegramID returns the value of the "telegram_id" field in the mutation. func (m *UserMutation) TelegramID() (r int64, exists bool) { v := m.telegram_id if v == nil { return } return *v, true } // OldTelegramID returns the old "telegram_id" field's value of the User entity. // If the User object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. func (m *UserMutation) OldTelegramID(ctx context.Context) (v int64, err error) { if !m.op.Is(OpUpdateOne) { return v, errors.New("OldTelegramID is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { return v, errors.New("OldTelegramID requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { return v, fmt.Errorf("querying old value for OldTelegramID: %w", err) } return oldValue.TelegramID, nil } // AddTelegramID adds i to the "telegram_id" field. func (m *UserMutation) AddTelegramID(i int64) { if m.addtelegram_id != nil { *m.addtelegram_id += i } else { m.addtelegram_id = &i } } // AddedTelegramID returns the value that was added to the "telegram_id" field in this mutation. func (m *UserMutation) AddedTelegramID() (r int64, exists bool) { v := m.addtelegram_id if v == nil { return } return *v, true } // ResetTelegramID resets all changes to the "telegram_id" field. func (m *UserMutation) ResetTelegramID() { m.telegram_id = nil m.addtelegram_id = nil } // AddLinkIDs adds the "links" edge to the Link entity by ids. func (m *UserMutation) AddLinkIDs(ids ...uuid.UUID) { if m.links == nil { m.links = make(map[uuid.UUID]struct{}) } for i := range ids { m.links[ids[i]] = struct{}{} } } // ClearLinks clears the "links" edge to the Link entity. func (m *UserMutation) ClearLinks() { m.clearedlinks = true } // LinksCleared reports if the "links" edge to the Link entity was cleared. func (m *UserMutation) LinksCleared() bool { return m.clearedlinks } // RemoveLinkIDs removes the "links" edge to the Link entity by IDs. func (m *UserMutation) RemoveLinkIDs(ids ...uuid.UUID) { if m.removedlinks == nil { m.removedlinks = make(map[uuid.UUID]struct{}) } for i := range ids { delete(m.links, ids[i]) m.removedlinks[ids[i]] = struct{}{} } } // RemovedLinks returns the removed IDs of the "links" edge to the Link entity. func (m *UserMutation) RemovedLinksIDs() (ids []uuid.UUID) { for id := range m.removedlinks { ids = append(ids, id) } return } // LinksIDs returns the "links" edge IDs in the mutation. func (m *UserMutation) LinksIDs() (ids []uuid.UUID) { for id := range m.links { ids = append(ids, id) } return } // ResetLinks resets all changes to the "links" edge. func (m *UserMutation) ResetLinks() { m.links = nil m.clearedlinks = false m.removedlinks = nil } // Where appends a list predicates to the UserMutation builder. func (m *UserMutation) Where(ps ...predicate.User) { m.predicates = append(m.predicates, ps...) } // WhereP appends storage-level predicates to the UserMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. func (m *UserMutation) WhereP(ps ...func(*sql.Selector)) { p := make([]predicate.User, len(ps)) for i := range ps { p[i] = ps[i] } m.Where(p...) } // Op returns the operation name. func (m *UserMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. func (m *UserMutation) SetOp(op Op) { m.op = op } // Type returns the node type of this mutation (User). func (m *UserMutation) Type() string { return m.typ } // Fields returns all fields that were changed during this mutation. Note that in // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *UserMutation) Fields() []string { fields := make([]string, 0, 1) if m.telegram_id != nil { fields = append(fields, user.FieldTelegramID) } return fields } // Field returns the value of a field with the given name. The second boolean // return value indicates that this field was not set, or was not defined in the // schema. func (m *UserMutation) Field(name string) (ent.Value, bool) { switch name { case user.FieldTelegramID: return m.TelegramID() } return nil, false } // OldField returns the old value of the field from the database. An error is // returned if the mutation operation is not UpdateOne, or the query to the // database failed. func (m *UserMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case user.FieldTelegramID: return m.OldTelegramID(ctx) } return nil, fmt.Errorf("unknown User field %s", name) } // SetField sets the value of a field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. func (m *UserMutation) SetField(name string, value ent.Value) error { switch name { case user.FieldTelegramID: v, ok := value.(int64) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetTelegramID(v) return nil } return fmt.Errorf("unknown User field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. func (m *UserMutation) AddedFields() []string { var fields []string if m.addtelegram_id != nil { fields = append(fields, user.FieldTelegramID) } return fields } // AddedField returns the numeric value that was incremented/decremented on a field // with the given name. The second boolean return value indicates that this field // was not set, or was not defined in the schema. func (m *UserMutation) AddedField(name string) (ent.Value, bool) { switch name { case user.FieldTelegramID: return m.AddedTelegramID() } return nil, false } // AddField adds the value to the field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. func (m *UserMutation) AddField(name string, value ent.Value) error { switch name { case user.FieldTelegramID: v, ok := value.(int64) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.AddTelegramID(v) return nil } return fmt.Errorf("unknown User numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. func (m *UserMutation) ClearedFields() []string { return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. func (m *UserMutation) FieldCleared(name string) bool { _, ok := m.clearedFields[name] return ok } // ClearField clears the value of the field with the given name. It returns an // error if the field is not defined in the schema. func (m *UserMutation) ClearField(name string) error { return fmt.Errorf("unknown User nullable field %s", name) } // ResetField resets all changes in the mutation for the field with the given name. // It returns an error if the field is not defined in the schema. func (m *UserMutation) ResetField(name string) error { switch name { case user.FieldTelegramID: m.ResetTelegramID() return nil } return fmt.Errorf("unknown User field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. func (m *UserMutation) AddedEdges() []string { edges := make([]string, 0, 1) if m.links != nil { edges = append(edges, user.EdgeLinks) } return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. func (m *UserMutation) AddedIDs(name string) []ent.Value { switch name { case user.EdgeLinks: ids := make([]ent.Value, 0, len(m.links)) for id := range m.links { ids = append(ids, id) } return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *UserMutation) RemovedEdges() []string { edges := make([]string, 0, 1) if m.removedlinks != nil { edges = append(edges, user.EdgeLinks) } return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. func (m *UserMutation) RemovedIDs(name string) []ent.Value { switch name { case user.EdgeLinks: ids := make([]ent.Value, 0, len(m.removedlinks)) for id := range m.removedlinks { ids = append(ids, id) } return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *UserMutation) ClearedEdges() []string { edges := make([]string, 0, 1) if m.clearedlinks { edges = append(edges, user.EdgeLinks) } return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. func (m *UserMutation) EdgeCleared(name string) bool { switch name { case user.EdgeLinks: return m.clearedlinks } return false } // ClearEdge clears the value of the edge with the given name. It returns an error // if that edge is not defined in the schema. func (m *UserMutation) ClearEdge(name string) error { switch name { } return fmt.Errorf("unknown User unique edge %s", name) } // ResetEdge resets all changes to the edge with the given name in this mutation. // It returns an error if the edge is not defined in the schema. func (m *UserMutation) ResetEdge(name string) error { switch name { case user.EdgeLinks: m.ResetLinks() return nil } return fmt.Errorf("unknown User edge %s", name) }