gorm

package
v0.0.0-...-4f702ff Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLimit = 1000

Variables

This section is empty.

Functions

This section is empty.

Types

type EntityIDRepository

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

func GetEntityIDRepository

func GetEntityIDRepository(logger log.Logger, db minipkg_gorm.IDB, entityTypesByClusterSysnames map[string][]string) *EntityIDRepository

func NewEntityIDRepository

func NewEntityIDRepository(repository *repository, entityTypesByClusterSysnames map[string][]string) *EntityIDRepository

func (*EntityIDRepository) AutoMigrate

func (r *EntityIDRepository) AutoMigrate() error

func (EntityIDRepository) DB

func (r EntityIDRepository) DB() *gorm.DB

func (*EntityIDRepository) LastVal

func (r *EntityIDRepository) LastVal(entityTypeSysname string) (id uint, err error)

func (*EntityIDRepository) NextVal

func (r *EntityIDRepository) NextVal(entityTypeSysname string) (id uint, err error)

func (*EntityIDRepository) SetDefaultConditions

func (r *EntityIDRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

type EntityType2PropertyRepository

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

EntityType2PropertyRepository is a repository for the EntityType2Property entity

func NewEntityType2PropertyRepository

func NewEntityType2PropertyRepository(repository *repository) (*EntityType2PropertyRepository, error)

New creates a new EntityType2PropertyRepository

func (*EntityType2PropertyRepository) Count

func (*EntityType2PropertyRepository) Create

Create saves a new record in the database.

func (*EntityType2PropertyRepository) CreateTx

func (EntityType2PropertyRepository) DB

func (r EntityType2PropertyRepository) DB() *gorm.DB

func (*EntityType2PropertyRepository) Delete

Delete (soft) deletes a Maintenance record in the database.

func (*EntityType2PropertyRepository) DeleteTx

func (*EntityType2PropertyRepository) Get

Get reads the album with the specified ID from the database.

func (*EntityType2PropertyRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*EntityType2PropertyRepository) SetDefaultConditions

func (r *EntityType2PropertyRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

type EntityTypeRepository

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

EntityTypeRepository is a repository for the model entity

func NewEntityTypeRepository

func NewEntityTypeRepository(repository *repository, entityType2PropertyRepository *entity_type2property.Repository, textSourceRepository text_source.Repository) (*EntityTypeRepository, error)

New creates a new EntityTypeRepository

func (*EntityTypeRepository) BindProperty

func (r *EntityTypeRepository) BindProperty(ctx context.Context, id uint, propertyID uint) error

func (*EntityTypeRepository) BindPropertyIfNotBinded

func (r *EntityTypeRepository) BindPropertyIfNotBinded(ctx context.Context, id uint, propertyID uint) error

func (*EntityTypeRepository) Count

func (*EntityTypeRepository) Create

Create saves a new record in the database.

func (EntityTypeRepository) DB

func (r EntityTypeRepository) DB() *gorm.DB

func (*EntityTypeRepository) Delete

Delete (soft) deletes a Maintenance record in the database.

func (*EntityTypeRepository) First

func (*EntityTypeRepository) Get

Get reads the album with the specified ID from the database.

func (*EntityTypeRepository) GetBySysname

func (r *EntityTypeRepository) GetBySysname(ctx context.Context, sysname string, langID uint) (*entity_type.EntityType, error)

func (*EntityTypeRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*EntityTypeRepository) SetDefaultConditions

func (r *EntityTypeRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*EntityTypeRepository) TCreate

func (r *EntityTypeRepository) TCreate(ctx context.Context, entity *entity_type.EntityType, langID uint) (err error)

func (*EntityTypeRepository) TFirst

func (*EntityTypeRepository) TGet

func (*EntityTypeRepository) TQuery

func (*EntityTypeRepository) TUpdate

func (r *EntityTypeRepository) TUpdate(ctx context.Context, entity *entity_type.EntityType, langID uint) (err error)

func (*EntityTypeRepository) UnbindAllProperties

func (r *EntityTypeRepository) UnbindAllProperties(ctx context.Context, id uint) error

func (*EntityTypeRepository) UnbindProperty

func (r *EntityTypeRepository) UnbindProperty(ctx context.Context, id uint, propertyID uint) error

func (*EntityTypeRepository) Update

Update saves a changed Maintenance record in the database.

type IRepository

type IRepository interface {
	DB() *gorm.DB
}

IRepository is an interface of repository

func GetRepository

func GetRepository(logger log.Logger, dbase minipkg_gorm.IDB, entityName string) (repo IRepository, err error)

GetRepository return a repository

type PropertyGroupRepository

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

PropertyGroupRepository is a repository for the model entity

func NewPropertyGroupRepository

func NewPropertyGroupRepository(repository *repository, textSourceRepository text_source.Repository) (*PropertyGroupRepository, error)

New creates a new PropertyGroupRepository

func (*PropertyGroupRepository) Count

func (*PropertyGroupRepository) Create

Create saves a new record in the database.

func (PropertyGroupRepository) DB

func (r PropertyGroupRepository) DB() *gorm.DB

func (*PropertyGroupRepository) Delete

Delete (soft) deletes a Maintenance record in the database.

func (*PropertyGroupRepository) First

func (*PropertyGroupRepository) Get

Get reads the album with the specified ID from the database.

func (*PropertyGroupRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*PropertyGroupRepository) SetDefaultConditions

func (r *PropertyGroupRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*PropertyGroupRepository) TCreate

func (r *PropertyGroupRepository) TCreate(ctx context.Context, entity *property_group.PropertyGroup, langID uint) (err error)

func (*PropertyGroupRepository) TFirst

func (*PropertyGroupRepository) TGet

func (*PropertyGroupRepository) TQuery

func (*PropertyGroupRepository) TUpdate

func (r *PropertyGroupRepository) TUpdate(ctx context.Context, entity *property_group.PropertyGroup, langID uint) (err error)

func (*PropertyGroupRepository) Update

Update saves a changed Maintenance record in the database.

type PropertyRepository

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

PropertyRepository is a repository for the model entity

func NewPropertyRepository

func NewPropertyRepository(repository *repository, textSourceRepository text_source.Repository) (*PropertyRepository, error)

New creates a new PropertyRepository

func (*PropertyRepository) Count

func (*PropertyRepository) Create

func (r *PropertyRepository) Create(ctx context.Context, entity *property.Property) error

Create saves a new record in the database.

func (PropertyRepository) DB

func (r PropertyRepository) DB() *gorm.DB

func (*PropertyRepository) Delete

func (r *PropertyRepository) Delete(ctx context.Context, entity *property.Property) error

Delete (soft) deletes a Maintenance record in the database.

func (*PropertyRepository) EntityNameAndDescriptionInitTx

func (r *PropertyRepository) EntityNameAndDescriptionInitTx(ctx context.Context, tx *gorm.DB, entity *property.Property, langID uint) error

func (*PropertyRepository) First

func (*PropertyRepository) Get

Get reads the album with the specified ID from the database.

func (*PropertyRepository) GetBySysname

func (r *PropertyRepository) GetBySysname(ctx context.Context, sysname string, langID uint) (*property.Property, error)

func (*PropertyRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*PropertyRepository) SetDefaultConditions

func (r *PropertyRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*PropertyRepository) TCreate

func (r *PropertyRepository) TCreate(ctx context.Context, entity *property.Property, langID uint) (err error)

func (*PropertyRepository) TFirst

func (r *PropertyRepository) TFirst(ctx context.Context, entity *property.Property, langID uint) (*property.Property, error)

func (*PropertyRepository) TGet

func (r *PropertyRepository) TGet(ctx context.Context, id uint, langID uint) (*property.Property, error)

func (*PropertyRepository) TQuery

func (*PropertyRepository) TUpdate

func (r *PropertyRepository) TUpdate(ctx context.Context, entity *property.Property, langID uint) (err error)

func (*PropertyRepository) Update

func (r *PropertyRepository) Update(ctx context.Context, entity *property.Property) error

Update saves a changed Maintenance record in the database.

type PropertyType2PropertyViewTypeRepository

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

PropertyType2PropertyViewTypeRepository is a repository for the model entity

func NewPropertyType2PropertyViewTypeRepository

func NewPropertyType2PropertyViewTypeRepository(repository *repository) (*PropertyType2PropertyViewTypeRepository, error)

New creates a new PropertyType2PropertyViewTypeRepository

func (*PropertyType2PropertyViewTypeRepository) Count

func (*PropertyType2PropertyViewTypeRepository) Create

Create saves a new record in the database.

func (PropertyType2PropertyViewTypeRepository) DB

func (r PropertyType2PropertyViewTypeRepository) DB() *gorm.DB

func (*PropertyType2PropertyViewTypeRepository) Delete

Delete (soft) deletes a Maintenance record in the database.

func (*PropertyType2PropertyViewTypeRepository) Get

Get reads the album with the specified ID from the database.

func (*PropertyType2PropertyViewTypeRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*PropertyType2PropertyViewTypeRepository) Save

Save update value in database, if the value doesn't have primary key, will insert it

func (*PropertyType2PropertyViewTypeRepository) SetDefaultConditions

func (r *PropertyType2PropertyViewTypeRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*PropertyType2PropertyViewTypeRepository) Update

Update saves a changed Maintenance record in the database.

type PropertyTypeRepository

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

PropertyTypeRepository is a repository for the model entity

func NewPropertyTypeRepository

func NewPropertyTypeRepository(repository *repository, textSourceRepository text_source.Repository) (*PropertyTypeRepository, error)

New creates a new PropertyTypeRepository

func (*PropertyTypeRepository) BindPropertyViewType

func (r *PropertyTypeRepository) BindPropertyViewType(ctx context.Context, entity *property_type.PropertyType, viewTypeID uint) error

func (*PropertyTypeRepository) Count

func (*PropertyTypeRepository) Create

Create saves a new record in the database.

func (PropertyTypeRepository) DB

func (r PropertyTypeRepository) DB() *gorm.DB

func (*PropertyTypeRepository) Delete

Delete (soft) deletes a record in the database.

func (*PropertyTypeRepository) First

func (*PropertyTypeRepository) Get

Get reads the album with the specified ID from the database.

func (*PropertyTypeRepository) InitPropertyViewTypes

func (r *PropertyTypeRepository) InitPropertyViewTypes(ctx context.Context, entity *property_type.PropertyType) error

func (*PropertyTypeRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*PropertyTypeRepository) SetDefaultConditions

func (r *PropertyTypeRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*PropertyTypeRepository) TCreate

func (r *PropertyTypeRepository) TCreate(ctx context.Context, entity *property_type.PropertyType, langID uint) (err error)

func (*PropertyTypeRepository) TFirst

func (*PropertyTypeRepository) TGet

func (*PropertyTypeRepository) TQuery

func (*PropertyTypeRepository) TUpdate

func (r *PropertyTypeRepository) TUpdate(ctx context.Context, entity *property_type.PropertyType, langID uint) (err error)

func (*PropertyTypeRepository) UnbindPropertyViewType

func (r *PropertyTypeRepository) UnbindPropertyViewType(ctx context.Context, entity *property_type.PropertyType, viewTypeID uint) error

func (*PropertyTypeRepository) Update

Update saves a changed record in the database.

type PropertyUnitRepository

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

PropertyUnitRepository is a repository for the model entity

func NewPropertyUnitRepository

func NewPropertyUnitRepository(repository *repository, textSourceRepository text_source.Repository) (*PropertyUnitRepository, error)

New creates a new PropertyUnitRepository

func (*PropertyUnitRepository) Count

func (*PropertyUnitRepository) Create

Create saves a new record in the database.

func (PropertyUnitRepository) DB

func (r PropertyUnitRepository) DB() *gorm.DB

func (*PropertyUnitRepository) Delete

Delete (soft) deletes a Maintenance record in the database.

func (*PropertyUnitRepository) First

func (*PropertyUnitRepository) Get

Get reads the album with the specified ID from the database.

func (*PropertyUnitRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*PropertyUnitRepository) SetDefaultConditions

func (r *PropertyUnitRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*PropertyUnitRepository) TCreate

func (r *PropertyUnitRepository) TCreate(ctx context.Context, entity *property_unit.PropertyUnit, langID uint) (err error)

func (*PropertyUnitRepository) TFirst

func (*PropertyUnitRepository) TGet

func (*PropertyUnitRepository) TQuery

func (*PropertyUnitRepository) TUpdate

func (r *PropertyUnitRepository) TUpdate(ctx context.Context, entity *property_unit.PropertyUnit, langID uint) (err error)

func (*PropertyUnitRepository) Update

Update saves a changed Maintenance record in the database.

type PropertyViewTypeRepository

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

PropertyViewTypeRepository is a repository for the model entity

func NewPropertyViewTypeRepository

func NewPropertyViewTypeRepository(repository *repository, textSourceRepository text_source.Repository) (*PropertyViewTypeRepository, error)

New creates a new PropertyViewTypeRepository

func (*PropertyViewTypeRepository) Count

func (*PropertyViewTypeRepository) Create

Create saves a new record in the database.

func (PropertyViewTypeRepository) DB

func (r PropertyViewTypeRepository) DB() *gorm.DB

func (*PropertyViewTypeRepository) Delete

Delete (soft) deletes a Maintenance record in the database.

func (*PropertyViewTypeRepository) First

func (*PropertyViewTypeRepository) Get

Get reads the album with the specified ID from the database.

func (*PropertyViewTypeRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*PropertyViewTypeRepository) SetDefaultConditions

func (r *PropertyViewTypeRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*PropertyViewTypeRepository) TCreate

func (*PropertyViewTypeRepository) TFirst

func (*PropertyViewTypeRepository) TGet

func (*PropertyViewTypeRepository) TQuery

func (*PropertyViewTypeRepository) TUpdate

func (*PropertyViewTypeRepository) Update

Update saves a changed Maintenance record in the database.

type RelationRepository

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

RelationRepository is a repository for the model entity

func NewRelationRepository

func NewRelationRepository(repository *repository, propertyRepository property.Repository, entityType2PropertyRepository entity_type2property.Repository, textSourceRepository text_source.Repository) (*RelationRepository, error)

New creates a new RelationRepository

func (*RelationRepository) AfterFind

func (r *RelationRepository) AfterFind(ctx context.Context, entity *entity_type.Relation) error

func (*RelationRepository) Count

func (*RelationRepository) Create

func (r *RelationRepository) Create(ctx context.Context, entity *entity_type.Relation) error

Create saves a new record in the database.

func (RelationRepository) DB

func (r RelationRepository) DB() *gorm.DB

func (*RelationRepository) Delete

func (r *RelationRepository) Delete(ctx context.Context, entity *entity_type.Relation) error

Delete (soft) deletes a Maintenance record in the database.

func (*RelationRepository) First

func (*RelationRepository) Get

Get reads the album with the specified ID from the database.

func (*RelationRepository) GetPropertiesAndRelationsByEntityTypeID

func (r *RelationRepository) GetPropertiesAndRelationsByEntityTypeID(ctx context.Context, entityTypeID uint) ([]property.Property, []entity_type.Relation, error)

func (*RelationRepository) InitRelatedEntityTypes

func (r *RelationRepository) InitRelatedEntityTypes(ctx context.Context, entity *entity_type.Relation) error

func (*RelationRepository) PropertyAndRelationQuery

func (*RelationRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*RelationRepository) SetDefaultConditions

func (r *RelationRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*RelationRepository) TCreate

func (r *RelationRepository) TCreate(ctx context.Context, entity *entity_type.Relation, langID uint) (err error)

func (*RelationRepository) TFirst

func (r *RelationRepository) TFirst(ctx context.Context, entity *entity_type.Relation, langID uint) (*entity_type.Relation, error)

func (*RelationRepository) TGet

func (r *RelationRepository) TGet(ctx context.Context, id uint, langID uint) (*entity_type.Relation, error)

func (*RelationRepository) TGetPropertiesAndRelationsByEntityTypeID

func (r *RelationRepository) TGetPropertiesAndRelationsByEntityTypeID(ctx context.Context, entityTypeID uint, langID uint) ([]property.Property, []entity_type.Relation, error)

func (*RelationRepository) TPropertyAndRelationQuery

func (r *RelationRepository) TPropertyAndRelationQuery(ctx context.Context, cond *selection_condition.SelectionCondition, langID uint) ([]property.Property, []entity_type.Relation, error)

func (*RelationRepository) TQuery

func (*RelationRepository) TUpdate

func (r *RelationRepository) TUpdate(ctx context.Context, entity *entity_type.Relation, langID uint) (err error)

func (*RelationRepository) Update

func (r *RelationRepository) Update(ctx context.Context, entity *entity_type.Relation) error

Update saves a changed Maintenance record in the database.

type TextLangRepository

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

TextLangRepository is a repository for the model entity

func NewTextLangRepository

func NewTextLangRepository(repository *repository) (*TextLangRepository, error)

New creates a new TextLangRepository

func (*TextLangRepository) Count

func (*TextLangRepository) Create

func (r *TextLangRepository) Create(ctx context.Context, entity *text_lang.TextLang) error

Create saves a new record in the database.

func (TextLangRepository) DB

func (r TextLangRepository) DB() *gorm.DB

func (*TextLangRepository) Delete

func (r *TextLangRepository) Delete(ctx context.Context, id uint) error

Delete (soft) deletes a record in the database.

func (*TextLangRepository) First

func (*TextLangRepository) Get

Get reads the album with the specified ID from the database.

func (*TextLangRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*TextLangRepository) Save

func (r *TextLangRepository) Save(ctx context.Context, entity *text_lang.TextLang) error

Save update value in database, if the value doesn't have primary key, will insert it

func (*TextLangRepository) SetDefaultConditions

func (r *TextLangRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*TextLangRepository) Update

func (r *TextLangRepository) Update(ctx context.Context, entity *text_lang.TextLang) error

Update saves a changed record in the database.

func (*TextLangRepository) Upsert

func (r *TextLangRepository) Upsert(ctx context.Context, entity *text_lang.TextLang) error

type TextSourceRepository

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

TextSourceRepository is a repository for the model entity

func NewTextSourceRepository

func NewTextSourceRepository(repository *repository, textValueRepository text_value.Repository) (*TextSourceRepository, error)

New creates a new TextSourceRepository

func (*TextSourceRepository) Count

func (*TextSourceRepository) Create

Create saves a new record in the database.

func (*TextSourceRepository) CreateValueTx

func (r *TextSourceRepository) CreateValueTx(ctx context.Context, tx *gorm.DB, value *string, langID uint) (sourceID *uint, err error)

func (TextSourceRepository) DB

func (r TextSourceRepository) DB() *gorm.DB

func (*TextSourceRepository) Delete

func (r *TextSourceRepository) Delete(ctx context.Context, id uint) error

Delete (soft) deletes a Maintenance record in the database.

func (*TextSourceRepository) DeleteTx

func (r *TextSourceRepository) DeleteTx(ctx context.Context, tx *gorm.DB, id uint) (err error)

func (*TextSourceRepository) First

func (*TextSourceRepository) Get

Get reads the album with the specified ID from the database.

func (*TextSourceRepository) GetValuesTx

func (r *TextSourceRepository) GetValuesTx(ctx context.Context, tx *gorm.DB, langID uint, sourceIDs ...*uint) ([]*string, error)

func (*TextSourceRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*TextSourceRepository) Save

Save update value in database, if the value doesn't have primary key, will insert it

func (*TextSourceRepository) SetDefaultConditions

func (r *TextSourceRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*TextSourceRepository) TGet

TGet reads the album with the specified ID from the database.

func (*TextSourceRepository) Update

Update saves a changed Maintenance record in the database.

func (*TextSourceRepository) UpdateValueTx

func (r *TextSourceRepository) UpdateValueTx(ctx context.Context, tx *gorm.DB, sourceID *uint, value *string, langID uint) (resSourceID *uint, err error)

type TextValueRepository

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

TextValueRepository is a repository for the model entity

func NewTextValueRepository

func NewTextValueRepository(repository *repository) (*TextValueRepository, error)

New creates a new TextValueRepository

func (*TextValueRepository) Count

func (*TextValueRepository) Create

func (r *TextValueRepository) Create(ctx context.Context, entity *text_value.TextValue) error

Create saves a new record in the database.

func (*TextValueRepository) CreateTx

func (r *TextValueRepository) CreateTx(ctx context.Context, tx *gorm.DB, entity *text_value.TextValue) error

func (TextValueRepository) DB

func (r TextValueRepository) DB() *gorm.DB

func (*TextValueRepository) Delete

func (r *TextValueRepository) Delete(ctx context.Context, entity *text_value.TextValue) error

Delete (soft) deletes a Maintenance record in the database.

func (*TextValueRepository) DeleteTx

func (r *TextValueRepository) DeleteTx(ctx context.Context, tx *gorm.DB, entity *text_value.TextValue) error

func (*TextValueRepository) First

func (*TextValueRepository) FirstTx

func (*TextValueRepository) Get

Get reads the album with the specified ID from the database.

func (*TextValueRepository) GetValuesTx

func (r *TextValueRepository) GetValuesTx(ctx context.Context, tx *gorm.DB, langID uint, sourceIDs ...*uint) ([]*string, error)

func (*TextValueRepository) Query

Query retrieves the album records with the specified offset and limit from the database.

func (*TextValueRepository) QueryTx

func (*TextValueRepository) Save

Save update value in database, if the value doesn't have primary key, will insert it

func (*TextValueRepository) SetDefaultConditions

func (r *TextValueRepository) SetDefaultConditions(defaultConditions *selection_condition.SelectionCondition)

func (*TextValueRepository) Update

func (r *TextValueRepository) Update(ctx context.Context, entity *text_value.TextValue) error

Update saves a changed Maintenance record in the database.

func (*TextValueRepository) UpdateTx

func (r *TextValueRepository) UpdateTx(ctx context.Context, tx *gorm.DB, entity *text_value.TextValue) error

Jump to

Keyboard shortcuts

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