save insights explorer to database

This commit is contained in:
MaysWind
2026-01-07 01:04:54 +08:00
parent d4d1342c70
commit d462d0164c
36 changed files with 2091 additions and 286 deletions
+30
View File
@@ -0,0 +1,30 @@
package models
import (
"sort"
"testing"
"github.com/stretchr/testify/assert"
)
func TestInsightsExplorerInfoResponseSliceLess(t *testing.T) {
var insightsExplorerRespSlice InsightsExplorerInfoResponseSlice
insightsExplorerRespSlice = append(insightsExplorerRespSlice, &InsightsExplorerInfoResponse{
Id: 1,
DisplayOrder: 3,
})
insightsExplorerRespSlice = append(insightsExplorerRespSlice, &InsightsExplorerInfoResponse{
Id: 2,
DisplayOrder: 1,
})
insightsExplorerRespSlice = append(insightsExplorerRespSlice, &InsightsExplorerInfoResponse{
Id: 3,
DisplayOrder: 2,
})
sort.Sort(insightsExplorerRespSlice)
assert.Equal(t, int64(2), insightsExplorerRespSlice[0].Id)
assert.Equal(t, int64(3), insightsExplorerRespSlice[1].Id)
assert.Equal(t, int64(1), insightsExplorerRespSlice[2].Id)
}