db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

func GetDbConnection

func GetDbConnection() *gorm.DB

Types

type AppResourceMessagesDBModel

type AppResourceMessagesDBModel struct {
	gorm.Model
	ID              uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	AppID           uuid.UUID `gorm:"type:uuid;column:app_id;"`
	ResourceID      uuid.UUID `gorm:"type:uuid;column:resource_id;"`
	MessageID       uuid.UUID `gorm:"type:uuid;column:message_id;"`
	CreatedByUserID uuid.UUID `gorm:"type:uuid;column:created_by_user_id;"`
	Status          string    `gorm:"column:status;type:varchar(30);not null;default:'active'"`
	Direction       string    `gorm:"column:direction;type:varchar(30);default null;"`
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

AppResourceMessagesDBModel represents the apps_resources_messages table

func (AppResourceMessagesDBModel) TableName

func (AppResourceMessagesDBModel) TableName() string

type AppsDBModel

type AppsDBModel struct {
	gorm.Model
	ID              uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	CreatedByUserID uuid.UUID `gorm:"type:uuid;column:created_by_user_id;"`
	ProjectID       uuid.UUID `gorm:"type:uuid;column:project_id;uniqueIndex:idx_unique_app_name,where:status = 'active'"`
	Name            string    `gorm:"column:name;type:varchar(45);not null;uniqueIndex:idx_unique_app_name,where:status = 'active'"`
	Description     string    `gorm:"column:description;type:text;default null"`
	Status          string    `gorm:"column:status;type:varchar(30);not null;default:'active'"`
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

func (AppsDBModel) CanCreate

func (a AppsDBModel) CanCreate(projectID uuid.UUID, name string) (bool, error)

func (AppsDBModel) TableName

func (AppsDBModel) TableName() string

type MessagesDBModel

type MessagesDBModel struct {
	gorm.Model
	ID            uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	ProjectID     uuid.UUID `gorm:"type:uuid;column:project_id;uniqueIndex:idx_unique_message_name,where:status = 'active'"`
	Name          string    `gorm:"column:name;type:varchar(45);not null;uniqueIndex:idx_unique_message_name,where:status = 'active'"`
	Description   string    `gorm:"column:description;type:text;default null"`
	Status        string    `gorm:"column:status;type:varchar(30);not null;default:'active'"`
	SchemaID      uuid.UUID `gorm:"type:uuid;column:schema_id;"`
	SchemaVersion int       `gorm:"column:schema_version;type:int;not null;default:1;"`
	CreatedByID   uuid.UUID `gorm:"type:uuid;column:created_by_id;"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (MessagesDBModel) TableName

func (MessagesDBModel) TableName() string

type ProjectsDBModel

type ProjectsDBModel struct {
	gorm.Model
	ID            uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	CreatedByType string    `` /* 131-byte string literal not displayed */
	CreatedByID   uuid.UUID `gorm:"type:uuid;column:created_by_id;uniqueIndex:idx_unique_project_name,where:status = 'active'"`
	Name          string    `gorm:"column:name;type:varchar(45);not null;uniqueIndex:idx_unique_project_name,where:status = 'active'"`
	Description   string    `gorm:"column:description;type:text;default null"`
	IsPrivate     bool      `gorm:"column:is_private;type:bool;default:false;not null"`
	Status        string    `gorm:"column:status;type:varchar(30);not null;default:'active'"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (ProjectsDBModel) TableName

func (ProjectsDBModel) TableName() string

type ResourceBindingsDBModel

type ResourceBindingsDBModel struct {
	gorm.Model
	ID               uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	SourceResourceID uuid.UUID `gorm:"column:source_resource_id;type:uuid;not null;uniqueIndex:idx_unique_binding"`
	TargetResourceID uuid.UUID `gorm:"column:target_resource_id;type:uuid;not null;uniqueIndex:idx_unique_binding"`
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

func (ResourceBindingsDBModel) TableName

func (ResourceBindingsDBModel) TableName() string

type ResourcesDBModel

type ResourcesDBModel struct {
	gorm.Model
	ID              uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	ServerID        uuid.UUID `gorm:"type:uuid;not null;uniqueIndex:idx_unique_resource,where:status='active'"`
	Mode            string    `gorm:"column:mode;type:varchar(20);default:'readwrite';uniqueIndex:idx_unique_resource,where:status='active'"`
	ResourceType    string    `gorm:"column:resource_type;type:varchar(30);not null;uniqueIndex:idx_unique_resource,where:status='active'"`
	Description     string    `gorm:"column:description;type:text;default null"`
	Status          string    `gorm:"column:status;type:varchar(30);not null;default:'active'"`
	Name            string    `gorm:"column:name;type:varchar(100);not null;uniqueIndex:idx_unique_resource,where:status='active'"`
	ProjectID       uuid.UUID `gorm:"type:uuid;column:project_id;"`
	CreatedByUserID uuid.UUID `gorm:"type:uuid;column:created_by_user_id;"`
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

func (ResourcesDBModel) TableName

func (ResourcesDBModel) TableName() string

type SchemaVersionsDBModel

type SchemaVersionsDBModel struct {
	gorm.Model
	ID        uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	SchemaID  uuid.UUID `gorm:"type:uuid;column:schema_id;"`
	UserID    uuid.UUID `gorm:"type:uuid;column:user_id;"`
	Version   int       `gorm:"column:version;type:int;not null;default:1;"`
	Schema    string    `gorm:"column:schema;type:text;not null"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (SchemaVersionsDBModel) TableName

func (SchemaVersionsDBModel) TableName() string

type SchemasDBModel

type SchemasDBModel struct {
	gorm.Model
	ID            uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	ProjectID     uuid.UUID `gorm:"project_id:uuid;column:project_id;uniqueIndex:idx_unique_schema_name,where:status = 'active'"`
	CreatedByType string    `gorm:"column:created_by_type;type:varchar(45);not null; default:'user'"`
	CreatedByID   uuid.UUID `gorm:"type:uuid;column:created_by_id;"`
	Name          string    `gorm:"column:name;type:varchar(45);not null;uniqueIndex:idx_unique_schema_name,where:status = 'active'"`
	Description   string    `gorm:"column:description;type:text;default null"`
	Status        string    `gorm:"column:status;type:varchar(30);not null;default:'active'"`
	Type          string    `gorm:"column:type;type:varchar(30);not null;default:'jsonschema'"`
	Schema        string    `gorm:"column:schema;type:text;not null"`
	Version       int       `gorm:"column:version;type:int;not null;default:1;"`
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (SchemasDBModel) CanCreate

func (s SchemasDBModel) CanCreate(projectID uuid.UUID, name string) (bool, error)

func (SchemasDBModel) TableName

func (SchemasDBModel) TableName() string

type ServersDBModel

type ServersDBModel struct {
	gorm.Model
	ID              uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	Name            string    `gorm:"column:name;type:varchar(45);not null;uniqueIndex:idx_server_name_project,where:status='active'"`
	Protocol        string    `gorm:"column:protocol;type:varchar(50);not null"`
	ProjectID       uuid.UUID `gorm:"type:uuid;column:project_id;uniqueIndex:idx_server_name_project,where:status='active'"`
	CreatedByUserID uuid.UUID `gorm:"type:uuid;column:created_by_user_id;"`
	Description     string    `gorm:"column:description;type:text;default null"`
	Status          string    `gorm:"column:status;type:varchar(30);not null;default:'active'"`
	CreatedAt       time.Time
	UpdatedAt       time.Time
}

func (ServersDBModel) TableName

func (ServersDBModel) TableName() string

type UsersDBModel

type UsersDBModel struct {
	gorm.Model
	ID           uuid.UUID `gorm:"type:uuid;default:uuid_generate_v4();primary_key;"`
	Handle       string    `gorm:"column:handle;type:varchar(30);not null;uniqueIndex:unique_handle"`
	Status       string    `gorm:"column:status;type:varchar(30);not null"`
	Email        string    `gorm:"column:email;uniqueIndex:unique_email;default null"`
	PasswordHash string    `gorm:"column:password;default null"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (UsersDBModel) TableName

func (UsersDBModel) TableName() string

Jump to

Keyboard shortcuts

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