repositories

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricHistoriesDefaultLimit   = 10000000
	MetricHistoryBulkDefaultLimit = 25000
)
View Source
const (
	NamespaceEventActionFetched = "fetched"
	NamespaceEventActionCreated = "created"
	NamespaceEventActionDeleted = "deleted"
	NamespaceEventActionUpdated = "updated"
)

Supported event actions.

Variables

This section is empty.

Functions

func BuildJsonCondition added in v0.5.0

func BuildJsonCondition(
	dialector string,
	jsonColumnName string,
	jsonPathValueMap map[string]string,
) (sql string, args []any)

BuildJsonCondition creates sql and values for where condition to select items having the specified map of json paths and values in the given json column. Json path is expressed as "key" or "outerkey.nestedKey".

Types

type BaseRepository

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

BaseRepository represents base repository object.

func (BaseRepository) GetDB

func (r BaseRepository) GetDB() *gorm.DB

GetDB returns current DB instance.

type BaseRepositoryProvider

type BaseRepositoryProvider interface {
	// GetDB returns current DB instance.
	GetDB() *gorm.DB
}

BaseRepositoryProvider provides base repository interface.

type ExperimentRepository

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

ExperimentRepository repository to work with `experiment` entity.

func NewExperimentRepository

func NewExperimentRepository(db *gorm.DB) *ExperimentRepository

NewExperimentRepository creates repository to work with `experiment` entity.

func (ExperimentRepository) Create

func (r ExperimentRepository) Create(ctx context.Context, experiment *models.Experiment) error

Create creates new models.Experiment entity.

func (ExperimentRepository) Delete added in v0.3.0

func (r ExperimentRepository) Delete(ctx context.Context, experiment *models.Experiment) error

Delete removes the existing models.Experiment from the db.

func (ExperimentRepository) DeleteBatch added in v0.3.0

func (r ExperimentRepository) DeleteBatch(ctx context.Context, ids []*int32) error

DeleteBatch removes existing []models.Experiment in batch from the db.

func (ExperimentRepository) GetByNamespaceIDAndExperimentID added in v0.4.0

func (r ExperimentRepository) GetByNamespaceIDAndExperimentID(
	ctx context.Context, namespaceID uint, experimentID int32,
) (*models.Experiment, error)

GetByNamespaceIDAndExperimentID returns experiment by Namespace ID and Experiment ID.

func (ExperimentRepository) GetByNamespaceIDAndName added in v0.4.0

func (r ExperimentRepository) GetByNamespaceIDAndName(
	ctx context.Context, namespaceID uint, name string,
) (*models.Experiment, error)

GetByNamespaceIDAndName returns experiment by Namespace ID and Experiment name.

func (ExperimentRepository) Update

func (r ExperimentRepository) Update(ctx context.Context, experiment *models.Experiment) error

Update updates existing models.Experiment entity.

func (ExperimentRepository) UpdateWithTransaction added in v0.4.0

func (r ExperimentRepository) UpdateWithTransaction(
	ctx context.Context,
	tx *gorm.DB,
	experiment *models.Experiment,
) error

UpdateWithTransaction updates existing models.Experiment entity in scope of transaction.

type ExperimentRepositoryProvider

type ExperimentRepositoryProvider interface {
	// Create creates new models.Experiment entity.
	Create(ctx context.Context, experiment *models.Experiment) error
	// Update updates existing models.Experiment entity.
	Update(ctx context.Context, experiment *models.Experiment) error
	// Delete removes the existing models.Experiment from the db.
	Delete(ctx context.Context, experiment *models.Experiment) error
	// DeleteBatch removes existing []models.Experiment in batch from the db.
	DeleteBatch(ctx context.Context, ids []*int32) error
	// GetByNamespaceIDAndName returns experiment by Namespace ID and Experiment name.
	GetByNamespaceIDAndName(ctx context.Context, namespaceID uint, name string) (*models.Experiment, error)
	// GetByNamespaceIDAndExperimentID returns experiment by Namespace ID and Experiment ID.
	GetByNamespaceIDAndExperimentID(
		ctx context.Context, namespaceID uint, experimentID int32,
	) (*models.Experiment, error)
	// UpdateWithTransaction updates existing models.Experiment entity in scope of transaction.
	UpdateWithTransaction(ctx context.Context, tx *gorm.DB, experiment *models.Experiment) error
}

