tuple

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENTITY   = "%s:%s"
	RELATION = "#%s"
)
View Source
const (
	ELLIPSIS = "..."
)
View Source
const (
	SEPARATOR = "."
)
View Source
const (
	USER = "user"
)

Variables

View Source
var (
	ErrInvalidEntity            = errors.New("invalid entity")
	ErrInvalidTuple             = errors.New("invalid tuple")
	ErrInvalidEntityAndRelation = errors.New("invalid entity and relation")
	ErrInvalidQuery             = errors.New("invalid query")
)

Functions

func AreSubjectsEqual

func AreSubjectsEqual(s1, s2 *base.Subject) bool

AreSubjectsEqual -

func E

func E(e string) (*base.Entity, error)

E New Entity from string

func EAR

func EAR(ear string) (*base.EntityAndRelation, error)

EAR EntityAndRelation

func EntityAndRelationToString

func EntityAndRelationToString(entityAndRelation *base.EntityAndRelation) string

EntityAndRelationToString -

func EntityToString

func EntityToString(entity *base.Entity) string

EntityToString -

func IsEntityAndSubjectEquals

func IsEntityAndSubjectEquals(t *base.Tuple) bool

IsEntityAndSubjectEquals -

func IsRelationComputed

func IsRelationComputed(relation string) bool

IsRelationComputed -

func IsSubjectUser

func IsSubjectUser(subject *base.Subject) bool

IsSubjectUser -

func IsSubjectValid

func IsSubjectValid(subject *base.Subject) bool

IsSubjectValid -

func SplitRelation

func SplitRelation(relation string) (a []string)

SplitRelation -

func SubjectToString

func SubjectToString(subject *base.Subject) string

SubjectToString -

func Tuple

func Tuple(tuple string) (*base.Tuple, error)

Tuple -

func ValidateSubject

func ValidateSubject(subject *base.Subject) error

ValidateSubject -

func ValidateSubjectType

func ValidateSubjectType(subject *base.Subject, relationTypes []string) (err error)

ValidateSubjectType -

Types

type Query

type Query struct {
	Subject *base.Subject
	Entity  *base.Entity
	Action  string
}

func NewQueryFromString

func NewQueryFromString(query string) (*Query, error)

NewQueryFromString sample query: can user:1 push repository:1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL