cache

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func New

func New(m *model.Model) *Cache

New, create new model cache instance.

func (*Cache) Diff added in v0.0.13

func (c *Cache) Diff(other *model.Model) *diff.Diff

Returns a diff struct resulted between the old and the new model.

func (*Cache) ExpandPermission

func (c *Cache) ExpandPermission(on model.ObjectName, pn model.PermissionName) []model.RelationName

ExpandPermission returns list of relations which cover the given permission for the given object type.

func (*Cache) ExpandRelation

func (c *Cache) ExpandRelation(on model.ObjectName, rn model.RelationName) []model.RelationName

ExpandRelation, returns list of relations which are a union of the given relation. For example, when a writer relation inherits reader, the expansion of a reader = reader + writer.

func (*Cache) GetObjectType

func (c *Cache) GetObjectType(objectType string) (*dsc2.ObjectType, error)

GetObjectType, v2 backwards-compatibility accessor function, returns v2 ObjectType by name.

func (*Cache) GetObjectTypes

func (c *Cache) GetObjectTypes() (ObjectTypeSlice, error)

GetObjectTypes, v2 backwards-compatibility accessor function, returns list of v2.ObjectType instances.

func (*Cache) GetPermission

func (c *Cache) GetPermission(permission string) (*dsc2.Permission, error)

GetPermission, v2 backwards-compatibility accessor function, returns v2 Permission by permission name.

func (*Cache) GetPermissions

func (c *Cache) GetPermissions() (PermissionSlice, error)

GetPermissions, v2 backwards-compatibility accessor function, returns list of v2 Permission instances.

func (*Cache) GetRelationType

func (c *Cache) GetRelationType(objectType, relation string) (*dsc2.RelationType, error)

GetRelationType, v2 backwards-compatibility accessor function, returns v2 RelationType by object type and relation name.

func (*Cache) GetRelationTypes

func (c *Cache) GetRelationTypes(objectType string) (RelationTypeSlice, error)

GetRelationTypes, v2 backwards-compatibility accessor function, returns list of v2 RelationType instances, optionally filtered by by object type.

func (*Cache) ObjectExists

func (c *Cache) ObjectExists(on model.ObjectName) bool

ObjectExists, checks if given object type name exists in the model cache.

func (*Cache) PermissionExists

func (c *Cache) PermissionExists(on model.ObjectName, pn model.PermissionName) bool

PermissionExists, checks if given permission, for the given object type, exists in the model cache.

func (*Cache) RelationExists

func (c *Cache) RelationExists(on model.ObjectName, rn model.RelationName) bool

RelationExists, checks if given relation type, for the given object type, exists in the model cache.

func (*Cache) UpdateModel

func (c *Cache) UpdateModel(m *model.Model) error

UpdateModel, swaps the cache model instance.

type ObjectTypeSlice added in v0.0.4

type ObjectTypeSlice []*dsc2.ObjectType

func (ObjectTypeSlice) Paginate added in v0.0.4

type PermissionSlice added in v0.0.4

type PermissionSlice []*dsc2.Permission

func (PermissionSlice) Paginate added in v0.0.4

type RelationTypeSlice added in v0.0.4

type RelationTypeSlice []*dsc2.RelationType

func (RelationTypeSlice) Paginate added in v0.0.4

Jump to

Keyboard shortcuts

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