repository

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFilterQuery

func ApplyFilterQuery(query *gorm.DB, listOptions any, mappingFuncs filter.EntityMappingFunctions) (*gorm.DB, error)

ApplyFilterQuery applies advanced filter query processing to a GORM query

func MapArtifactPropertyToProperties

func MapArtifactPropertyToProperties(artProperty schema.ArtifactProperty) entity.Properties

MapArtifactPropertyToProperties converts schema.ArtifactProperty to entity.Properties

func MapContextPropertyToProperties

func MapContextPropertyToProperties(contextProperty schema.ContextProperty) entity.Properties

MapContextPropertyToProperties converts schema.ContextProperty to entity.Properties

func MapExecutionPropertyToProperties

func MapExecutionPropertyToProperties(executionProperty schema.ExecutionProperty) entity.Properties

MapExecutionPropertyToProperties converts schema.ExecutionProperty to entity.Properties

func MapPropertiesToArtifactProperty

func MapPropertiesToArtifactProperty(prop entity.Properties, artifactID int32, isCustomProperty bool) schema.ArtifactProperty

MapPropertiesToArtifactProperty converts entity.Properties to schema.ArtifactProperty

func MapPropertiesToContextProperty

func MapPropertiesToContextProperty(prop entity.Properties, contextID int32, isCustomProperty bool) schema.ContextProperty

MapPropertiesToContextProperty converts entity.Properties to schema.ContextProperty

func MapPropertiesToExecutionProperty

func MapPropertiesToExecutionProperty(prop entity.Properties, executionID int32, isCustomProperty bool) schema.ExecutionProperty

MapPropertiesToExecutionProperty converts entity.Properties to schema.ExecutionProperty

func NewTypePropertyRepository

func NewTypePropertyRepository(db *gorm.DB) entity.TypePropertyRepository

func NewTypeRepository

func NewTypeRepository(db *gorm.DB) entity.TypeRepository

Types

type BaseListOptions

type BaseListOptions interface {
	GetPageSize() int32
	GetNextPageToken() string
	SetNextPageToken(*string)
	GetOrderBy() string
	GetSortOrder() string
	GetFilterQuery() string
}

List options interface

type EntityToPropertiesMapper

type EntityToPropertiesMapper[TEntity any, TProp PropertyEntity] func(TEntity, int32) []TProp

type EntityToSchemaMapper

type EntityToSchemaMapper[TEntity any, TSchema SchemaEntity] func(TEntity) TSchema

Mapper function types

type FilterApplier

type FilterApplier interface {
	GetRestEntityType() filter.RestEntityType
}

Filter applier interface for entities that support advanced filtering

type GenericRepository

type GenericRepository[TEntity any, TSchema SchemaEntity, TProp PropertyEntity, TListOpts BaseListOptions] struct {
	// contains filtered or unexported fields
}

Generic repository implementation

func NewGenericRepository

func NewGenericRepository[TEntity any, TSchema SchemaEntity, TProp PropertyEntity, TListOpts BaseListOptions](
	config GenericRepositoryConfig[TEntity, TSchema, TProp, TListOpts],
) *GenericRepository[TEntity, TSchema, TProp, TListOpts]

func (*GenericRepository[TEntity, TSchema, TProp, TListOpts]) ApplyStandardPagination

func (r *GenericRepository[TEntity, TSchema, TProp, TListOpts]) ApplyStandardPagination(query *gorm.DB, listOptions TListOpts, entities any) *gorm.DB

func (*GenericRepository[TEntity, TSchema, TProp, TListOpts]) CreateDefaultPaginationToken

func (r *GenericRepository[TEntity, TSchema, TProp, TListOpts]) CreateDefaultPaginationToken(e TSchema, listOptions TListOpts) string

func (*GenericRepository[TEntity, TSchema, TProp, TListOpts]) GetByID

func (r *GenericRepository[TEntity, TSchema, TProp, TListOpts]) GetByID(id int32) (TEntity, error)

func (*GenericRepository[TEntity, TSchema, TProp, TListOpts]) GetByName

func (r *GenericRepository[TEntity, TSchema, TProp, TListOpts]) GetByName(name string) (TEntity, error)

func (*GenericRepository[TEntity, TSchema, TProp, TListOpts]) GetConfig

func (r *GenericRepository[TEntity, TSchema, TProp, TListOpts]) GetConfig() GenericRepositoryConfig[TEntity, TSchema, TProp, TListOpts]

func (*GenericRepository[TEntity, TSchema, TProp, TListOpts]) List

func (r *GenericRepository[TEntity, TSchema, TProp, TListOpts]) List(listOptions TListOpts) (*entity.ListWrapper[TEntity], error)

func (*GenericRepository[TEntity, TSchema, TProp, TListOpts]) Save

func (r *GenericRepository[TEntity, TSchema, TProp, TListOpts]) Save(e TEntity, parentResourceID *int32) (TEntity, error)

type GenericRepositoryConfig

type GenericRepositoryConfig[TEntity any, TSchema SchemaEntity, TProp PropertyEntity, TListOpts BaseListOptions] struct {
	DB                      *gorm.DB
	TypeID                  int32
	EntityToSchema          EntityToSchemaMapper[TEntity, TSchema]
	SchemaToEntity          SchemaToEntityMapper[TSchema, TProp, TEntity]
	EntityToProperties      EntityToPropertiesMapper[TEntity, TProp]
	NotFoundError           error
	EntityName              string
	PropertyFieldName       string
	ApplyListFilters        func(*gorm.DB, TListOpts) *gorm.DB
	CreatePaginationToken   func(TSchema, TListOpts) string
	ApplyCustomOrdering     func(*gorm.DB, TListOpts) *gorm.DB
	IsNewEntity             func(TEntity) bool
	HasCustomProperties     func(TEntity) bool
	EntityMappingFuncs      filter.EntityMappingFunctions
	PreserveHistoricalTimes bool
}

Generic repository configuration

type SchemaEntity

type SchemaEntity interface {
	schema.Artifact | schema.Context | schema.Execution
}

Generic constraints for different entity types

type SchemaToEntityMapper

type SchemaToEntityMapper[TSchema SchemaEntity, TProp PropertyEntity, TEntity any] func(TSchema, []TProp) TEntity

type TypeRepositoryImpl

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

func (*TypeRepositoryImpl) GetAll

func (r *TypeRepositoryImpl) GetAll() ([]entity.Type, error)

func (*TypeRepositoryImpl) Save

Jump to

Keyboard shortcuts

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