Documentation
¶
Index ¶
Constants ¶
View Source
const ( EntityName = "propertyType" TableName = "property_type" SysnameRelation = "relation" SysnameBoolean = "boolean" SysnameInt = "int" SysnameFloat = "float" SysnameDate = "date" SysnameTime = "time" SysnameText = "text" SysnameUText = "utext" IDRelation = 1 IDBoolean = 2 IDInt = 3 IDFloat = 4 IDDate = 5 IDTime = 6 IDText = 7 IDUText = 8 Count = 7 // для табличной интерпретации )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type IService ¶
type IService interface { NewEntity() *PropertyType DataInit(ctx context.Context) error Get(ctx context.Context, id uint) (*PropertyType, error) First(ctx context.Context, entity *PropertyType) (*PropertyType, error) Query(ctx context.Context, query *selection_condition.SelectionCondition) ([]PropertyType, error) Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error) Create(ctx context.Context, entity *PropertyType) error Update(ctx context.Context, entity *PropertyType) error Delete(ctx context.Context, entity *PropertyType) error InitPropertyViewTypes(ctx context.Context, entity *PropertyType) error BindPropertyViewType(ctx context.Context, entity *PropertyType, viewTypeID uint) error UnbindPropertyViewType(ctx context.Context, entity *PropertyType, viewTypeID uint) error TGet(ctx context.Context, id uint, langID uint) (*PropertyType, error) TFirst(ctx context.Context, entity *PropertyType, langID uint) (*PropertyType, error) TQuery(ctx context.Context, cond *selection_condition.SelectionCondition, langID uint) ([]PropertyType, error) TCreate(ctx context.Context, entity *PropertyType, langID uint) error TUpdate(ctx context.Context, entity *PropertyType, langID uint) error GetSysnames(ctx context.Context) ([]string, error) GetSysnamesEmptyInterfaceSlice(ctx context.Context) ([]interface{}, error) GetMapSysnameID(ctx context.Context) (map[string]uint, error) GetMapIDSysname(ctx context.Context) (map[uint]string, error) GetIDBySysname(ctx context.Context, sysname string) (uint, error) GetSysnameByID(ctx context.Context, id uint) (string, error) }
IService encapsulates usecase logic.
func NewService ¶
func NewService(logger log.Logger, repo Repository, propertyType2propertyViewTypeRepository property_type2property_view_type.Repository, langFinder text_lang.LangFinder) IService
NewService creates a new service.
type PropertyType ¶
type PropertyType struct { ID uint `gorm:"type:bigserial;primaryKey" json:"id"` Sysname string `gorm:"type:varchar(100) not null;unique;index" json:"sysname"` NameSourceID *uint `gorm:"type:bigint null REFERENCES \"text_source\"(id);index" json:"-"` DescriptionSourceID *uint `gorm:"type:bigint null REFERENCES \"text_source\"(id);index" json:"-"` Name *string `gorm:"-" json:"name"` Description *string `gorm:"-" json:"description"` PropertyViewTypes []property_view_type.PropertyViewType `gorm:"many2many:property_type2property_view_type;"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt,omitempty"` }
PropertyType ...
func (PropertyType) GetPropertyViewTypes ¶
func (e PropertyType) GetPropertyViewTypes() ([]property_view_type.PropertyViewType, error)
func (*PropertyType) TableName ¶
func (e *PropertyType) TableName() string
func (PropertyType) Validate ¶
func (e PropertyType) Validate() error
type Repository ¶
type Repository interface { SetDefaultConditions(conditions *selection_condition.SelectionCondition) // Get returns the album with the specified album ID. Get(ctx context.Context, id uint) (*PropertyType, error) First(ctx context.Context, entity *PropertyType) (*PropertyType, error) // Query returns the list of items with the given conditions. Query(ctx context.Context, cond *selection_condition.SelectionCondition) ([]PropertyType, error) Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error) Create(ctx context.Context, entity *PropertyType) error Update(ctx context.Context, entity *PropertyType) error Delete(ctx context.Context, entity *PropertyType) error InitPropertyViewTypes(ctx context.Context, entity *PropertyType) error BindPropertyViewType(ctx context.Context, entity *PropertyType, viewTypeID uint) error UnbindPropertyViewType(ctx context.Context, entity *PropertyType, viewTypeID uint) error TGet(ctx context.Context, id uint, langID uint) (*PropertyType, error) TFirst(ctx context.Context, entity *PropertyType, langID uint) (*PropertyType, error) TQuery(ctx context.Context, cond *selection_condition.SelectionCondition, langID uint) ([]PropertyType, error) TCreate(ctx context.Context, entity *PropertyType, langID uint) error TUpdate(ctx context.Context, entity *PropertyType, langID uint) error }
Repository encapsulates the logic to access albums from the data source.
Click to show internal directories.
Click to hide internal directories.