property_group

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityName = "propertyGroup"
	TableName  = "property_group"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IService

type IService interface {
	NewEntity() *PropertyGroup
	Get(ctx context.Context, id uint) (*PropertyGroup, error)
	First(ctx context.Context, entity *PropertyGroup) (*PropertyGroup, error)
	Query(ctx context.Context, query *selection_condition.SelectionCondition) ([]PropertyGroup, error)
	Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error)
	Create(ctx context.Context, entity *PropertyGroup) error
	Update(ctx context.Context, entity *PropertyGroup) error
	Delete(ctx context.Context, entity *PropertyGroup) error
	TGet(ctx context.Context, id uint, langID uint) (*PropertyGroup, error)
	TFirst(ctx context.Context, entity *PropertyGroup, langID uint) (*PropertyGroup, error)
	TQuery(ctx context.Context, cond *selection_condition.SelectionCondition, langID uint) ([]PropertyGroup, error)
	TCreate(ctx context.Context, entity *PropertyGroup, langID uint) (err error)
	TUpdate(ctx context.Context, entity *PropertyGroup, 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) IService

NewService creates a new service.

type PropertyGroup

type PropertyGroup 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:"-"`
	SortOrder           uint           `gorm:"type:smallint;not null;default:9999" json:"sortOrder"`
	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"`
}

PropertyGroup ...

func New

func New() *PropertyGroup

New func is a constructor for the PropertyGroup

func (*PropertyGroup) TableName

func (e *PropertyGroup) TableName() string

func (PropertyGroup) Validate

func (e PropertyGroup) 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) (*PropertyGroup, error)
	First(ctx context.Context, entity *PropertyGroup) (*PropertyGroup, error)
	// Query returns the list of items with the given conditions.
	Query(ctx context.Context, cond *selection_condition.SelectionCondition) ([]PropertyGroup, error)
	Count(ctx context.Context, cond *selection_condition.SelectionCondition) (int64, error)
	Create(ctx context.Context, entity *PropertyGroup) error
	Update(ctx context.Context, entity *PropertyGroup) error
	Delete(ctx context.Context, entity *PropertyGroup) error
	TGet(ctx context.Context, id uint, langID uint) (*PropertyGroup, error)
	TFirst(ctx context.Context, entity *PropertyGroup, langID uint) (*PropertyGroup, error)
	TQuery(ctx context.Context, cond *selection_condition.SelectionCondition, langID uint) ([]PropertyGroup, error)
	TCreate(ctx context.Context, entity *PropertyGroup, langID uint) (err error)
	TUpdate(ctx context.Context, entity *PropertyGroup, langID uint) (err error)
}

Repository encapsulates the logic to access albums from the data source.

Jump to

Keyboard shortcuts

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