common

package
v2.3.1-heliumos Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIntFieldName       = "int64"
	DefaultFloatFieldName     = "float"
	DefaultVarcharFieldName   = "varchar"
	DefaultJSONFieldName      = "json"
	DefaultFloatVecFieldName  = "floatVec"
	DefaultBinaryVecFieldName = "binaryVec"
	DefaultDynamicNumberField = "dynamicNumber"
	DefaultDynamicStringField = "dynamicString"
	DefaultDynamicBoolField   = "dynamicBool"
	DefaultDynamicListField   = "dynamicList"
	RowCount                  = "row_count"
	DefaultTimeout            = 120
	DefaultDim                = int64(128)
	DefaultShards             = int32(2)
	DefaultNb                 = 3000
	DefaultNq                 = 5
	DefaultTopK               = 10
)

const default value for test

View Source
const (
	MaxPartitionNum         = 4096
	DefaultDynamicFieldName = "$meta"
	DefaultPartition        = "_default"
	DefaultIndexName        = "_default_idx_102"
	DefaultIndexNameBinary  = "_default_idx_100"
	DefaultRgName           = "__default_resource_group"
	DefaultDb               = "default"
	DefaultConsistencyLevel = entity.ClBounded
	MaxDim                  = 32768
	DefaultMaxLength        = int64(65535)
	MaxCollectionNameLen    = 255
	DefaultRgCapacity       = 1000000
	RetentionDuration       = 40 // common.retentionDuration
)

const default value from milvus

Variables

View Source
var IndexStateValue = map[string]int32{
	"IndexStateNone": 0,
	"Unissued":       1,
	"InProgress":     2,
	"Finished":       3,
	"Failed":         4,
	"Retry":          5,
}

Functions

func CheckCollection

func CheckCollection(t *testing.T, actualCollection *entity.Collection, expCollName string, expShardNum int32,
	expSchema *entity.Schema, expConsistencyLevel entity.ConsistencyLevel)

CheckCollection check collection

func CheckContainsCollection

func CheckContainsCollection(t *testing.T, collections []*entity.Collection, collName string)

CheckContainsCollection check collections contains collName

func CheckContainsDb

func CheckContainsDb(t *testing.T, dbs []entity.Database, dbName string)

CheckContainsDb check collections contains collName

func CheckErr

func CheckErr(t *testing.T, actualErr error, expErrNil bool, expErrorMsg ...string)

CheckErr check err and errMsg

func CheckIndexResult

func CheckIndexResult(t *testing.T, actualIndexes []entity.Index, expIndexes ...entity.Index)

CheckIndexResult check index result, index type, metric type, index params

func CheckInsertResult

func CheckInsertResult(t *testing.T, actualIds entity.Column, expIds entity.Column)

CheckInsertResult check insert result, ids len (insert count), ids data (pks, but no auto ids)

func CheckNotContainsCollection

func CheckNotContainsCollection(t *testing.T, collections []*entity.Collection, collName string)

CheckNotContainsCollection check collections not contains collName

func CheckNotContainsDb

func CheckNotContainsDb(t *testing.T, dbs []entity.Database, dbName string)

CheckNotContainsDb check collections contains collName

func CheckOutputFields

func CheckOutputFields(t *testing.T, actualColumns []entity.Column, expFields []string)

CheckOutputFields check query output fields

func CheckPersistentSegments

func CheckPersistentSegments(t *testing.T, actualSegments []*entity.Segment, expNb int64)

CheckPersistentSegments check persistent segments

func CheckQueryResult

func CheckQueryResult(t *testing.T, actualColumns []entity.Column, expColumns []entity.Column)

CheckQueryResult check query result, column name, type and field

func CheckResourceGroup

func CheckResourceGroup(t *testing.T, actualRg *entity.ResourceGroup, expRg *entity.ResourceGroup)

func CheckSearchResult

func CheckSearchResult(t *testing.T, actualSearchResults []client.SearchResult, expNq int, expTopK int)

CheckSearchResult check search result, check nq, topk, ids, score

func EqualColumn

func EqualColumn(t *testing.T, columnA entity.Column, columnB entity.Column)

EqualColumn assert field data is equal of two columns

func EqualFields

func EqualFields(t *testing.T, fieldA *entity.Field, fieldB *entity.Field)

EqualFields equal two fields

func EqualSchema

func EqualSchema(t *testing.T, schemaA entity.Schema, schemaB entity.Schema)

EqualSchema equal two schemas

func GenAllFields

func GenAllFields() []*entity.Field