ExperimentRepositoryProvider provides an interface to work with `experiment` entity.

type MetricRepository

type MetricRepository struct {
	BaseRepository
}

MetricRepository repository to work with models.Metric entity.

func NewMetricRepository

func NewMetricRepository(db *gorm.DB) *MetricRepository

NewMetricRepository creates repository to work with models.Metric entity.

func (MetricRepository) CreateBatch

func (r MetricRepository) CreateBatch(
	ctx context.Context, run *models.Run, batchSize int, metrics []models.Metric,
) error

CreateBatch creates []models.Metric entities in batch. TODO:get back and fix `gocyclo` problem.

func (MetricRepository) GetMetricHistories

func (r MetricRepository) GetMetricHistories(
	ctx context.Context,
	namespaceID uint,
	experimentIDs []string, runIDs []string, metricKeys []string,
	viewType request.ViewType,
	limit int32,
	jsonPathValueMap map[string]string,
) (*sql.Rows, func(*sql.Rows, interface{}) error, error)

GetMetricHistories returns metric histories by request parameters. TODO think about to use interface instead of underlying type for -> func(*sql.Rows, interface{})

func (MetricRepository) GetMetricHistoryBulk

func (r MetricRepository) GetMetricHistoryBulk(
	ctx context.Context, namespaceID uint, runIDs []string, key string, limit int,
) ([]models.Metric, error)

GetMetricHistoryBulk returns metrics history bulk.

func (MetricRepository) GetMetricHistoryByRunIDAndKey

func (r MetricRepository) GetMetricHistoryByRunIDAndKey(
	ctx context.Context, runID, key string,
) ([]models.Metric, error)

GetMetricHistoryByRunIDAndKey returns metrics history by RunID and Key.

type MetricRepositoryProvider

type MetricRepositoryProvider interface {
	BaseRepositoryProvider
	// CreateBatch creates []models.Metric entities in batch.
	CreateBatch(ctx context.Context, run *models.Run, batchSize int, params []models.Metric) error
	// GetMetricHistories returns metric histories by request parameters.
	GetMetricHistories(
		ctx context.Context,
		namespaceID uint,
		experimentIDs []string, runIDs []string, metricKeys []string,
		viewType request.ViewType,
		limit int32,
		jsonPathValueMap map[string]string,
	) (*sql.Rows, func(*sql.Rows, interface{}) error, error)
	// GetMetricHistoryBulk returns metrics history bulk.
	GetMetricHistoryBulk(
		ctx context.Context, namespaceID uint, runIDs []string, key string, limit int,
	) ([]models.Metric, error)
	// GetMetricHistoryByRunIDAndKey returns metrics history by RunID and Key.
	GetMetricHistoryByRunIDAndKey(ctx context.Context, runID, key string) ([]models.Metric, error)
}

MetricRepositoryProvider provides an interface to work with models.Metric entity.

type MockBaseRepositoryProvider added in v0.3.2

type MockBaseRepositoryProvider struct {
	mock.Mock
}

MockBaseRepositoryProvider is an autogenerated mock type for the BaseRepositoryProvider type

func NewMockBaseRepositoryProvider added in v0.3.2

func NewMockBaseRepositoryProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockBaseRepositoryProvider

NewMockBaseRepositoryProvider creates a new instance of MockBaseRepositoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockBaseRepositoryProvider) GetDB added in v0.3.2

func (_m *MockBaseRepositoryProvider) GetDB() *gorm.DB

GetDB provides a mock function with given fields:

type MockExperimentRepositoryProvider added in v0.3.2

type MockExperimentRepositoryProvider struct {
	mock.Mock
}

MockExperimentRepositoryProvider is an autogenerated mock type for the ExperimentRepositoryProvider type

func NewMockExperimentRepositoryProvider added in v0.3.2

func NewMockExperimentRepositoryProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockExperimentRepositoryProvider

NewMockExperimentRepositoryProvider creates a new instance of MockExperimentRepositoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockExperimentRepositoryProvider) Create added in v0.3.2

Create provides a mock function with given fields: ctx, experiment

func (*MockExperimentRepositoryProvider) Delete added in v0.3.2

Delete provides a mock function with given fields: ctx, experiment

func (*MockExperimentRepositoryProvider) DeleteBatch added in v0.3.2

func (_m *MockExperimentRepositoryProvider) DeleteBatch(ctx context.Context, ids []*int32) error

DeleteBatch provides a mock function with given fields: ctx, ids

func (*MockExperimentRepositoryProvider) GetByNamespaceIDAndExperimentID added in v0.4.0

func (_m *MockExperimentRepositoryProvider) GetByNamespaceIDAndExperimentID(ctx context.Context, namespaceID uint, experimentID int32) (*models.Experiment, error)

GetByNamespaceIDAndExperimentID provides a mock function with given fields: ctx, namespaceID, experimentID

func (*MockExperimentRepositoryProvider) GetByNamespaceIDAndName added in v0.4.0

func (_m *MockExperimentRepositoryProvider) GetByNamespaceIDAndName(ctx context.Context, namespaceID uint, name string) (*models.Experiment, error)

GetByNamespaceIDAndName provides a mock function with given fields: ctx, namespaceID, name

func (*MockExperimentRepositoryProvider) Update added in v0.3.2

Update provides a mock function with given fields: ctx, experiment

func (*MockExperimentRepositoryProvider) UpdateWithTransaction added in v0.4.0

func (_m *MockExperimentRepositoryProvider) UpdateWithTransaction(ctx context.Context, tx *gorm.DB, experiment *models.Experiment) error

UpdateWithTransaction provides a mock function with given fields: ctx, tx, experiment

type MockMetricRepositoryProvider added in v0.3.2

type MockMetricRepositoryProvider struct {
	mock.Mock
}

MockMetricRepositoryProvider is an autogenerated mock type for the MetricRepositoryProvider type

func NewMockMetricRepositoryProvider added in v0.3.2

func NewMockMetricRepositoryProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockMetricRepositoryProvider

NewMockMetricRepositoryProvider creates a new instance of MockMetricRepositoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockMetricRepositoryProvider) CreateBatch added in v0.3.2

func (_m *MockMetricRepositoryProvider) CreateBatch(ctx context.Context, run *models.Run, batchSize int, params []models.Metric) error

CreateBatch provides a mock function with given fields: ctx, run, batchSize, params

func (*MockMetricRepositoryProvider) GetDB added in v0.3.2

func (_m *MockMetricRepositoryProvider) GetDB() *gorm.DB

GetDB provides a mock function with given fields:

func (*MockMetricRepositoryProvider) GetMetricHistories added in v0.3.2

func (_m *MockMetricRepositoryProvider) GetMetricHistories(ctx context.Context, namespaceID uint, experimentIDs []string, runIDs []string, metricKeys []string, viewType request.ViewType, limit int32, jsonPathValueMap map[string]string) (*sql.Rows, func(*sql.Rows, interface{}) error, error)

GetMetricHistories provides a mock function with given fields: ctx, namespaceID, experimentIDs, runIDs, metricKeys, viewType, limit, jsonPathValueMap

func (*MockMetricRepositoryProvider) GetMetricHistoryBulk added in v0.3.2

func (_m *MockMetricRepositoryProvider) GetMetricHistoryBulk(ctx context.Context, namespaceID uint, runIDs []string, key string, limit int) ([]models.Metric, error)

GetMetricHistoryBulk provides a mock function with given fields: ctx, namespaceID, runIDs, key, limit

func (*MockMetricRepositoryProvider) GetMetricHistoryByRunIDAndKey added in v0.3.2

func (_m *MockMetricRepositoryProvider) GetMetricHistoryByRunIDAndKey(ctx context.Context, runID string, key string) ([]models.Metric, error)

