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-06-01 20:06:43 +08:00
|
|
|
Type string
|
|
|
|
Name string
|
|
|
|
Count int
|
2023-05-31 16:36:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|