GenAllFields gen fields with all scala field types

func GenAllFieldsData

func GenAllFieldsData(start int, nb int, dim int64) []entity.Column

func GenAllFieldsRows

func GenAllFieldsRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}

func GenAllFloatIndex

func GenAllFloatIndex(metricType entity.MetricType) []entity.Index

GenAllFloatIndex gen all float vector index

func GenColumnData

func GenColumnData(start int, nb int, fieldType entity.FieldType, fieldName string, opts ...GenColumnDataOption) entity.Column

GenColumnData GenColumnDataOption

func GenDefaultBinaryData

func GenDefaultBinaryData(start int, nb int, dim int64) (entity.Column, entity.Column, entity.Column)

GenDefaultBinaryData gen default binary collection data

func GenDefaultBinaryFields

func GenDefaultBinaryFields(autoID bool, dim int64) []*entity.Field

GenDefaultBinaryFields gen default binary fields with int64, float, binaryVector field

func GenDefaultBinaryRows

func GenDefaultBinaryRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}

func GenDefaultColumnData

func GenDefaultColumnData(start int, nb int, dim int64) (entity.Column, entity.Column, entity.Column)

GenDefaultColumnData gen default column with data

func GenDefaultFields

func GenDefaultFields(autoID bool) []*entity.Field

GenDefaultFields gen default fields with int64, float, floatVector field

func GenDefaultJSONData

func GenDefaultJSONData(columnName string, start int, nb int) *entity.ColumnJSONBytes

GenDefaultJSONData gen default column with data

func GenDefaultJSONRows

func GenDefaultJSONRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}

func GenDefaultRows

func GenDefaultRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}

func GenDefaultVarcharData

func GenDefaultVarcharData(start int, nb int, dim int64) (entity.Column, entity.Column)

func GenDefaultVarcharFields

func GenDefaultVarcharFields(autoID bool) []*entity.Field

GenDefaultVarcharFields gen default fields with varchar, floatVector field

func GenDefaultVarcharRows

func GenDefaultVarcharRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}

func GenDynamicFieldData

func GenDynamicFieldData(start int, nb int) []entity.Column

func GenField

func GenField(name string, fieldType entity.FieldType, opts ...CreateFieldOption) *entity.Field

func GenLongString

func GenLongString(n int) string

GenLongString gen invalid long string

func GenRandomString

func GenRandomString(n int) string

GenRandomString gen random string

func GenSchema

func GenSchema(name string, autoID bool, fields []*entity.Field, opts ...CreateSchemaOption) *entity.Schema

gen schema

func GenSearchVectors

func GenSearchVectors(nq int, dim int64, dataType entity.FieldType) []entity.Vector

GenSearchVectors gen search vectors

func MergeColumnsToDynamic

func MergeColumnsToDynamic(nb int, columns []entity.Column) *entity.ColumnJSONBytes

Types

type CreateFieldOption

type CreateFieldOption func(field *entity.Field)

CreateFieldOption is an option that is used to modify entity.Schema

func WithAutoID

func WithAutoID(autoID bool) CreateFieldOption

func WithDim

func WithDim(dim int64) CreateFieldOption

func WithFieldDescription

func WithFieldDescription(desc string) CreateFieldOption

func WithIsPartitionKey

func WithIsPartitionKey(isPartitionKey bool) CreateFieldOption

func WithIsPrimaryKey

func WithIsPrimaryKey(isPrimaryKey bool) CreateFieldOption

func WithMaxLength

func WithMaxLength(maxLen int64) CreateFieldOption

func WithTypeParams

func WithTypeParams(key string, value string) CreateFieldOption

type CreateSchemaOption

type CreateSchemaOption func(schema *entity.Schema)

CreateSchemaOption is an option that is used to modify entity.Schema

func WithDescription

func WithDescription(desc string) CreateSchemaOption

func WithEnableDynamicField

func WithEnableDynamicField(enableDF bool) CreateSchemaOption

type Dynamic

type Dynamic struct {
	Number int32   `json:"dynamicNumber" milvus:"name:dynamicNumber"`
	String string  `json:"dynamicString" milvus:"name:dynamicString"`
	Bool   bool    `json:"dynamicBool" milvus:"name:dynamicBool"`
	List   []int64 `json:"dynamicList" milvus:"name:dynamicList"`
}

type GenColumnDataOption

type GenColumnDataOption func(opt *genDataOpt)

func WithVectorDim

func WithVectorDim(dim int64) GenColumnDataOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL