17 lines
350 B
Go
17 lines
350 B
Go
|
package service
|
||
|
|
||
|
import (
|
||
|
"bgm/model"
|
||
|
ctxLogger "github.com/luizsuper/ctxLoggers"
|
||
|
"go.uber.org/zap"
|
||
|
"gorm.io/gorm"
|
||
|
)
|
||
|
|
||
|
func CreateCategory(category *model.Category, db *gorm.DB) error {
|
||
|
if err := db.Create(category).Error; err != nil {
|
||
|
ctxLogger.Info(nil, "createService err", zap.String("err info", err.Error()))
|
||
|
return err
|
||
|
}
|
||
|
return nil
|
||
|
}
|