models

package
v3.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BehaviorSettings

type BehaviorSettings struct {
	ID               uint   `gorm:"primaryKey;autoIncrement"`
	AccountID        string `gorm:"type:varchar(255);not null;uniqueIndex:idx_behavior_acct_type"`
	TypeSlug         string `gorm:"type:varchar(255);not null;uniqueIndex:idx_behavior_acct_type"`
	EnabledBehaviors string `gorm:"type:text;not null;default:'[]'"` // JSON array of behavior slugs
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

BehaviorSettings stores which behaviors are enabled for a resource type within a specific account. When no row exists, the preset defaults apply.

func (BehaviorSettings) TableName

func (BehaviorSettings) TableName() string

type Resource

type Resource struct {
	ID         string `gorm:"primaryKey"`
	TypeSlug   string `gorm:"not null;index"`
	Data       string `gorm:"type:text"`
	Status     string `gorm:"not null;default:active"`
	CreatedBy  string `gorm:"index"`
	AccountID  string `gorm:"index"`
	SequenceNo int
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  *time.Time `gorm:"index"`
}

func FromResource

func FromResource(e *entities.Resource) *Resource

func (Resource) TableName

func (m Resource) TableName() string

func (*Resource) ToResource

func (m *Resource) ToResource() (*entities.Resource, error)

type ResourcePermission

type ResourcePermission struct {
	ID         string `gorm:"primaryKey"`
	ResourceID string `gorm:"not null;uniqueIndex:idx_rp_resource_agent"`
	AgentID    string `gorm:"not null;uniqueIndex:idx_rp_resource_agent"`
	Actions    string `gorm:"type:text"` // JSON array: ["read","modify"]
	GrantedBy  string `gorm:"not null"`
	GrantedAt  time.Time
}

ResourcePermission is the GORM model for instance-level resource permissions.

func (ResourcePermission) TableName

func (m ResourcePermission) TableName() string

func (*ResourcePermission) ToEntity

type ResourceType

type ResourceType struct {
	ID          string `gorm:"primaryKey"`
	Name        string `gorm:"not null"`
	Slug        string `gorm:"not null;uniqueIndex"`
	Description string `gorm:"type:text"`
	Context     string `gorm:"type:text"`
	Schema      string `gorm:"type:text"`
	Status      string `gorm:"not null;default:active"`
	SequenceNo  int
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time `gorm:"index"`
}

func FromResourceType

func FromResourceType(e *entities.ResourceType) *ResourceType

func (ResourceType) TableName

func (m ResourceType) TableName() string

func (*ResourceType) ToResourceType

func (m *ResourceType) ToResourceType() (*entities.ResourceType, error)

type RoleResourceAccess

type RoleResourceAccess struct {
	ID        uint   `gorm:"primaryKey;autoIncrement"`
	Access    string `gorm:"type:text"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

RoleResourceAccess stores the role→resource-type access configuration as JSON. The Access column is a JSON object mapping role names to their per-resource-type allowed ODRL actions: {"instructor": {"enrollment": ["read","modify"], "invoice": ["read"]}}.

func (RoleResourceAccess) TableName

func (RoleResourceAccess) TableName() string

type RoleSettings

type RoleSettings struct {
	ID        uint   `gorm:"primaryKey;autoIncrement"`
	Roles     string `gorm:"type:text"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (RoleSettings) TableName

func (RoleSettings) TableName() string

type SidebarSettings

type SidebarSettings struct {
	ID          uint   `gorm:"primaryKey;autoIncrement"`
	Role        string `gorm:"type:varchar(100);uniqueIndex;default:default"`
	HiddenSlugs string `gorm:"type:text"`
	MenuGroups  string `gorm:"type:text"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (SidebarSettings) TableName

func (SidebarSettings) TableName() string

type Triple

type Triple struct {
	Subject   string    `gorm:"primaryKey;not null;index:idx_triples_sub;index:idx_triples_sp"`
	Predicate string    `gorm:"primaryKey;not null;index:idx_triples_sp;index:idx_triples_po"`
	Object    string    `gorm:"primaryKey;not null;index:idx_triples_obj;index:idx_triples_po"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
}

Triple stores an RDF triple relationship in the database.

func (Triple) TableName

func (Triple) TableName() string

Jump to

Keyboard shortcuts

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