Documentation ¶
Index ¶
- Constants
- Variables
- func AreQueryAndSubjectEqual(en *base.Entity, permission string, s2 *base.Subject) bool
- func AreRelationReferencesEqual(s1, s2 *base.RelationReference) bool
- func AreSubjectsEqual(s1, s2 *base.Subject) bool
- func E(e string) (*base.Entity, error)
- func EAR(ear string) (*base.EntityAndRelation, error)
- func EAREqual(s1, s2 *base.EntityAndRelation) bool
- func EntityAndRelationToString(entity *base.Entity, relation string) string
- func EntityToString(entity *base.Entity) string
- func IsDirectSubject(subject *base.Subject) bool
- func IsEntityAndSubjectEquals(t *base.Tuple) bool
- func IsRelationComputed(relation string) bool
- func IsSubjectValid(subject *base.Subject) bool
- func NormalizeRelation(relation string) string
- func ReferenceToString(ref *base.RelationReference) string
- func RelationReference(ref string) *base.RelationReference
- func SplitRelation(relation string) (a []string)
- func SubjectToEAR(subject *base.Subject) *base.EntityAndRelation
- func SubjectToString(subject *base.Subject) string
- func ToString(tup *base.Tuple) string
- func Tuple(tuple string) (*base.Tuple, error)
- func ValidateSubjectType(subject *base.Subject, relationTypes []string) (err error)
Constants ¶
const ( ENTITY = "%s:%s" // format string for entity in the form of "<type>:<id>" RELATION = "#%s" // format string for relation in the form of "#<relation>" REFERENCE = "%s#%s" // format string for reference in the form of "<type>#<relation>" )
const (
ELLIPSIS = "..." // ellipsis string
)
const (
SEPARATOR = "." // separator string used to concatenate entity and relation
)
Variables ¶
Functions ¶
func AreQueryAndSubjectEqual ¶ added in v0.5.0
AreQueryAndSubjectEqual checks if a query and a subject are equal
func AreRelationReferencesEqual ¶ added in v0.4.2
func AreRelationReferencesEqual(s1, s2 *base.RelationReference) bool
AreRelationReferencesEqual checks if two relation references are equal or not
func AreSubjectsEqual ¶
AreSubjectsEqual checks if two subjects are equal
func EAR ¶
func EAR(ear string) (*base.EntityAndRelation, error)
EAR function parses a string to create a base.EntityAndRelation object.
func EAREqual ¶ added in v0.4.6
func EAREqual(s1, s2 *base.EntityAndRelation) bool
EAREqual checks if two subjects are equal
func EntityAndRelationToString ¶
EntityAndRelationToString converts an EntityAndRelation object to string format
func EntityToString ¶
EntityToString converts an Entity object to string format
func IsDirectSubject ¶ added in v0.4.6
IsDirectSubject checks if the given subject is of type "user"
func IsEntityAndSubjectEquals ¶
IsEntityAndSubjectEquals checks if the entity and subject of a Tuple object are equal
func IsRelationComputed ¶
IsRelationComputed checks if a relation is computed or not
func IsSubjectValid ¶
IsSubjectValid checks if a subject is valid or not
func NormalizeRelation ¶ added in v0.4.6
NormalizeRelation normalizes the relation, treating ellipsis as an empty string
func ReferenceToString ¶ added in v0.4.2
func ReferenceToString(ref *base.RelationReference) string
ReferenceToString -
func RelationReference ¶ added in v0.4.2
func RelationReference(ref string) *base.RelationReference
RelationReference parses a relation reference string and returns a RelationReference object.
func SplitRelation ¶
SplitRelation splits a relation string by the separator "." and returns the result as a slice
func SubjectToEAR ¶ added in v0.4.6
func SubjectToEAR(subject *base.Subject) *base.EntityAndRelation
SubjectToEAR converts a Subject object to an EntityAndRelation object
func SubjectToString ¶
SubjectToString converts a Subject object to string format.
Types ¶
This section is empty.