package employeecollection import ( "strconv" "strings" "github.com/break/junhong_cmp_fiber/pkg/errors" ) // auditEventMaxLength 是统一审计事件标识的列宽上限,与 tb_audit_event.event_id 保持一致。 const auditEventMaxLength = 64 // composeAuditEventID 以冒号连接业务标识片段,生成确定性的审计事件标识。 // 超出审计列宽时返回稳定错误,避免写入时分段截断或事务被数据库拒绝。 func composeAuditEventID(parts ...string) (string, error) { eventID := strings.Join(parts, ":") if len(eventID) > auditEventMaxLength { return "", errors.New(errors.CodeInternalError, "审计事件标识超出长度限制") } return eventID, nil } // uintText 将主键转为审计标识片段。 func uintText(value uint) string { return strconv.FormatUint(uint64(value), 10) } // intText 将序号转为审计标识片段。 func intText(value int) string { return strconv.Itoa(value) }