package db import ( "context" "gorm.io/gorm" "youngee_m_api/model/gorm_model" ) func GetProductByID(ctx context.Context, productID int64) (*gorm_model.YounggeeProduct, error) { db := GetReadDB(ctx) product := &gorm_model.YounggeeProduct{} err := db.First(&product, productID).Error if err != nil { if err == gorm.ErrRecordNotFound { return nil, nil } else { return nil, err } } return product, nil }