Documentation ¶
Index ¶
- Variables
- func AutoMigrate(db *gorm.DB) error
- func CloseDB(t *testing.T, gdb *gorm.DB)
- func CombineQueryParts(queryParts []string) string
- func GetMockDB() (*gorm.DB, sqlmock.Sqlmock, error)
- func GetModuleQuery(filter *entity.ModuleFilter) (string, []interface{})
- func GetProjectQuery(filter *entity.ProjectFilter) (string, []interface{})
- func GetResourceQuery(filter *entity.ResourceFilter) (string, []interface{})
- func GetRunQuery(filter *entity.RunFilter) (string, []interface{})
- func GetSourceQuery(filter *entity.SourceFilter) (string, []interface{})
- func GetStackQuery(filter *entity.StackFilter) (string, []interface{})
- func GetWorkspaceQuery(filter *entity.WorkspaceFilter) (string, []interface{})
- func NewBackendRepository(db *gorm.DB) repository.BackendRepository
- func NewModuleRepository(db *gorm.DB) repository.ModuleRepository
- func NewOrganizationRepository(db *gorm.DB) repository.OrganizationRepository
- func NewProjectRepository(db *gorm.DB) repository.ProjectRepository
- func NewResourceRepository(db *gorm.DB) repository.ResourceRepository
- func NewRunRepository(db *gorm.DB) repository.RunRepository
- func NewSourceRepository(db *gorm.DB) repository.SourceRepository
- func NewStackRepository(db *gorm.DB) repository.StackRepository
- func NewWorkspaceRepository(db *gorm.DB) repository.WorkspaceRepository
- type BackendModel
- type ModuleModel
- type MultiString
- type OrganizationModel
- type ProjectModel
- type ResourceModel
- type RunModel
- type SourceModel
- type StackModel
- type WorkspaceModel
Constants ¶
This section is empty.
Variables ¶
var ( ErrSourceModelNil = errors.New("source model can't be nil") ErrSystemConfigModelNil = errors.New("system config model can't be nil") ErrStackModelNil = errors.New("stack model can't be nil") ErrProjectModelNil = errors.New("project model can't be nil") ErrFailedToGetSourceProviderType = errors.New("failed to parse source provider type") ErrFailedToGetSourceRemote = errors.New("failed to parse source remote") ErrFailedToGetStackState = errors.New("failed to parse stack state") ErrFailedToConvertSourceToEntity = errors.New("failed to convert source model to entity") ErrFailedToConvertProjectToEntity = errors.New("failed to convert project model to entity") ErrFailedToConvertOrgToEntity = errors.New("failed to convert org model to entity") ErrFailedToConvertBackendToEntity = errors.New("failed to convert backend model to entity") ErrFailedToConvertStackToEntity = errors.New("failed to convert stack model to entity") ErrOrganizationModelNil = errors.New("organization model can't be nil") ErrWorkspaceModelNil = errors.New("workspace model can't be nil") ErrBackendModelNil = errors.New("backend model can't be nil") ErrModuleModelNil = errors.New("module model can't be nil") ErrAppConfigModelNil = errors.New("appconfig model can't be nil") ErrFailedToGetModuleRemote = errors.New("failed to parse module remote") ErrResourceModelNil = errors.New("resource model can't be nil") ErrFailedToGetModuleDocRemote = errors.New("failed to parse module doc remote") ErrRunModelNil = errors.New("run model can't be nil") ErrFailedToGetRunType = errors.New("failed to parse run type") ErrFailedToGetRunStatus = errors.New("failed to parse run status") )
Functions ¶
func AutoMigrate ¶ added in v0.13.0
func CombineQueryParts ¶ added in v0.13.0
func GetModuleQuery ¶ added in v0.14.0
func GetModuleQuery(filter *entity.ModuleFilter) (string, []interface{})
func GetProjectQuery ¶ added in v0.13.0
func GetProjectQuery(filter *entity.ProjectFilter) (string, []interface{})
func GetResourceQuery ¶ added in v0.13.0
func GetResourceQuery(filter *entity.ResourceFilter) (string, []interface{})
func GetRunQuery ¶ added in v0.14.0
func GetSourceQuery ¶ added in v0.14.0
func GetSourceQuery(filter *entity.SourceFilter) (string, []interface{})
func GetStackQuery ¶ added in v0.13.0
func GetStackQuery(filter *entity.StackFilter) (string, []interface{})
func GetWorkspaceQuery ¶ added in v0.13.0
func GetWorkspaceQuery(filter *entity.WorkspaceFilter) (string, []interface{})
func NewBackendRepository ¶
func NewBackendRepository(db *gorm.DB) repository.BackendRepository
NewBackendRepository creates a new backend repository.
func NewModuleRepository ¶ added in v0.14.0
func NewModuleRepository(db *gorm.DB) repository.ModuleRepository
NewModuleRepository creates a new module repository.
func NewOrganizationRepository ¶
func NewOrganizationRepository(db *gorm.DB) repository.OrganizationRepository
NewOrganizationRepository creates a new organization repository.
func NewProjectRepository ¶
func NewProjectRepository(db *gorm.DB) repository.ProjectRepository
NewProjectRepository creates a new project repository.
func NewResourceRepository ¶ added in v0.13.0
func NewResourceRepository(db *gorm.DB) repository.ResourceRepository
NewResourceRepository creates a new resource repository.
func NewRunRepository ¶ added in v0.14.0
func NewRunRepository(db *gorm.DB) repository.RunRepository
NewRunRepository creates a new run repository.
func NewSourceRepository ¶
func NewSourceRepository(db *gorm.DB) repository.SourceRepository
NewSourceRepository creates a new source repository.
func NewStackRepository ¶
func NewStackRepository(db *gorm.DB) repository.StackRepository
NewStackRepository creates a new stack repository.
func NewWorkspaceRepository ¶
func NewWorkspaceRepository(db *gorm.DB) repository.WorkspaceRepository
NewWorkspaceRepository creates a new workspace repository.
Types ¶
type BackendModel ¶
type BackendModel struct { gorm.Model Name string `gorm:"index:unique_backend,unique"` Type string `gorm:"index:unique_backend,unique"` Description string Labels MultiString Owners MultiString BackendConfig v1.BackendConfig `gorm:"serializer:json" json:"backendConfig"` }
BackendModel is a DO used to map the entity to the database.
func (*BackendModel) FromEntity ¶
func (m *BackendModel) FromEntity(e *entity.Backend) error
FromEntity converts an entity to a DO.
func (*BackendModel) TableName ¶
func (m *BackendModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
type ModuleModel ¶ added in v0.14.0
type ModuleModel struct { gorm.Model // Name is the module name. Name string `gorm:"index:unique_module,unique"` // URL is the module oci artifact registry URL. URL string // Description is a human-readable description of the module. Description string // Owners is a list of owners for the module. Owners MultiString // Doc is the documentation URL of the module. Doc string }
ModuleModel is a DO used to map the entity to the database.
func (*ModuleModel) FromEntity ¶ added in v0.14.0
func (m *ModuleModel) FromEntity(e *entity.Module) error
FromEntity converts an entity to a DO.
func (*ModuleModel) TableName ¶ added in v0.14.0
func (m *ModuleModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
type MultiString ¶
type MultiString []string
MultiString is a custom type for handling arrays of strings with GORM.
func (MultiString) GormDBDataType ¶
GormDBDataType gorm db data type
func (MultiString) GormDataType ¶
func (s MultiString) GormDataType() string
GormDataType gorm common data type
func (*MultiString) Scan ¶
func (s *MultiString) Scan(src any) error
Scan implements the Scanner interface for the MultiString type.
type OrganizationModel ¶
type OrganizationModel struct { gorm.Model Name string `gorm:"index:unique_org,unique"` Description string Labels MultiString Owners MultiString }
OrganizationModel is a DO used to map the entity to the database.
func (*OrganizationModel) FromEntity ¶
func (m *OrganizationModel) FromEntity(e *entity.Organization) error
FromEntity converts an entity to a DO.
func (*OrganizationModel) TableName ¶
func (m *OrganizationModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
func (*OrganizationModel) ToEntity ¶
func (m *OrganizationModel) ToEntity() (*entity.Organization, error)
ToEntity converts the DO to an entity.
func (*OrganizationModel) ToEntityWithSource ¶
func (m *OrganizationModel) ToEntityWithSource(sourceEntity *entity.Source) (*entity.Organization, error)
ToEntity converts the DO to an entity.
type ProjectModel ¶
type ProjectModel struct { gorm.Model Name string `gorm:"index:unique_project,unique"` SourceID uint Source *SourceModel OrganizationID uint Organization *OrganizationModel Path string Description string Labels MultiString Owners MultiString }
ProjectModel is a DO used to map the entity to the database.
func (*ProjectModel) FromEntity ¶
func (m *ProjectModel) FromEntity(e *entity.Project) error
FromEntity converts an entity to a DO.
func (*ProjectModel) TableName ¶
func (m *ProjectModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
type ResourceModel ¶ added in v0.13.0
type ResourceModel struct { gorm.Model StackID uint Stack *StackModel ResourceType string ResourcePlane string ResourceName string ResourceURN string `gorm:"index:unique_kusion_resource_urn,unique"` KusionResourceID string IAMResourceID string CloudResourceID string LastAppliedRevision string LastAppliedTimestamp time.Time Status string Attributes map[string]any `gorm:"serializer:json" json:"attributes"` Extensions map[string]any `gorm:"serializer:json" json:"extensions"` DependsOn MultiString Provider string Labels MultiString Owners MultiString }
ResourceModel is a DO used to map the entity to the database.
func FromEntityList ¶ added in v0.13.0
func FromEntityList(entityList []*entity.Resource) ([]*ResourceModel, error)
FromEntity converts an entity to a DO.
func (*ResourceModel) FromEntity ¶ added in v0.13.0
func (m *ResourceModel) FromEntity(e *entity.Resource) error
FromEntity converts an entity to a DO.
func (*ResourceModel) TableName ¶ added in v0.13.0
func (m *ResourceModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
type RunModel ¶ added in v0.14.0
type RunModel struct { gorm.Model // RunType is the type of the run. Type string // StackID is the stack ID of the run. StackID uint // Stack is the stack of the run. Stack *StackModel // Workspace is the target workspace of the run. Workspace string // Status is the status of the run. Status string // Result is the result of the run. Result string // Logs is the logs of the run. Logs string // Trace is the trace of the run. Trace string }
RunModel is a DO used to map the entity to the database.
func (*RunModel) FromEntity ¶ added in v0.14.0
FromEntity converts an entity to a DO.
type SourceModel ¶
type SourceModel struct { gorm.Model // Name is the name of the source. Name string `gorm:"index:unique_source,unique"` // SourceProvider is the type of the source provider. // TODO: remove uk here SourceProvider string `gorm:"index:unique_source,unique"` // Remote is the source URL, including scheme. Remote string `gorm:"index:unique_source,unique"` // Description is a human-readable description of the source. Description string // Labels are custom labels associated with the source. Labels MultiString // Owners is a list of owners for the source. Owners MultiString }
SourceModel is a DO used to map the entity to the database.
func (*SourceModel) FromEntity ¶
func (m *SourceModel) FromEntity(e *entity.Source) error
FromEntity converts an entity to a DO.
func (*SourceModel) TableName ¶
func (m *SourceModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
type StackModel ¶
type StackModel struct { gorm.Model Name string `gorm:"index:unique_project,unique"` ProjectID uint Project *ProjectModel Description string Type string Path string `gorm:"index:unique_project,unique"` DesiredVersion string Labels MultiString Owners MultiString SyncState string LastGeneratedRevision string LastPreviewedRevision string LastAppliedRevision string LastAppliedTimestamp time.Time }
StackModel is a DO used to map the entity to the database.
func (*StackModel) FromEntity ¶
func (m *StackModel) FromEntity(e *entity.Stack) error
FromEntity converts an entity to a DO.
func (*StackModel) TableName ¶
func (m *StackModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.
type WorkspaceModel ¶
type WorkspaceModel struct { gorm.Model Name string `gorm:"index:unique_workspace,unique"` Description string Labels MultiString Owners MultiString BackendID uint Backend *BackendModel }
WorkspaceModel is a DO used to map the entity to the database.
func (*WorkspaceModel) FromEntity ¶
func (m *WorkspaceModel) FromEntity(e *entity.Workspace) error
FromEntity converts an entity to a DO.
func (*WorkspaceModel) TableName ¶
func (m *WorkspaceModel) TableName() string
The TableName method returns the name of the database table that the struct is mapped to.