repository

package
v0.0.0-...-2d73068 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormPrivilegeCacheRepository

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

GormPrivilegeCacheRepository is the implementation of the storage interface for Resource.

func (*GormPrivilegeCacheRepository) CheckExists

func (m *GormPrivilegeCacheRepository) CheckExists(ctx context.Context, privilegeCacheID uuid.UUID) (bool, error)

CheckExists returns true if the given ID exists otherwise returns an error

func (*GormPrivilegeCacheRepository) Create

func (m *GormPrivilegeCacheRepository) Create(ctx context.Context, privilegeCache *PrivilegeCache) error

Create creates a new record.

func (*GormPrivilegeCacheRepository) Delete

func (m *GormPrivilegeCacheRepository) Delete(ctx context.Context, privilegeCacheID uuid.UUID) error

Delete removes a single record.

func (*GormPrivilegeCacheRepository) FindForIdentityResource

func (m *GormPrivilegeCacheRepository) FindForIdentityResource(ctx context.Context, identityID uuid.UUID, resourceID string) (*PrivilegeCache, error)

func (*GormPrivilegeCacheRepository) Load

func (m *GormPrivilegeCacheRepository) Load(ctx context.Context, privilegeCacheID uuid.UUID) (*PrivilegeCache, error)

Load returns a single PrivilegeCache as a Database Model

func (*GormPrivilegeCacheRepository) Save

func (m *GormPrivilegeCacheRepository) Save(ctx context.Context, privilegeCache *PrivilegeCache) error

Save modifies a single record.

func (*GormPrivilegeCacheRepository) TableName

func (m *GormPrivilegeCacheRepository) TableName() string

type PrivilegeCache

type PrivilegeCache struct {
	gormsupport.Lifecycle

	// This is the primary key value
	PrivilegeCacheID uuid.UUID `sql:"type:uuid" gorm:"primary_key;column:privilege_cache_id"`

	IdentityID uuid.UUID `sql:"type:uuid" gorm:"column:identity_id"`

	ResourceID string `sql:"type:string" gorm:"column:resource_id"`

	Scopes string

	Stale bool `sql:"type:boolean"`

	ExpiryTime time.Time
}

func (PrivilegeCache) ScopesAsArray

func (m PrivilegeCache) ScopesAsArray() []string

Returns the scopes as a string array. If scopes is empty, returns an empty array

func (PrivilegeCache) TableName

func (m PrivilegeCache) TableName() string

TableName overrides the table name settings in Gorm to force a specific table name in the database.

type PrivilegeCacheRepository

type PrivilegeCacheRepository interface {
	CheckExists(ctx context.Context, privilegeCacheID uuid.UUID) (bool, error)
	Load(ctx context.Context, privilegeCacheID uuid.UUID) (*PrivilegeCache, error)
	Create(ctx context.Context, cache *PrivilegeCache) error
	Save(ctx context.Context, cache *PrivilegeCache) error
	Delete(ctx context.Context, privilegeCacheID uuid.UUID) error
	FindForIdentityResource(ctx context.Context, identityID uuid.UUID, resourceID string) (*PrivilegeCache, error)
}

PrivilegeCacheRepository represents the storage interface.

func NewPrivilegeCacheRepository

func NewPrivilegeCacheRepository(db *gorm.DB) PrivilegeCacheRepository

NewPrivilegeCacheRepository creates a new storage type.

Jump to

Keyboard shortcuts

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