MCPcopy
hub / github.com/ory/keto / ToInternal

Method ToInternal

internal/persistence/sql/relationtuples.go:61–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59}
60
61func (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
87func (r *RelationTuple) insertSubject(s relationtuple.Subject) error {
88 switch st := s.(type) {

Callers 3

GetRelationTuplesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected