bill-server-go/internal/label/domain.go

32 lines
855 B
Go
Raw Normal View History

2023-05-31 16:36:45 +08:00
package label
2023-06-01 19:40:48 +08:00
import (
"context"
"gorm.io/gorm"
)
2023-05-31 16:36:45 +08:00
type Label struct {
2023-06-01 19:40:48 +08:00
gorm.Model
2023-05-31 16:36:45 +08:00
ID int `json:"id"`
Type string `json:"type"`
Name string `json:"name"`
RelativeId int `json:"relativeId"`
Count int `json:"count"`
}
type LabelRepository interface {
2023-06-01 19:40:48 +08:00
GetLabels(ctx context.Context) ([]Label, error)
2023-05-31 16:36:45 +08:00
GetLabelById(ctx context.Context, id int) (*Label, error)
CreateLabel(ctx context.Context, label *Label) error
UpdateLabel(ctx context.Context, label *Label) error
DeleteLabel(ctx context.Context, id int) error
}
type LabelService interface {
2023-06-01 19:40:48 +08:00
GetLabels(ctx context.Context) ([]Label, error)
2023-05-31 16:36:45 +08:00
GetLabelById(ctx context.Context, id int) (*Label, error)
CreateLabel(ctx context.Context, label *Label) error
UpdateLabel(ctx context.Context, label *Label) error
DeleteLabel(ctx context.Context, id int) error
}