Documentation ¶
Index ¶
- Constants
- Variables
- type CheckOPLSyntaxResponse
- type ExpandNodeType
- type GetNamespacesResponse
- type GetResponse
- type Namespace
- type ParseError
- type PatchAction
- type PatchDelta
- type RelationQuery
- type RelationTuple
- func (r *RelationTuple) Columns() []string
- func (r *RelationTuple) FromDataProvider(d TupleData) (*RelationTuple, error)
- func (r *RelationTuple) FromProto(proto *rts.RelationTuple) *RelationTuple
- func (r *RelationTuple) FromString(s string) (*RelationTuple, error)
- func (r *RelationTuple) FromURLQuery(query url.Values) (*RelationTuple, error)
- func (r *RelationTuple) Header() []string
- func (r *RelationTuple) Interface() interface{}
- func (r *RelationTuple) String() string
- func (r *RelationTuple) ToLoggerFields() logrus.Fields
- func (r *RelationTuple) ToProto() *rts.RelationTuple
- func (r *RelationTuple) ToURLQuery() url.Values
- func (r *RelationTuple) Validate() error
- type SourcePosition
- type SubjectSet
- type Tree
- type TreeNodeType
- type TupleData
Constants ¶
View Source
const ( NamespaceKey = "namespace" ObjectKey = "object" RelationKey = "relation" SubjectIDKey = "subject_id" SubjectSetNamespaceKey = "subject_set.namespace" SubjectSetObjectKey = "subject_set.object" SubjectSetRelationKey = "subject_set.relation" )
Variables ¶
View Source
var ( ErrDroppedSubjectKey = herodot.ErrBadRequest.WithDebug(`provide "subject_id" or "subject_set.*"; support for "subject" was dropped`) ErrDuplicateSubject = herodot.ErrBadRequest.WithError("exactly one of subject_set or subject_id has to be provided") ErrIncompleteSubject = herodot.ErrBadRequest.WithError(`incomplete subject, provide "subject_id" or a complete "subject_set.*"`) ErrNilSubject = herodot.ErrBadRequest.WithError("subject is not allowed to be nil").WithDebug("Please provide a subject.") ErrIncompleteTuple = herodot.ErrBadRequest.WithError(`incomplete tuple, provide "namespace", "object", "relation", and a subject`) ErrUnknownNodeType = errors.New("unknown node type") )
View Source
var ErrMalformedInput = herodot.ErrBadRequest.WithError("malformed string input")
View Source
var RelationQueryKeys = []string{ NamespaceKey, ObjectKey, RelationKey, SubjectIDKey, SubjectSetNamespaceKey, SubjectSetObjectKey, SubjectSetRelationKey, "subject", }
Functions ¶
This section is empty.
Types ¶
type CheckOPLSyntaxResponse ¶
type CheckOPLSyntaxResponse struct { // The list of syntax errors // // required: false Errors []*ParseError `json:"errors,omitempty"` }
CheckOPLSyntaxResponse represents the response for an OPL syntax check request.
swagger:model checkOplSyntaxResult
type GetNamespacesResponse ¶
type GetNamespacesResponse struct {
Namespaces []Namespace `json:"namespaces"`
}
Relationship Namespace List
swagger:model relationshipNamespaces
type GetResponse ¶
type GetResponse struct { RelationTuples []*RelationTuple `json:"relation_tuples"` // The opaque token to provide in a subsequent request // to get the next page. It is the empty string iff this is // the last page. NextPageToken string `json:"next_page_token"` }
Paginated Relationship List
swagger:model relationships
type Namespace ¶
type Namespace struct { // Name of the namespace. Name string `json:"name"` }
swagger:model namespace
type ParseError ¶
type ParseError struct { Message string `json:"message"` Start SourcePosition `json:"start"` End SourcePosition `json:"end"` }
type PatchAction ¶
type PatchAction string
swagger:enum PatchAction
const ( ActionInsert PatchAction = "insert" ActionDelete PatchAction = "delete" )
type PatchDelta ¶
type PatchDelta struct { Action PatchAction `json:"action"` RelationTuple *RelationTuple `json:"relation_tuple"` }
Payload for patching a relationship
swagger:model relationshipPatch
type RelationQuery ¶
type RelationQuery struct { // Namespace to query Namespace *string `json:"namespace"` // Object to query Object *string `json:"object"` // Relation to query Relation *string `json:"relation"` // SubjectID to query // // Either SubjectSet or SubjectID can be provided. SubjectID *string `json:"subject_id,omitempty"` // SubjectSet to query // // Either SubjectSet or SubjectID can be provided. // // swagger:allOf SubjectSet *SubjectSet `json:"subject_set,omitempty"` }
Relation Query
swagger:model relationQuery
func (*RelationQuery) FromDataProvider ¶
func (q *RelationQuery) FromDataProvider(d queryData) *RelationQuery
func (*RelationQuery) FromURLQuery ¶
func (q *RelationQuery) FromURLQuery(query url.Values) (*RelationQuery, error)
func (*RelationQuery) ToProto ¶
func (q *RelationQuery) ToProto() *rts.RelationQuery
func (*RelationQuery) ToURLQuery ¶
func (q *RelationQuery) ToURLQuery() url.Values
type RelationTuple ¶
type RelationTuple struct { // Namespace of the Relation Tuple // // required: true Namespace string `json:"namespace"` // Object of the Relation Tuple // // required: true Object string `json:"object"` // Relation of the Relation Tuple // // required: true Relation string `json:"relation"` // SubjectID of the Relation Tuple // // Either SubjectSet or SubjectID can be provided. SubjectID *string `json:"subject_id,omitempty"` // SubjectSet of the Relation Tuple // // Either SubjectSet or SubjectID can be provided. // // swagger:allOf SubjectSet *SubjectSet `json:"subject_set,omitempty"` }
Relationship
swagger:model relationship
func (*RelationTuple) Columns ¶
func (r *RelationTuple) Columns() []string
func (*RelationTuple) FromDataProvider ¶
func (r *RelationTuple) FromDataProvider(d TupleData) (*RelationTuple, error)
func (*RelationTuple) FromProto ¶
func (r *RelationTuple) FromProto(proto *rts.RelationTuple) *RelationTuple
func (*RelationTuple) FromString ¶
func (r *RelationTuple) FromString(s string) (*RelationTuple, error)
func (*RelationTuple) FromURLQuery ¶
func (r *RelationTuple) FromURLQuery(query url.Values) (*RelationTuple, error)
func (*RelationTuple) Header ¶
func (r *RelationTuple) Header() []string
func (*RelationTuple) Interface ¶
func (r *RelationTuple) Interface() interface{}
func (*RelationTuple) String ¶
func (r *RelationTuple) String() string
func (*RelationTuple) ToLoggerFields ¶
func (r *RelationTuple) ToLoggerFields() logrus.Fields
func (*RelationTuple) ToProto ¶
func (r *RelationTuple) ToProto() *rts.RelationTuple
func (*RelationTuple) ToURLQuery ¶
func (r *RelationTuple) ToURLQuery() url.Values
func (*RelationTuple) Validate ¶
func (r *RelationTuple) Validate() error
type SourcePosition ¶
type SubjectSet ¶
type SubjectSet struct { // Namespace of the Subject Set // // required: true Namespace string `json:"namespace"` // Object of the Subject Set // // required: true Object string `json:"object"` // Relation of the Subject Set // // required: true Relation string `json:"relation"` }
swagger:model subjectSet
func (*SubjectSet) FromString ¶
func (s *SubjectSet) FromString(str string) (*SubjectSet, error)
func (*SubjectSet) FromURLQuery ¶
func (s *SubjectSet) FromURLQuery(values url.Values) *SubjectSet
func (*SubjectSet) String ¶
func (s *SubjectSet) String() string
func (*SubjectSet) ToURLQuery ¶
func (s *SubjectSet) ToURLQuery() url.Values
type Tree ¶
type Tree[T tuple[T]] struct { // Propagate all struct changes to `swaggerOnlyExpandTree` as well. // The type of the node. // // required: true Type TreeNodeType `json:"type"` // The children of the node, possibly none. Children []*Tree[T] `json:"children,omitempty"` // The relation tuple the node represents. Tuple T `json:"tuple"` }
Tree is a generic tree of either internal relationships (with UUIDs for objects, etc.) or API relationships (with strings for objects, etc.).
func TreeFromProto ¶
func TreeFromProto[T tuple[T]](pt *rts.SubjectTree) *Tree[T]
func (*Tree[NodeT]) ToProto ¶
func (t *Tree[NodeT]) ToProto() *rts.SubjectTree
type TreeNodeType ¶
type TreeNodeType string
swagger:enum TreeNodeType
const ( TreeNodeUnion TreeNodeType = "union" TreeNodeExclusion TreeNodeType = "exclusion" TreeNodeIntersection TreeNodeType = "intersection" TreeNodeLeaf TreeNodeType = "leaf" TreeNodeTupleToSubjectSet TreeNodeType = "tuple_to_subject_set" TreeNodeComputedSubjectSet TreeNodeType = "computed_subject_set" TreeNodeNot TreeNodeType = "not" TreeNodeUnspecified TreeNodeType = "unspecified" )
func (TreeNodeType) FromProto ¶
func (TreeNodeType) FromProto(pt rts.NodeType) TreeNodeType
func (TreeNodeType) String ¶
func (t TreeNodeType) String() string
func (TreeNodeType) ToProto ¶
func (t TreeNodeType) ToProto() rts.NodeType
func (*TreeNodeType) UnmarshalJSON ¶
func (t *TreeNodeType) UnmarshalJSON(v []byte) error
Click to show internal directories.
Click to hide internal directories.