GetMetricHistoryByRunIDAndKey provides a mock function with given fields: ctx, runID, key

type MockNamespaceRepositoryProvider added in v0.4.0

type MockNamespaceRepositoryProvider struct {
	mock.Mock
}

MockNamespaceRepositoryProvider is an autogenerated mock type for the NamespaceRepositoryProvider type

func NewMockNamespaceRepositoryProvider added in v0.4.0

func NewMockNamespaceRepositoryProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockNamespaceRepositoryProvider

NewMockNamespaceRepositoryProvider creates a new instance of MockNamespaceRepositoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockNamespaceRepositoryProvider) Create added in v0.4.0

Create provides a mock function with given fields: ctx, namespace

func (*MockNamespaceRepositoryProvider) Delete added in v0.4.0

Delete provides a mock function with given fields: ctx, namespace

func (*MockNamespaceRepositoryProvider) GetByCode added in v0.4.0

GetByCode provides a mock function with given fields: ctx, code

func (*MockNamespaceRepositoryProvider) GetByID added in v0.4.0

GetByID provides a mock function with given fields: ctx, id

func (*MockNamespaceRepositoryProvider) List added in v0.4.0

List provides a mock function with given fields: ctx

func (*MockNamespaceRepositoryProvider) Update added in v0.4.0

Update provides a mock function with given fields: ctx, namespace

type MockParamRepositoryProvider added in v0.3.2

type MockParamRepositoryProvider struct {
	mock.Mock
}

MockParamRepositoryProvider is an autogenerated mock type for the ParamRepositoryProvider type

func NewMockParamRepositoryProvider added in v0.3.2

func NewMockParamRepositoryProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockParamRepositoryProvider

NewMockParamRepositoryProvider creates a new instance of MockParamRepositoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockParamRepositoryProvider) CreateBatch added in v0.3.2

func (_m *MockParamRepositoryProvider) CreateBatch(ctx context.Context, batchSize int, params []models.Param) error

CreateBatch provides a mock function with given fields: ctx, batchSize, params

type MockRunRepositoryProvider added in v0.3.2

type MockRunRepositoryProvider struct {
	mock.Mock
}

MockRunRepositoryProvider is an autogenerated mock type for the RunRepositoryProvider type

func NewMockRunRepositoryProvider added in v0.3.2

func NewMockRunRepositoryProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRunRepositoryProvider

NewMockRunRepositoryProvider creates a new instance of MockRunRepositoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRunRepositoryProvider) Archive added in v0.3.2

func (_m *MockRunRepositoryProvider) Archive(ctx context.Context, run *models.Run) error

Archive provides a mock function with given fields: ctx, run

func (*MockRunRepositoryProvider) ArchiveBatch added in v0.3.2

func (_m *MockRunRepositoryProvider) ArchiveBatch(ctx context.Context, namespaceID uint, ids []string) error

ArchiveBatch provides a mock function with given fields: ctx, namespaceID, ids

func (*MockRunRepositoryProvider) Create added in v0.3.2

func (_m *MockRunRepositoryProvider) Create(ctx context.Context, run *models.Run) error

Create provides a mock function with given fields: ctx, run

func (*MockRunRepositoryProvider) Delete added in v0.3.2

func (_m *MockRunRepositoryProvider) Delete(ctx context.Context, namespaceID uint, run *models.Run) error

Delete provides a mock function with given fields: ctx, namespaceID, run

func (*MockRunRepositoryProvider) DeleteBatch added in v0.3.2

func (_m *MockRunRepositoryProvider) DeleteBatch(ctx context.Context, namespaceID uint, ids []string) error

DeleteBatch provides a mock function with given fields: ctx, namespaceID, ids

func (*MockRunRepositoryProvider) GetByID added in v0.3.2

func (_m *MockRunRepositoryProvider) GetByID(ctx context.Context, id string) (*models.Run, error)

GetByID provides a mock function with given fields: ctx, id

func (*MockRunRepositoryProvider) GetByNamespaceIDAndRunID added in v0.4.0

