resource

package
v0.0.0-...-284eadf Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResourceTypeFilterByID

func ResourceTypeFilterByID(resourceTypeID uuid.UUID) func(db *gorm.DB) *gorm.DB

ResourceTypeFilterByID is a gorm filter for Resource Type ID.

Types

type GormResourceRepository

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

GormResourceRepository is the implementation of the storage interface for Resource.

func (*GormResourceRepository) CheckExists

func (m *GormResourceRepository) CheckExists(ctx context.Context, id string) error

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

func (*GormResourceRepository) Create

func (m *GormResourceRepository) Create(ctx context.Context, resource *Resource) error

Create creates a new record.

func (*GormResourceRepository) Delete

func (m *GormResourceRepository) Delete(ctx context.Context, id string) error

Delete removes a single record.

func (*GormResourceRepository) Load

Load returns a single Resource as a Database Model

func (*GormResourceRepository) Save

func (m *GormResourceRepository) Save(ctx context.Context, resource *Resource) error

Save modifies a single record.

func (*GormResourceRepository) TableName

func (m *GormResourceRepository) TableName() string

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

type GormResourceTypeRepository

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

GormResourceTypeRepository is the implementation of the storage interface for ResourceType.

func (*GormResourceTypeRepository) CheckExists

func (m *GormResourceTypeRepository) CheckExists(ctx context.Context, id string) (bool, error)

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

func (*GormResourceTypeRepository) Create

Create creates a new record.

func (*GormResourceTypeRepository) Delete

func (m *GormResourceTypeRepository) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a single record.

func (*GormResourceTypeRepository) List

List return all resource types

func (*GormResourceTypeRepository) Load

func (m *GormResourceTypeRepository) Load(ctx context.Context, id uuid.UUID) (*ResourceType, error)

Load returns a single ResourceType as a Database Model This is more for use internally, and probably not what you want in your controllers

func (*GormResourceTypeRepository) Save

Save modifies a single record

func (*GormResourceTypeRepository) TableName

func (m *GormResourceTypeRepository) TableName() string

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

type GormResourceTypeScopeRepository

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

GormResourceTypeScopeRepository is the implementation of the storage interface for ResourceTypeScope.

func (*GormResourceTypeScopeRepository) CheckExists

func (m *GormResourceTypeScopeRepository) CheckExists(ctx context.Context, id string) (bool, error)

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

func (*GormResourceTypeScopeRepository) Create

Create creates a new record.

func (*GormResourceTypeScopeRepository) Delete

func (m *GormResourceTypeScopeRepository) Delete(ctx context.Context, id uuid.UUID) error

Delete removes a single record.

func (*GormResourceTypeScopeRepository) List

List return all resource type scopes

func (*GormResourceTypeScopeRepository) Load

Load returns a single ResourceTypeScope as a Database Model This is more for use internally, and probably not what you want in your controllers

func (*GormResourceTypeScopeRepository) Save

Save modifies a single record

func (*GormResourceTypeScopeRepository) TableName

func (m *GormResourceTypeScopeRepository) TableName() string

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

type Resource

type Resource struct {
	gormsupport.Lifecycle

	// This is the primary key value
	ResourceID string `sql:"type:string" gorm:"primary_key" gorm:"column:resource_id"`
	// The parent resource
	ParentResource *Resource
	// The owning identity
	Owner account.Identity
	// The resource type
	ResourceType ResourceType
	// Resource description
	Description string
}

func (Resource) GetLastModified

func (m Resource) GetLastModified() time.Time

GetLastModified returns the last modification time

func (Resource) TableName

func (m Resource) TableName() string

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

type ResourceRepository

type ResourceRepository interface {
	repository.Exister
	Load(ctx context.Context, id string) (*Resource, error)
	Create(ctx context.Context, resource *Resource) error
	Save(ctx context.Context, resource *Resource) error
	Delete(ctx context.Context, id string) error
}

ResourceRepository represents the storage interface.

func NewResourceRepository

func NewResourceRepository(db *gorm.DB) ResourceRepository

NewResourceRepository creates a new storage type.

type ResourceType

type ResourceType struct {
	gormsupport.Lifecycle

	ResourceTypeID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key" gorm:"column:resource_type_id"`
	// The resource type name
	Name string
	// The resource type description
	Description string
}

func (ResourceType) GetLastModified

func (m ResourceType) GetLastModified() time.Time

GetLastModified returns the last modification time

func (ResourceType) TableName

func (m ResourceType) TableName() string

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

type ResourceTypeRepository

type ResourceTypeRepository interface {
	CheckExists(ctx context.Context, id string) (bool, error)
	Load(ctx context.Context, ID uuid.UUID) (*ResourceType, error)
	Create(ctx context.Context, u *ResourceType) error
	Save(ctx context.Context, u *ResourceType) error
	List(ctx context.Context) ([]ResourceType, error)
	Delete(ctx context.Context, ID uuid.UUID) error
}

ResourceTypeRepository represents the storage interface.

func NewResourceTypeRepository

func NewResourceTypeRepository(db *gorm.DB) ResourceTypeRepository

NewResourceTypeRepository creates a new storage type.

type ResourceTypeScope

type ResourceTypeScope struct {
	gormsupport.Lifecycle

	// This is the primary key value
	ResourceTypeScopeID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key" gorm:"column:resource_type_scope_id"`
	// The resource type that this scope belongs to
	ResourceType ResourceType `gorm:"ForeignKey:ResourceTypeID;AssociationForeignKey:ResourceTypeID"`
	// The foreign key value for ResourceType
	ResourceTypeID uuid.UUID
	// The name of this scope
	Name string
	// The description of this scope
	Description string
}

func (ResourceTypeScope) GetLastModified

func (m ResourceTypeScope) GetLastModified() time.Time

GetLastModified returns the last modification time

func (ResourceTypeScope) TableName

func (m ResourceTypeScope) TableName() string

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

type ResourceTypeScopeRepository

type ResourceTypeScopeRepository interface {
	CheckExists(ctx context.Context, id string) (bool, error)
	Load(ctx context.Context, ID uuid.UUID) (*ResourceTypeScope, error)
	Create(ctx context.Context, u *ResourceTypeScope) error
	Save(ctx context.Context, u *ResourceTypeScope) error
	List(ctx context.Context, resourceType *ResourceType) ([]ResourceTypeScope, error)
	Delete(ctx context.Context, ID uuid.UUID) error
}

ResourceTypeScopeRepository represents the storage interface.

func NewResourceTypeScopeRepository

func NewResourceTypeScopeRepository(db *gorm.DB) ResourceTypeScopeRepository

NewResourceTypeScopeRepository creates a new storage type.

Jump to

Keyboard shortcuts

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