Documentation
¶
Index ¶
- Constants
- Variables
- func AreSubjectsEqual(s1, s2 *base.Subject) bool
- func E(e string) (*base.Entity, error)
- func EAR(ear string) (*base.EntityAndRelation, error)
- func EntityAndRelationToString(entityAndRelation *base.EntityAndRelation) string
- func EntityToString(entity *base.Entity) string
- func IsEntityAndSubjectEquals(t *base.Tuple) bool
- func IsRelationComputed(relation string) bool
- func IsSubjectUser(subject *base.Subject) bool
- func IsSubjectValid(subject *base.Subject) bool
- func SetSubjectRelationToEllipsisIfNonUserAndNoRelation(subject *base.Subject) *base.Subject
- func SplitRelation(relation string) (a []string)
- func SubjectToString(subject *base.Subject) 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>" )
const (
ELLIPSIS = "..." // ellipsis string
)
const (
SEPARATOR = "." // separator string used to concatenate entity and relation
)
const (
USER = "user" // type string for user
)
Variables ¶
Functions ¶
func AreSubjectsEqual ¶
AreSubjectsEqual checks if two subjects are equal
func EAR ¶
func EAR(ear string) (*base.EntityAndRelation, error)
EAR parses an EntityAndRelation string and returns an EntityAndRelation object
func EntityAndRelationToString ¶
func EntityAndRelationToString(entityAndRelation *base.EntityAndRelation) string
EntityAndRelationToString converts an EntityAndRelation object to string format
func EntityToString ¶
EntityToString converts an Entity object to string format
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 IsSubjectUser ¶
IsSubjectUser checks if the given subject is of type "user"
func IsSubjectValid ¶
IsSubjectValid checks if a subject is valid or not
func SetSubjectRelationToEllipsisIfNonUserAndNoRelation ¶ added in v0.4.0
SetSubjectRelationToEllipsisIfNonUserAndNoRelation sets the relation of a subject to an ellipsis if the subject is not of type "user" and the relation is empty
func SplitRelation ¶
SplitRelation splits a relation string by the separator "." and returns the result as a slice
func SubjectToString ¶
SubjectToString converts a Subject object to string format
Types ¶
This section is empty.