func (_m *MockRunRepositoryProvider) GetByNamespaceIDAndRunID(ctx context.Context, namespaceID uint, runID string) (*models.Run, error)

GetByNamespaceIDAndRunID provides a mock function with given fields: ctx, namespaceID, runID

func (*MockRunRepositoryProvider) GetByNamespaceIDRunIDAndLifecycleStage added in v0.4.0

func (_m *MockRunRepositoryProvider) GetByNamespaceIDRunIDAndLifecycleStage(ctx context.Context, namespaceID uint, runID string, lifecycleStage models.LifecycleStage) (*models.Run, error)

GetByNamespaceIDRunIDAndLifecycleStage provides a mock function with given fields: ctx, namespaceID, runID, lifecycleStage

func (*MockRunRepositoryProvider) GetDB added in v0.3.2

func (_m *MockRunRepositoryProvider) GetDB() *gorm.DB

GetDB provides a mock function with given fields:

func (*MockRunRepositoryProvider) Restore added in v0.3.2

func (_m *MockRunRepositoryProvider) Restore(ctx context.Context, run *models.Run) error

Restore provides a mock function with given fields: ctx, run

func (*MockRunRepositoryProvider) RestoreBatch added in v0.3.2

func (_m *MockRunRepositoryProvider) RestoreBatch(ctx context.Context, namespaceID uint, ids []string) error

RestoreBatch provides a mock function with given fields: ctx, namespaceID, ids

func (*MockRunRepositoryProvider) SetRunTagsBatch added in v0.3.2

func (_m *MockRunRepositoryProvider) SetRunTagsBatch(ctx context.Context, run *models.Run, batchSize int, tags []models.Tag) error

SetRunTagsBatch provides a mock function with given fields: ctx, run, batchSize, tags

func (*MockRunRepositoryProvider) Update added in v0.3.2

func (_m *MockRunRepositoryProvider) Update(ctx context.Context, run *models.Run) error

Update provides a mock function with given fields: ctx, run

func (*MockRunRepositoryProvider) UpdateWithTransaction added in v0.3.2

func (_m *MockRunRepositoryProvider) UpdateWithTransaction(ctx context.Context, tx *gorm.DB, run *models.Run) error

UpdateWithTransaction provides a mock function with given fields: ctx, tx, run

type MockTagRepositoryProvider added in v0.3.2

type MockTagRepositoryProvider struct {
	mock.Mock
}

MockTagRepositoryProvider is an autogenerated mock type for the TagRepositoryProvider type

func NewMockTagRepositoryProvider added in v0.3.2

func NewMockTagRepositoryProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockTagRepositoryProvider

NewMockTagRepositoryProvider creates a new instance of MockTagRepositoryProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockTagRepositoryProvider) CreateExperimentTag added in v0.3.2

func (_m *MockTagRepositoryProvider) CreateExperimentTag(ctx context.Context, experimentTag *models.ExperimentTag) error

CreateExperimentTag provides a mock function with given fields: ctx, experimentTag

func (*MockTagRepositoryProvider) CreateRunTagWithTransaction added in v0.3.2

func (_m *MockTagRepositoryProvider) CreateRunTagWithTransaction(ctx context.Context, tx *gorm.DB, runID string, key string, value string) error

CreateRunTagWithTransaction provides a mock function with given fields: ctx, tx, runID, key, value

func (*MockTagRepositoryProvider) Delete added in v0.3.2

func (_m *MockTagRepositoryProvider) Delete(ctx context.Context, tag *models.Tag) error

Delete provides a mock function with given fields: ctx, tag

func (*MockTagRepositoryProvider) GetByRunIDAndKey added in v0.3.2

func (_m *MockTagRepositoryProvider) GetByRunIDAndKey(ctx context.Context, runID string, key string) (*models.Tag, error)

GetByRunIDAndKey provides a mock function with given fields: ctx, runID, key

func (*MockTagRepositoryProvider) GetDB added in v0.3.2

func (_m *MockTagRepositoryProvider) GetDB() *gorm.DB

GetDB provides a mock function with given fields:

type NamespaceCachedRepository added in v0.4.0

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

NamespaceCachedRepository cached repository to work with `namespace` entity.

func NewNamespaceCachedRepository added in v0.4.0

func NewNamespaceCachedRepository(
	db *gorm.DB, listener dao.EventListenerProvider, namespaceRepository NamespaceRepositoryProvider,
) (*NamespaceCachedRepository, error)

NewNamespaceCachedRepository creates new instance of cached repository to work with `namespace` entity.

func (NamespaceCachedRepository) Create added in v0.4.0

func (r NamespaceCachedRepository) Create(ctx context.Context, namespace *models.Namespace) error

Create creates new models.Namespace entity.

func (NamespaceCachedRepository) Delete added in v0.4.0

func (r NamespaceCachedRepository) Delete(ctx context.Context, namespace *models.Namespace) error

Delete deletes existing models.Namespace entity.

func (NamespaceCachedRepository) GetByCode added in v0.4.0

func (r NamespaceCachedRepository) GetByCode(
	ctx context.Context, code string,
) (*models.Namespace, error)

GetByCode returns namespace by its Code.

func (NamespaceCachedRepository) GetByID added in v0.4.0

GetByID returns namespace by its ID.

func (NamespaceCachedRepository) List added in v0.4.0

List returns all namespaces.

func (NamespaceCachedRepository) Update added in v0.4.0

func (r NamespaceCachedRepository) Update(ctx context.Context, namespace *models.Namespace) error

Update updates existing models.Namespace entity.

type NamespaceEvent added in v0.4.0

type NamespaceEvent struct {
	Action    NamespaceEventAction `json:"action"`
	Namespace models.Namespace     `json:"namespace"`
}

NamespaceEvent represents database event.

type NamespaceEventAction added in v0.4.0

type NamespaceEventAction string

NamespaceEventAction represents Event action.

type NamespaceRepository added in v0.4.0

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

NamespaceRepository repository to work with `namespace` entity.

func NewNamespaceRepository added in v0.4.0

func NewNamespaceRepository(db *gorm.DB) *NamespaceRepository

NewNamespaceRepository creates repository to work with `namespace` entity.

func (NamespaceRepository) Create added in v0.4.0

func (r NamespaceRepository) Create(ctx context.Context, namespace *models.Namespace) error

Create creates new models.Namespace entity.

func (NamespaceRepository) Delete added in v0.4.0

func (r NamespaceRepository) Delete(ctx context.Context, namespace *models.Namespace) error

Delete removes a namespace and it's associated experiments by its ID.

func (NamespaceRepository) GetByCode added in v0.4.0

func (r NamespaceRepository) GetByCode(ctx context.Context, code string) (*models.Namespace, error)

GetByCode returns namespace by its Code.

func (NamespaceRepository) GetByID added in v0.4.0

func (r NamespaceRepository) GetByID(ctx context.Context, id uint) (*models.Namespace, error)

GetByID returns namespace by its ID.

func (NamespaceRepository) List added in v0.4.0

List returns all namespaces.

func (NamespaceRepository) Update added in v0.4.0

func (r NamespaceRepository) Update(ctx context.Context, namespace *models.Namespace) error

Update modifies the existing models.Namespace entity.

type NamespaceRepositoryProvider added in v0.4.0

type NamespaceRepositoryProvider interface {
	// Create creates new models.Namespace entity.
	Create(ctx context.Context, namespace *models.Namespace) error
	// Update modifies the existing models.Namespace entity.
	Update(ctx context.Context, namespace *models.Namespace) error
	// Delete removes a namespace and it's associated experiments by its ID.
	Delete(ctx context.Context, namespace *models.Namespace) error
	// GetByCode returns namespace by its Code.
	GetByCode(ctx context.Context, code string) (*models.Namespace, error)
	// GetByID returns namespace by its ID.
	GetByID(ctx context.Context, id uint) (*models.Namespace, error)
	// List returns all namespaces.
	List(ctx context.Context) ([]models.Namespace, error)
}

NamespaceRepositoryProvider provides an interface to work with `namespace` entity.

type ParamConflictError added in v0.3.7

