25 lines
687 B
Go
25 lines
687 B
Go
package role
|
|
|
|
import "context"
|
|
|
|
// Repository định nghĩa các phương thức làm việc với dữ liệu vai trò
|
|
type Repository interface {
|
|
// Create tạo mới vai trò
|
|
Create(ctx context.Context, role *Role) error
|
|
|
|
// GetByID lấy thông tin vai trò theo ID
|
|
GetByID(ctx context.Context, id int) (*Role, error)
|
|
|
|
// GetByName lấy thông tin vai trò theo tên
|
|
GetByName(ctx context.Context, name string) (*Role, error)
|
|
|
|
// List lấy danh sách vai trò
|
|
List(ctx context.Context) ([]*Role, error)
|
|
|
|
// Update cập nhật thông tin vai trò
|
|
Update(ctx context.Context, role *Role) error
|
|
|
|
// Delete xóa vai trò
|
|
Delete(ctx context.Context, id int) error
|
|
}
|