22 lines
518 B
Go
22 lines
518 B
Go
package service
|
|
|
|
import (
|
|
bgm "bgm/helper"
|
|
"bgm/model"
|
|
ctxLogger "github.com/luizsuper/ctxLoggers"
|
|
"go.uber.org/zap"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
func CreatCategory(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
|
|
}
|
|
|
|
func GetCategoryDto(page, size int, query bgm.QueryMap, db *gorm.DB) (*[]model.Category, error) {
|
|
return model.GetCategoryM(page, size, query, db)
|
|
}
|