type ParamConflictError struct {
	Message string
}

ParamConflictError is returned when there is a conflict in the params (same key, different value).

func (ParamConflictError) Error added in v0.3.7

func (e ParamConflictError) Error() string

Error returns the ParamConflictError message.

type ParamRepository

type ParamRepository struct {
	BaseRepository
}

ParamRepository repository to work with models.Param entity.

func NewParamRepository

func NewParamRepository(db *gorm.DB) *ParamRepository

NewParamRepository creates repository to work with models.Param entity.

func (ParamRepository) CreateBatch

func (r ParamRepository) CreateBatch(ctx context.Context, batchSize int, params []models.Param) error

CreateBatch creates []models.Param entities in batch.

type ParamRepositoryProvider

type ParamRepositoryProvider interface {
	// CreateBatch creates []models.Param entities in batch.
	CreateBatch(ctx context.Context, batchSize int, params []models.Param) error
}

ParamRepositoryProvider provides an interface to work with models.Param entity.

type RunRepository

type RunRepository struct {
	BaseRepository
}

RunRepository repository to work with models.Run entity.

func NewRunRepository

func NewRunRepository(db *gorm.DB) *RunRepository

NewRunRepository creates repository to work with models.Run entity.

func (RunRepository) Archive

func (r RunRepository) Archive(ctx context.Context, run *models.Run) error

Archive marks existing models.Run entity as archived.

func (RunRepository) ArchiveBatch

func (r RunRepository) ArchiveBatch(ctx context.Context, namespaceID uint, ids []string) error

ArchiveBatch marks existing models.Run entities as archived.

func (RunRepository) Create

func (r RunRepository) Create(ctx context.Context, run *models.Run) error

Create creates new models.Run entity.

func (RunRepository) Delete

func (r RunRepository) Delete(ctx context.Context, namespaceID uint, run *models.Run) error

Delete removes the existing models.Run from the db.

func (RunRepository) DeleteBatch

func (r RunRepository) DeleteBatch(ctx context.Context, namespaceID uint, ids []string) error

DeleteBatch removes existing models.Run from the db.

func (RunRepository) GetByID

func (r RunRepository) GetByID(ctx context.Context, id string) (*models.Run, error)

GetByID returns models.Run entity by its ID.

func (RunRepository) GetByNamespaceIDAndRunID added in v0.4.0

func (r RunRepository) GetByNamespaceIDAndRunID(
	ctx context.Context, namespaceID uint, runID string,
) (*models.Run, error)

GetByNamespaceIDAndRunID returns models.Run entity by Namespace ID and its ID.

func (RunRepository) GetByNamespaceIDRunIDAndLifecycleStage added in v0.4.0

func (r RunRepository) GetByNamespaceIDRunIDAndLifecycleStage(
	ctx context.Context, namespaceID uint, runID string, lifecycleStage models.LifecycleStage,
) (*models.Run, error)

GetByNamespaceIDRunIDAndLifecycleStage returns models.Run entity by Namespace ID, its ID and Lifecycle Stage..

func (RunRepository) Restore

func (r RunRepository) Restore(ctx context.Context, run *models.Run) error

Restore marks existing models.Run entity as active.

func (RunRepository) RestoreBatch

func (r RunRepository) RestoreBatch(ctx context.Context, namespaceID uint, ids []string) error

RestoreBatch marks existing models.Run entities as active.

func (RunRepository) SetRunTagsBatch

func (r RunRepository) SetRunTagsBatch(ctx context.Context, run *models.Run, batchSize int, tags []models.Tag) error

SetRunTagsBatch sets Run tags in batch.

func (RunRepository) Update

func (r RunRepository) Update(ctx context.Context, run *models.Run) error

Update updates existing models.Run entity.

func (RunRepository) UpdateWithTransaction

func (r RunRepository) UpdateWithTransaction(ctx context.Context, tx *gorm.DB, run *models.Run) error

UpdateWithTransaction updates existing models.Run entity in scope of transaction.

type RunRepositoryProvider

