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

Method FromString

ketoapi/enc_string.go:79–94  ·  view source on GitHub ↗
(str string)

Source from the content-addressed store, hash-verified

77}
78
79func (s *SubjectSet) FromString(str string) (*SubjectSet, error) {
80 // If there is no '#' we have a subject set without a relation, such as
81 // Users:Bob, which just means that the relation is empty.
82 namespaceAndObject, relation, _ := strings.Cut(str, "#")
83
84 namespace, object, ok := strings.Cut(namespaceAndObject, ":")
85 if !ok {
86 return nil, errors.WithStack(ErrMalformedInput.WithDebug("expected subject set to contain ':'"))
87 }
88
89 return &SubjectSet{
90 Namespace: namespace,
91 Object: object,
92 Relation: relation,
93 }, nil
94}
95
96func (t TreeNodeType) String() string {
97 return string(t)

Callers 7

TestMigrationsFunction · 0.45
tupleFromStringFunction · 0.45
ParseSubjectFunction · 0.45
parseHumanReadableFunction · 0.45
readQueryFromFlagsFunction · 0.45
TestRelationTupleFunction · 0.45
FromStringMethod · 0.45

Calls

no outgoing calls

Tested by 3

TestMigrationsFunction · 0.36
tupleFromStringFunction · 0.36
TestRelationTupleFunction · 0.36