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:
@@ -113,7 +113,7 @@ func (r *pushRecordRepository) BatchUpdateStatus(ids []int64, status model.PushS
|
||||
if len(ids) == 0 {
|
||||
return nil
|
||||
}
|
||||
updates := map[string]interface{}{
|
||||
updates := map[string]any{
|
||||
"push_status": status,
|
||||
}
|
||||
if status == model.PushStatusPushed {
|
||||
@@ -126,7 +126,7 @@ func (r *pushRecordRepository) BatchUpdateStatus(ids []int64, status model.PushS
|
||||
|
||||
// UpdateStatus 更新单条记录状态
|
||||
func (r *pushRecordRepository) UpdateStatus(id int64, status model.PushStatus) error {
|
||||
updates := map[string]interface{}{
|
||||
updates := map[string]any{
|
||||
"push_status": status,
|
||||
}
|
||||
if status == model.PushStatusPushed {
|
||||
@@ -141,7 +141,7 @@ func (r *pushRecordRepository) UpdateStatus(id int64, status model.PushStatus) e
|
||||
func (r *pushRecordRepository) MarkAsFailed(id int64, errMsg string) error {
|
||||
return r.db.Model(&model.PushRecord{}).
|
||||
Where("id = ?", id).
|
||||
Updates(map[string]interface{}{
|
||||
Updates(map[string]any{
|
||||
"push_status": model.PushStatusFailed,
|
||||
"error_message": errMsg,
|
||||
"retry_count": gorm.Expr("retry_count + 1"),
|
||||
@@ -152,7 +152,7 @@ func (r *pushRecordRepository) MarkAsFailed(id int64, errMsg string) error {
|
||||
func (r *pushRecordRepository) MarkAsDelivered(id int64) error {
|
||||
return r.db.Model(&model.PushRecord{}).
|
||||
Where("id = ?", id).
|
||||
Updates(map[string]interface{}{
|
||||
Updates(map[string]any{
|
||||
"push_status": model.PushStatusDelivered,
|
||||
"delivered_at": time.Now(),
|
||||
}).Error
|
||||
|
||||
Reference in New Issue
Block a user