Documentation ¶
Overview ¶
Package repository provides the APIs for making resource_type related database interactions.
Index ¶
- func FilterByResourceTypeID(id uuid.UUID) func(db *gorm.DB) *gorm.DB
- func FilterByScopeName(name string) func(db *gorm.DB) *gorm.DB
- type GormResourceTypeRepository
- func (m *GormResourceTypeRepository) Create(ctx context.Context, u *ResourceType) error
- func (m *GormResourceTypeRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (m *GormResourceTypeRepository) List(ctx context.Context) ([]ResourceType, error)
- func (m *GormResourceTypeRepository) Load(ctx context.Context, id uuid.UUID) (*ResourceType, error)
- func (m *GormResourceTypeRepository) Lookup(ctx context.Context, name string) (*ResourceType, error)
- func (m *GormResourceTypeRepository) Save(ctx context.Context, model *ResourceType) error
- func (m *GormResourceTypeRepository) TableName() string
- type GormResourceTypeScopeRepository
- func (m *GormResourceTypeScopeRepository) CheckExists(ctx context.Context, id string) (bool, error)
- func (m *GormResourceTypeScopeRepository) Create(ctx context.Context, u *ResourceTypeScope) error
- func (m *GormResourceTypeScopeRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (m *GormResourceTypeScopeRepository) List(ctx context.Context, resourceType *ResourceType) ([]ResourceTypeScope, error)
- func (m *GormResourceTypeScopeRepository) Load(ctx context.Context, id uuid.UUID) (*ResourceTypeScope, error)
- func (m *GormResourceTypeScopeRepository) LookupByResourceTypeAndScope(ctx context.Context, resourceTypeID uuid.UUID, name string) (*ResourceTypeScope, error)
- func (m *GormResourceTypeScopeRepository) LookupForType(ctx context.Context, resourceTypeID uuid.UUID) ([]ResourceTypeScope, error)
- func (m *GormResourceTypeScopeRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]ResourceTypeScope, error)
- func (m *GormResourceTypeScopeRepository) Save(ctx context.Context, model *ResourceTypeScope) error
- func (m *GormResourceTypeScopeRepository) TableName() string
- type ResourceType
- type ResourceTypeRepository
- type ResourceTypeScope
- type ResourceTypeScopeRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterByResourceTypeID ¶
FilterByResourceTypeID is a gorm filter by 'name'
Types ¶
type GormResourceTypeRepository ¶
type GormResourceTypeRepository struct {
// contains filtered or unexported fields
}
GormResourceTypeRepository is the implementation of the storage interface for ResourceType.
func (*GormResourceTypeRepository) Create ¶
func (m *GormResourceTypeRepository) Create(ctx context.Context, u *ResourceType) error
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 ¶
func (m *GormResourceTypeRepository) List(ctx context.Context) ([]ResourceType, error)
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
func (*GormResourceTypeRepository) Lookup ¶
func (m *GormResourceTypeRepository) Lookup(ctx context.Context, name string) (*ResourceType, error)
Lookup looks up the ResourceType record with the specified name. If there is no such record, then a gorm.ErrRecordNotFound error will be returned.
func (*GormResourceTypeRepository) Save ¶
func (m *GormResourceTypeRepository) Save(ctx context.Context, model *ResourceType) error
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 ¶
CheckExists returns nil if the given ID exists otherwise returns an error
func (*GormResourceTypeScopeRepository) Create ¶
func (m *GormResourceTypeScopeRepository) Create(ctx context.Context, u *ResourceTypeScope) error
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 ¶
func (m *GormResourceTypeScopeRepository) List(ctx context.Context, resourceType *ResourceType) ([]ResourceTypeScope, error)
List return all resource type scopes
func (*GormResourceTypeScopeRepository) Load ¶
func (m *GormResourceTypeScopeRepository) Load(ctx context.Context, id uuid.UUID) (*ResourceTypeScope, error)
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) LookupByResourceTypeAndScope ¶
func (m *GormResourceTypeScopeRepository) LookupByResourceTypeAndScope(ctx context.Context, resourceTypeID uuid.UUID, name string) (*ResourceTypeScope, error)
LookupByResourceTypeAndScope returns all resource type scopes filtered by name and scope.
func (*GormResourceTypeScopeRepository) LookupForType ¶
func (m *GormResourceTypeScopeRepository) LookupForType(ctx context.Context, resourceTypeID uuid.UUID) ([]ResourceTypeScope, error)
func (*GormResourceTypeScopeRepository) Query ¶
func (m *GormResourceTypeScopeRepository) Query(funcs ...func(*gorm.DB) *gorm.DB) ([]ResourceTypeScope, error)
Query expose an open ended Query model
func (*GormResourceTypeScopeRepository) Save ¶
func (m *GormResourceTypeScopeRepository) Save(ctx context.Context, model *ResourceTypeScope) error
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 ResourceType ¶
type ResourceType struct { gormsupport.Lifecycle ResourceTypeID uuid.UUID `sql:"type:uuid default uuid_generate_v4()" gorm:"primary_key;column:resource_type_id"` // The resource type name Name string DefaultRoleID *uuid.UUID `sql:"type:string" gorm:"column:default_role_id"` }
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 { Create(ctx context.Context, u *ResourceType) error Lookup(ctx context.Context, name string) (*ResourceType, error) List(ctx context.Context) ([]ResourceType, error) Save(ctx context.Context, u *ResourceType) error Delete(ctx context.Context, ID uuid.UUID) error Load(ctx context.Context, ID uuid.UUID) (*ResourceType, 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;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 }
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) Create(ctx context.Context, u *ResourceTypeScope) error Save(ctx context.Context, u *ResourceTypeScope) error Delete(ctx context.Context, ID uuid.UUID) error Load(ctx context.Context, ID uuid.UUID) (*ResourceTypeScope, error) LookupForType(ctx context.Context, resourceTypeID uuid.UUID) ([]ResourceTypeScope, error) List(ctx context.Context, resourceType *ResourceType) ([]ResourceTypeScope, error) LookupByResourceTypeAndScope(ctx context.Context, resourceTypeID uuid.UUID, scopeName string) (*ResourceTypeScope, error) }
ResourceTypeScopeRepository represents the storage interface.
func NewResourceTypeScopeRepository ¶
func NewResourceTypeScopeRepository(db *gorm.DB) ResourceTypeScopeRepository
NewResourceTypeScopeRepository creates a new storage type.