database

package
v0.0.0-...-36d6b7f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangelogProductParameter

type ChangelogProductParameter struct {
	gorm.Model
	ProductID uint
	Name      string `gorm:"not null"`
	OldValue  string `gorm:"not null"`
	NewValue  string `gorm:"not null"`
}

type Configuration

type Configuration struct {
	gorm.Model
	Version    uint        `gorm:"unique autoIncrement"`
	Active     bool        `gorm:"default: false"`
	Valid      bool        `gorm:"default: false"`
	Parameters []Parameter `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	Products   []Product   `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

type ConfigurationRepository

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

func NewConfigurationRepository

func NewConfigurationRepository(database *gorm.DB) *ConfigurationRepository

func (*ConfigurationRepository) AppendParameter

func (R *ConfigurationRepository) AppendParameter(configuration *Configuration, name, parameterType, comparerType string) (*Configuration, error)

func (*ConfigurationRepository) Create

func (R *ConfigurationRepository) Create(version uint) (*Configuration, error)

func (*ConfigurationRepository) Delete

func (R *ConfigurationRepository) Delete(id uint) error

func (*ConfigurationRepository) GetAll

func (R *ConfigurationRepository) GetAll() ([]Configuration, error)

func (*ConfigurationRepository) GetById

func (R *ConfigurationRepository) GetById(id uint) (*Configuration, error)

func (*ConfigurationRepository) GetByVersion

func (R *ConfigurationRepository) GetByVersion(version uint) (*Configuration, error)

func (*ConfigurationRepository) GetNextVersion

func (R *ConfigurationRepository) GetNextVersion() uint

func (*ConfigurationRepository) UpdateStatus

func (R *ConfigurationRepository) UpdateStatus(configuration *Configuration) (*Configuration, error)

type Migrator

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

func NewMigrator

func NewMigrator(database *gorm.DB) *Migrator

func (*Migrator) Migrate

func (m *Migrator) Migrate() error

type Parameter

type Parameter struct {
	gorm.Model
	ConfigurationID uint             `gorm:"uniqueIndex:,composite:configuration_name"`
	Name            string           `gorm:"uniqueIndex:,composite:configuration_name"`
	Type            string           `gorm:"not null"`
	Comparer        decision.Compare `gorm:"not null"`
	ParameterValues []ParameterValue `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

type ParameterRepository

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

func NewParameterRepository

func NewParameterRepository(database *gorm.DB) *ParameterRepository

func (*ParameterRepository) GetParameterByConfigurationId

func (P *ParameterRepository) GetParameterByConfigurationId(id uint) ([]Parameter, error)

type ParameterValue

type ParameterValue struct {
	gorm.Model
	ParameterID uint
	ProductID   uint
	Value       string `gorm:"not null"`
}

type Product

type Product struct {
	gorm.Model
	ConfigurationID   uint                        `gorm:"uniqueIndex:,composite:configuration_name"`
	Name              string                      `gorm:"not null;uniqueIndex:,composite:configuration_name"`
	ParameterValues   []ParameterValue            `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	Changelog         []ChangelogProductParameter `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
	TestConfiguration TestConfiguration           `gorm:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;"`
}

type ProductRepository

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

func NewProductRepository

func NewProductRepository(database *gorm.DB) *ProductRepository

func (*ProductRepository) Delete

func (P *ProductRepository) Delete(id uint) error

func (*ProductRepository) GetByConfiguration

func (P *ProductRepository) GetByConfiguration(configurationId uint) ([]Product, error)

func (*ProductRepository) GetByConfigurationExceptProduct

func (P *ProductRepository) GetByConfigurationExceptProduct(configurationId uint, productId uint) ([]Product, error)

func (*ProductRepository) GetOne

func (P *ProductRepository) GetOne(id uint) (Product, error)

func (*ProductRepository) GetProductIdsByConfiguration

func (P *ProductRepository) GetProductIdsByConfiguration(configurationId uint) ([]uint, error)

func (*ProductRepository) InsertOne

func (P *ProductRepository) InsertOne(configurationId uint, name string, parameterValuesMap map[uint]string, testConfigurationMap map[string]string)

func (*ProductRepository) Update

func (P *ProductRepository) Update(product Product) error

type TestConfiguration

type TestConfiguration struct {
	gorm.Model
	ProductID     uint
	Configuration map[string]string `gorm:"not null;serializer:json"`
}

type TestConfigurationRepository

type TestConfigurationRepository struct {
	Database *gorm.DB
}

func NewTestConfigurationRepository

func NewTestConfigurationRepository(database *gorm.DB) *TestConfigurationRepository

func (*TestConfigurationRepository) GetByProductIds

func (T *TestConfigurationRepository) GetByProductIds(productIds []uint) []TestConfiguration

func (*TestConfigurationRepository) InsertOne

func (T *TestConfigurationRepository) InsertOne(productId uint, configuration map[string]string) *TestConfiguration

Jump to

Keyboard shortcuts

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