type RunRepositoryProvider interface {
	BaseRepositoryProvider
	// GetByID returns models.Run entity by its ID.
	GetByID(ctx context.Context, id string) (*models.Run, error)
	// GetByNamespaceIDRunIDAndLifecycleStage returns models.Run entity by Namespace ID, its ID and Lifecycle Stage.
	GetByNamespaceIDRunIDAndLifecycleStage(
		ctx context.Context, namespaceID uint, runID string, lifecycleStage models.LifecycleStage,
	) (*models.Run, error)
	// GetByNamespaceIDAndRunID returns models.Run entity by Namespace ID and its ID.
	GetByNamespaceIDAndRunID(
		ctx context.Context, namespaceID uint, runID string,
	) (*models.Run, error)
	// Create creates new models.Run entity.
	Create(ctx context.Context, run *models.Run) error
	// Update updates existing models.Experiment entity.
	Update(ctx context.Context, run *models.Run) error
	// Archive marks existing models.Run entity as archived.
	Archive(ctx context.Context, run *models.Run) error
	// Delete removes the existing models.Run
	Delete(ctx context.Context, namespaceID uint, run *models.Run) error
	// Restore marks existing models.Run entity as active.
	Restore(ctx context.Context, run *models.Run) error
	// ArchiveBatch marks existing models.Run entities as archived.
	ArchiveBatch(ctx context.Context, namespaceID uint, ids []string) error
	// DeleteBatch removes the existing models.Run from the db.
	DeleteBatch(ctx context.Context, namespaceID uint, ids []string) error
	// RestoreBatch marks existing models.Run entities as active.
	RestoreBatch(ctx context.Context, namespaceID uint, ids []string) error
	// SetRunTagsBatch sets Run tags in batch.
	SetRunTagsBatch(ctx context.Context, run *models.Run, batchSize int, tags []models.Tag) error
	// UpdateWithTransaction updates existing models.Run entity in scope of transaction.
	UpdateWithTransaction(ctx context.Context, tx *gorm.DB, run *models.Run) error
}

RunRepositoryProvider provides an interface to work with models.Run entity.

type TagRepository

type TagRepository struct {
	BaseRepository
}

TagRepository repository to work with models.Tag entity.

func NewTagRepository

func NewTagRepository(db *gorm.DB) *TagRepository

NewTagRepository creates repository to work with models.Tag entity.

func (TagRepository) CreateExperimentTag

func (r TagRepository) CreateExperimentTag(ctx context.Context, experimentTag *models.ExperimentTag) error

CreateExperimentTag creates new models.ExperimentTag entity connected to models.Experiment.

func (TagRepository) CreateRunTagWithTransaction

func (r TagRepository) CreateRunTagWithTransaction(
	ctx context.Context, tx *gorm.DB, runID, key, value string,
) error

CreateRunTagWithTransaction creates new models.Tag entity connected to models.Run.

func (TagRepository) Delete

func (r TagRepository) Delete(ctx context.Context, tag *models.Tag) error

Delete deletes existing models.Tag entity.

func (TagRepository) GetByRunIDAndKey

func (r TagRepository) GetByRunIDAndKey(ctx context.Context, runID, key string) (*models.Tag, error)

GetByRunIDAndKey returns models.Tag by provided RunID and Tag Key.

type TagRepositoryProvider

type TagRepositoryProvider interface {
	BaseRepositoryProvider
	// CreateExperimentTag creates new models.ExperimentTag entity connected to models.Experiment.
	CreateExperimentTag(ctx context.Context, experimentTag *models.ExperimentTag) error
	// CreateRunTagWithTransaction creates new models.Tag entity connected to models.Run.
	CreateRunTagWithTransaction(ctx context.Context, tx *gorm.DB, runID, key, value string) error
	// GetByRunIDAndKey returns models.Tag by provided RunID and Tag Key.
	GetByRunIDAndKey(ctx context.Context, runID, key string) (*models.Tag, error)
	// Delete deletes existing models.Tag entity.
	Delete(ctx context.Context, tag *models.Tag) error
}

TagRepositoryProvider provides an interface to work with models.Tag entity.

Jump to

Keyboard shortcuts

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