Documentation ¶
Index ¶
Constants ¶
View Source
const ( EntityName = "propertyUnit" TableName = "property_unit" SysnameItem = "item" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IService ¶
type IService interface { NewEntity() *PropertyUnit DataInit(ctx context.Context, unitsConfig config.PropertyUnits) error Get(ctx context.Context, id uint) (*PropertyUnit, error) First(ctx context.Context, entity *PropertyUnit) (*PropertyUnit, error) Query(ctx context.Context, query *selection_condition.SelectionCondition) ([]PropertyUnit, error) Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error) Create(ctx context.Context, entity *PropertyUnit) error Update(ctx context.Context, entity *PropertyUnit) error Delete(ctx context.Context, entity *PropertyUnit) error TGet(ctx context.Context, id uint, langID uint) (*PropertyUnit, error) TFirst(ctx context.Context, entity *PropertyUnit, langID uint) (*PropertyUnit, error) TQuery(ctx context.Context, cond *selection_condition.SelectionCondition, langID uint) ([]PropertyUnit, error) TCreate(ctx context.Context, entity *PropertyUnit, langID uint) (err error) TUpdate(ctx context.Context, entity *PropertyUnit, langID uint) (err 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, langFinder text_lang.LangFinder) IService
NewService creates a new service.
type PropertyUnit ¶
type PropertyUnit 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"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deletedAt,omitempty"` }
PropertyUnit ...
func (*PropertyUnit) TableName ¶
func (e *PropertyUnit) TableName() string
func (PropertyUnit) Validate ¶
func (e PropertyUnit) 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) (*PropertyUnit, error) First(ctx context.Context, entity *PropertyUnit) (*PropertyUnit, error) // Query returns the list of albums with the given offset and limit. Query(ctx context.Context, cond *selection_condition.SelectionCondition) ([]PropertyUnit, error) Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error) Create(ctx context.Context, entity *PropertyUnit) error Update(ctx context.Context, entity *PropertyUnit) error Delete(ctx context.Context, entity *PropertyUnit) error TGet(ctx context.Context, id uint, langID uint) (*PropertyUnit, error) TFirst(ctx context.Context, entity *PropertyUnit, langID uint) (*PropertyUnit, error) TQuery(ctx context.Context, cond *selection_condition.SelectionCondition, langID uint) ([]PropertyUnit, error) TCreate(ctx context.Context, entity *PropertyUnit, langID uint) (err error) TUpdate(ctx context.Context, entity *PropertyUnit, langID uint) (err error) }
Repository encapsulates the logic to access albums from the data source.
Click to show internal directories.
Click to hide internal directories.