WalkRewrite is a method that walks through the rewrite part of the schema
( entityType string, rewrite *base.Rewrite, )
| 78 | |
| 79 | // WalkRewrite is a method that walks through the rewrite part of the schema |
| 80 | func (w *Walker) WalkRewrite( |
| 81 | entityType string, |
| 82 | rewrite *base.Rewrite, |
| 83 | ) error { |
| 84 | // Loop through each child in the rewrite |
| 85 | for _, child := range rewrite.GetChildren() { |
| 86 | // Switch on the type of the child |
| 87 | switch child.GetType().(type) { |
| 88 | case *base.Child_Rewrite: |
| 89 | if err := w.WalkRewrite(entityType, child.GetRewrite()); err != nil { |
| 90 | return err |
| 91 | } |
| 92 | case *base.Child_Leaf: |
| 93 | if err := w.WalkLeaf(entityType, child.GetLeaf()); err != nil { |
| 94 | return err |
| 95 | } |
| 96 | default: |
| 97 | // For any other child type, return an error indicating an undefined child type |
| 98 | return errors.New(base.ErrorCode_ERROR_CODE_UNDEFINED_CHILD_KIND.String()) |
| 99 | } |
| 100 | } |
| 101 | // If no errors occurred during the loop, return nil |
| 102 | return nil |
| 103 | } |
| 104 | |
| 105 | // WalkComputedUserSet walk the relation within the ComputedUserSet for the given entityType. |
| 106 | func (w *Walker) WalkComputedUserSet( |
no test coverage detected