Documentation ¶
Overview ¶
Copyright © 2021 NAME HERE <EMAIL ADDRESS>
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssignColor ¶
func AssignColor(rts []*RelationTuple)
func Dot ¶
func Dot(rts []*RelationTuple) string
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func MergeGroups ¶
func MergeGroups(cg1 *ColorGroup, cg2 *ColorGroup, ColorGroupMap map[string]*ColorGroup)
Merges cg2 into cg1. Also updates the ColorGroupMap.
Types ¶
type ColorGroup ¶
type ColorGroup struct { Color string Group []*RelationTuple }
func NewColorGroup ¶
func NewColorGroup(color string) *ColorGroup
type RelationTuple ¶
type RelationTuple struct { Namespace string `json:"namespace"` Object string `json:"object"` Relation string `json:"relation"` Subject Subject `json:"subject"` Color string }
func (*RelationTuple) FromString ¶
func (r *RelationTuple) FromString(s string) (*RelationTuple, error)
func (RelationTuple) LeftColorID ¶
func (r RelationTuple) LeftColorID() string
Returns the left part of the Namespace+Object+Relation as a string for a colorID
func (RelationTuple) RightColorID ¶
func (r RelationTuple) RightColorID() string
Returns the subjectSet if Subject is a set, empty string otherwise
type Subject ¶
type Subject interface { String() string FromString(string) (Subject, error) Equals(interface{}) bool SubjectID() *string SubjectSet() *SubjectSet }
func SubjectFromString ¶
type SubjectID ¶
type SubjectID struct {
ID string `json:"id"`
}
func (*SubjectID) SubjectSet ¶
func (s *SubjectID) SubjectSet() *SubjectSet
type SubjectSet ¶
type SubjectSet struct { // Namespace of the Subject Set // 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"` }
func (*SubjectSet) Equals ¶
func (s *SubjectSet) Equals(v interface{}) bool
func (*SubjectSet) FromString ¶
func (s *SubjectSet) FromString(str string) (Subject, error)
func (*SubjectSet) String ¶
func (s *SubjectSet) String() string
func (*SubjectSet) SubjectID ¶
func (s *SubjectSet) SubjectID() *string
func (*SubjectSet) SubjectSet ¶
func (s *SubjectSet) SubjectSet() *SubjectSet