topfans/backend/services/moderationService/service/helpers.go
2026-07-06 16:22:26 +08:00

10 lines
304 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package service
// strPtrOrNil 把字符串转成 *string空串返回 nil以便 GORM 把 NULL 写入可空列。
// 用于证据 oss_url 等"可空字符串"字段,避免出现空字符串而非 NULL 的脏数据。
func strPtrOrNil(s string) *string {
if s == "" {
return nil
}
return &s
}