初始
This commit is contained in:
29
test/kdTree_test.go
Normal file
29
test/kdTree_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/model/entity"
|
||||
)
|
||||
|
||||
// 获取指定方阵所有的数据
|
||||
func TestGetMatrixData(t *testing.T) {
|
||||
var matrix []entity.PvModule
|
||||
// 获取指定方阵所有的数据
|
||||
FangzhenID := 23
|
||||
if err := dao.PvModule.Ctx(context.Background()).Where(dao.PvModule.Columns().SubProjectid, FangzhenID).
|
||||
Where(dao.PvModule.Columns().Type, 15).
|
||||
Limit(100000).Scan(&matrix); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// json
|
||||
data, _ := json.Marshal(matrix)
|
||||
|
||||
// 保存为文件
|
||||
os.WriteFile("matrix.json", data, 0o644)
|
||||
}
|
Reference in New Issue
Block a user