refactor: upgrade to Go 1.26 and modernize code idioms
- Replace `interface{}` with `any` type alias across all packages
- Use built-in `min()`/`max()` for parameter clamping
- Use `slices.SortFunc`, `slices.Min`, `slices.Max` for cleaner code
- Use `strings.Cut()` for simpler string parsing in auth middleware
- Use `errors.Is()` for proper error comparison in handlers
- Update dependencies: golang.org/x/image 0.37.0 -> 0.38.0
- Add Wire code generation guidelines to ARCHITECTURE.md
- Disable Go cache in CI build workflow
This commit is contained in:
@@ -164,7 +164,7 @@ func (r *reportRepository) GetPendingReportsByTarget(targetType model.ReportTarg
|
||||
|
||||
// UpdateStatus 更新举报状态
|
||||
func (r *reportRepository) UpdateStatus(id string, status model.ReportStatus, handledBy string, result string) error {
|
||||
updates := map[string]interface{}{
|
||||
updates := map[string]any{
|
||||
"status": status,
|
||||
"handled_by": handledBy,
|
||||
"result": result,
|
||||
@@ -174,7 +174,7 @@ func (r *reportRepository) UpdateStatus(id string, status model.ReportStatus, ha
|
||||
|
||||
// UpdateStatusWithContext 使用上下文更新举报状态
|
||||
func (r *reportRepository) UpdateStatusWithContext(ctx context.Context, id string, status model.ReportStatus, handledBy string, result string) error {
|
||||
updates := map[string]interface{}{
|
||||
updates := map[string]any{
|
||||
"status": status,
|
||||
"handled_by": handledBy,
|
||||
"result": result,
|
||||
@@ -184,7 +184,7 @@ func (r *reportRepository) UpdateStatusWithContext(ctx context.Context, id strin
|
||||
|
||||
// BatchUpdateStatus 批量更新举报状态
|
||||
func (r *reportRepository) BatchUpdateStatus(ids []string, status model.ReportStatus, handledBy string, result string) (int64, error) {
|
||||
updates := map[string]interface{}{
|
||||
updates := map[string]any{
|
||||
"status": status,
|
||||
"handled_by": handledBy,
|
||||
"result": result,
|
||||
@@ -195,7 +195,7 @@ func (r *reportRepository) BatchUpdateStatus(ids []string, status model.ReportSt
|
||||
|
||||
// BatchUpdateStatusWithContext 使用上下文批量更新举报状态
|
||||
func (r *reportRepository) BatchUpdateStatusWithContext(ctx context.Context, ids []string, status model.ReportStatus, handledBy string, result string) (int64, error) {
|
||||
updates := map[string]interface{}{
|
||||
updates := map[string]any{
|
||||
"status": status,
|
||||
"handled_by": handledBy,
|
||||
"result": result,
|
||||
@@ -209,4 +209,4 @@ func (r *reportRepository) GetByIDsWithContext(ctx context.Context, ids []string
|
||||
var reports []*model.Report
|
||||
err := r.getDB(ctx).Where("id IN ?", ids).Find(&reports).Error
|
||||
return reports, err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user