InstallObject installs the given Object type into the schema, or returns the previously installed type if it was already present
(class ObjectType, directives ...*ast.Directive)
| 533 | // InstallObject installs the given Object type into the schema, or returns the |
| 534 | // previously installed type if it was already present |
| 535 | func (s *Server) InstallObject(class ObjectType, directives ...*ast.Directive) ObjectType { |
| 536 | s.installLock.Lock() |
| 537 | |
| 538 | if class, ok := s.objects[class.TypeName()]; ok { |
| 539 | s.installLock.Unlock() |
| 540 | return class |
| 541 | } |
| 542 | |
| 543 | s.invalidateSchemaCache() |
| 544 | |
| 545 | s.objects[class.TypeName()] = class |
| 546 | s.interfacesDirty = true |
| 547 | s.installLock.Unlock() |
| 548 | |
| 549 | for _, hook := range s.installHooks { |
| 550 | hook.InstallObject(class, directives...) |
| 551 | } |
| 552 | |
| 553 | return class |
| 554 | } |
| 555 | |
| 556 | // markInterfacesDirty flags interface inference as stale, so it re-runs on the |
| 557 | // next read of the type system (see reconcileInterfaceImplsIfDirty). Install |