mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
enhance: Resolve existing lint issues (#40797)
This PR - Format import issues in datacoord & datanode - Fix JSONPathIndex naming issue Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
e23f429299
commit
77515310b9
@ -20,24 +20,24 @@ import (
|
|||||||
"github.com/milvus-io/milvus/pkg/v2/common"
|
"github.com/milvus-io/milvus/pkg/v2/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Index = &JsonPathIndex{}
|
var _ Index = &JSONPathIndex{}
|
||||||
|
|
||||||
// JsonPathIndex is the pre-defined index model for json path scalar index.
|
// JSONPathIndex is the pre-defined index model for json path scalar index.
|
||||||
type JsonPathIndex struct {
|
type JSONPathIndex struct {
|
||||||
scalarIndex
|
scalarIndex
|
||||||
jsonCastType string
|
jsonCastType string
|
||||||
jsonPath string
|
jsonPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithIndexName setup the index name of JsonPathIndex.
|
// WithIndexName setup the index name of JsonPathIndex.
|
||||||
func (idx *JsonPathIndex) WithIndexName(name string) *JsonPathIndex {
|
func (idx *JSONPathIndex) WithIndexName(name string) *JSONPathIndex {
|
||||||
idx.name = name
|
idx.name = name
|
||||||
return idx
|
return idx
|
||||||
}
|
}
|
||||||
|
|
||||||
// Params implements Index interface
|
// Params implements Index interface
|
||||||
// returns the create index related parameters.
|
// returns the create index related parameters.
|
||||||
func (idx *JsonPathIndex) Params() map[string]string {
|
func (idx *JSONPathIndex) Params() map[string]string {
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
IndexTypeKey: string(idx.indexType),
|
IndexTypeKey: string(idx.indexType),
|
||||||
common.JSONCastTypeKey: idx.jsonCastType,
|
common.JSONCastTypeKey: idx.jsonCastType,
|
||||||
@ -45,9 +45,9 @@ func (idx *JsonPathIndex) Params() map[string]string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewJsonPathIndex creates a `JsonPathIndex` with provided parameters.
|
// NewJSONPathIndex creates a `JsonPathIndex` with provided parameters.
|
||||||
func NewJsonPathIndex(indexType IndexType, jsonCastType string, jsonPath string) *JsonPathIndex {
|
func NewJSONPathIndex(indexType IndexType, jsonCastType string, jsonPath string) *JSONPathIndex {
|
||||||
return &JsonPathIndex{
|
return &JSONPathIndex{
|
||||||
scalarIndex: scalarIndex{
|
scalarIndex: scalarIndex{
|
||||||
indexType: indexType,
|
indexType: indexType,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -36,7 +36,7 @@ func TestJsonPathIndex(t *testing.T) {
|
|||||||
indexType := indexTypes[rand.Intn(len(indexTypes))]
|
indexType := indexTypes[rand.Intn(len(indexTypes))]
|
||||||
castType := jsonCastTypes[rand.Intn(len(jsonCastTypes))]
|
castType := jsonCastTypes[rand.Intn(len(jsonCastTypes))]
|
||||||
|
|
||||||
idx := NewJsonPathIndex(indexType, castType, jsonPath).WithIndexName(indexName)
|
idx := NewJSONPathIndex(indexType, castType, jsonPath).WithIndexName(indexName)
|
||||||
assert.Equal(t, indexType, idx.IndexType())
|
assert.Equal(t, indexType, idx.IndexType())
|
||||||
assert.Equal(t, indexName, idx.Name())
|
assert.Equal(t, indexName, idx.Name())
|
||||||
|
|
||||||
|
|||||||
@ -19,9 +19,10 @@ package datacoord
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/metastore"
|
"github.com/milvus-io/milvus/internal/metastore"
|
||||||
"github.com/milvus-io/milvus/pkg/v2/log"
|
"github.com/milvus-io/milvus/pkg/v2/log"
|
||||||
|
|||||||
@ -26,6 +26,7 @@ package index
|
|||||||
#include "indexbuilder/init_c.h"
|
#include "indexbuilder/init_c.h"
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
package index
|
package index
|
||||||
|
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|||||||
@ -20,13 +20,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus/internal/util/dependency"
|
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
|
||||||
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
||||||
"github.com/milvus-io/milvus/internal/storage"
|
"github.com/milvus-io/milvus/internal/storage"
|
||||||
|
"github.com/milvus-io/milvus/internal/util/dependency"
|
||||||
"github.com/milvus-io/milvus/pkg/v2/common"
|
"github.com/milvus-io/milvus/pkg/v2/common"
|
||||||
"github.com/milvus-io/milvus/pkg/v2/proto/etcdpb"
|
"github.com/milvus-io/milvus/pkg/v2/proto/etcdpb"
|
||||||
"github.com/milvus-io/milvus/pkg/v2/proto/indexpb"
|
"github.com/milvus-io/milvus/pkg/v2/proto/indexpb"
|
||||||
|
|||||||
@ -26,6 +26,7 @@ package index
|
|||||||
#include "indexbuilder/init_c.h"
|
#include "indexbuilder/init_c.h"
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/cockroachdb/errors"
|
"github.com/cockroachdb/errors"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user