2025-03-02 04:36:17 +08:00
|
|
|
package newsrepository
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"legalgo-BE-go/database"
|
|
|
|
|
)
|
|
|
|
|
|
2025-03-05 21:21:44 +08:00
|
|
|
func (a *accessor) CreateModel(spec database.News) error {
|
2025-03-02 04:36:17 +08:00
|
|
|
if err := a.db.Create(&spec).Error; err != nil {
|
|
|
|
|
return fmt.Errorf("failed to create news: %w", err)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|