app-cloudep-trade-service/internal/logic/orderservice/utils.go

21 lines
355 B
Go
Raw Normal View History

2024-10-27 16:01:55 +00:00
package orderservicelogic
import (
"github.com/shopspring/decimal"
"github.com/zeromicro/go-zero/core/logx"
)
func decimalPtrFromString(val string) *decimal.Decimal {
if val == "" {
return nil
}
dec, err := decimal.NewFromString(val)
if err != nil {
logx.Errorf("Failed to convert string to decimal: %v", err)
return nil
}
return &dec
}