()
| 59 | } |
| 60 | |
| 61 | func (r *RelationTuple) ToInternal() *relationtuple.RelationTuple { |
| 62 | if r == nil { |
| 63 | return nil |
| 64 | } |
| 65 | |
| 66 | rt := &relationtuple.RelationTuple{ |
| 67 | Relation: r.Relation, |
| 68 | Object: r.Object, |
| 69 | Namespace: r.Namespace, |
| 70 | } |
| 71 | |
| 72 | if r.SubjectID.Valid { |
| 73 | rt.Subject = &relationtuple.SubjectID{ |
| 74 | ID: r.SubjectID.UUID, |
| 75 | } |
| 76 | } else { |
| 77 | rt.Subject = &relationtuple.SubjectSet{ |
| 78 | Namespace: r.SubjectSetNamespace.String, |
| 79 | Object: r.SubjectSetObject.UUID, |
| 80 | Relation: r.SubjectSetRelation.String, |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | return rt |
| 85 | } |
| 86 | |
| 87 | func (r *RelationTuple) insertSubject(s relationtuple.Subject) error { |
| 88 | switch st := s.(type) { |
no outgoing calls
no test coverage detected