跳到主要内容

Columns

The struct types on this page implement the method signatures of the entity.Column interface.

entity.ColumnBool

This struct type defines a boolean column. You can use entity.NewColumnBool() to create one for the insert() request as follows:

// Initiate a boolean column
columnBool := entity.NewColumnBool(name string, values []bool)

// Add more values to the column
columnBool.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]bool

Return all data in the column.

ValueByIdx(idx int)

bool, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnBoolArray

This struct type defines a boolean array column. You can use entity.NewColumnBoolArray() to create one for the insert() request as follows:

// Initiate a boolean array column
columnBoolArray := entity.NewColumnBoolArray(name string, values [][]bool)

// Add more values to the column
columnBoolArray.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]bool

Return all data in the column.

ValueByIdx(idx int)

[]bool, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnDouble

This struct type defines a double column. You can use entity.NewColumnDouble() to create one for the insert() request as follows:

// Initiate a double column
columnDouble := entity.NewColumnDouble(name string, values []float64)

// Add more values to the column
columnDouble.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]float64

Return all data in the column.

ValueByIdx(idx int)

float64, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsString()

  • GetAsInt64()

entity.ColumnDoubleArray

This struct type defines a double array column. You can use entity.NewColumnDoubleArray() to create one for the insert() request as follows:

// Initiate a double array column
columnDoubleArray := entity.NewColumnDoubleArray(name string, values [][]float64)

// Add more values to the column
columnDoubleArray.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]float64

Return all data in the column.

ValueByIdx(idx int)

[]float64, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnFloat

This struct type defines a float column. You can use entity.NewColumnFloat() to create one for the insert() request as follows:

// Initiate a float column
columnFloat := entity.NewColumnFloat(name string, values []float32)

// Add more values to the column
columnFloat.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]float32

Return all data in the column.

ValueByIdx(idx int)

float32, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsString()

  • GetAsInt64()

entity.ColumnFloatArray

This struct type defines a float array column. You can use entity.NewColumnFloatArray() to create one for the insert() request as follows:

// Initiate a float array column
columnFloatArray := entity.NewColumnFloatArray(name string, values [][]float32)

// Add more values to the column
columnFloatArray.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]float32

Return all data in the column.

ValueByIdx(idx int)

[]float32, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnInt8

This struct type defines an Int8 column. You can use entity.NewColumnInt8() to create one for the insert() request as follows:

// Initiate an int8 column
columnInt8 := entity.NewColumnInt8(name string, values []int8)

// Add more values to the column
columnInt8.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]int8

Return all data in the column.

ValueByIdx(idx int)

int8, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

entity.ColumnInt8Array

This struct type defines an Int8 array column. You can use entity.NewColumnInt8Array() to create one for the insert() request as follows:

// Initiate an int8 array column
columnInt8Array := entity.NewColumnInt8Array(name string, values [][]int8)

// Add more values to the column
columnInt8Array.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]int8

Return all data in the column.

ValueByIdx(idx int)

[]int8, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnInt16

This struct type defines an Int16 column. You can use entity.NewColumnInt16() to create one for the insert() request as follows:

// Initiate an int16 column
columnInt16 := entity.NewColumnInt16(name string, values []int16)

// Add more values to the column
columnInt16.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]int16

Return all data in the column.

ValueByIdx(idx int)

int16, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

entity.ColumnInt16Array

This struct type defines an Int16 array column. You can use entity.NewColumnInt16Array() to create one for the insert() request as follows:

// Initiate an int16 array column
columnInt16Array := entity.NewColumnInt16Array(name string, values [][]int16)

// Add more values to the column
columnInt16Array.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]int16

Return all data in the column.

ValueByIdx(idx int)

[]int16, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnInt32

This struct type defines an Int32 column. You can use entity.NewColumnInt32() to create one for the insert() request as follows:

// Initiate an int32 column
columnInt32 := entity.NewColumnInt32(name string, values []int32)

// Add more values to the column
columnInt32.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]int32

Return all data in the column.

ValueByIdx(idx int)

int32, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

entity.ColumnInt32Array

This struct type defines an Int32 array column. You can use entity.NewColumnInt32Array() to create one for the insert() request as follows:

// Initiate an int32 array column
columnInt32Array := entity.NewColumnInt32Array(name string, values [][]int32)

// Add more values to the column
columnInt32Array.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]int32

Return all data in the column.

ValueByIdx(idx int)

[]int32, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnInt64

This struct type defines an Int64 column. You can use entity.NewColumnInt64() to create one for the insert() request as follows:

// Initiate an int64 column
columnInt64 := entity.NewColumnInt64(name string, values []int64)

// Add more values to the column
columnInt64.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]int64

Return all data in the column.

ValueByIdx(idx int)

int64, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

entity.ColumnInt64Array

This struct type defines an Int64 array column. You can use entity.NewColumnInt64Array() to create one for the insert() request as follows:

// Initiate an int64 array column
columnInt64Array := entity.NewColumnInt64Array(name string, values [][]int64)

// Add more values to the column
columnInt64Array.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]int64

Return all data in the column.

ValueByIdx(idx int)

[]int64, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnJSONBytes

This struct type defines a JSONBytes column. You can use entity.NewColumnJSONBytes() to create one for the insert() request as follows:

// Initiate a JSONBytes column
columnJSONBytes := entity.NewColumnJSONBytes(name string, values [][]byte)

// Add more values to the column
columnJSONBytes.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]byte

Return all data in the column.

ValueByIdx(idx int)

[]byte, error

Return the value at the specified ID in the column or an error.

WithIsDynamic(isDynamic bool)

*entity.ColumnJSONBytes

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsInt64()

entity.ColumnVarChar

This struct type defines a VarChar column. You can use entity.NewColumnVarChar() to create one for the insert() request as follows:

// Initiate a VarChar column
columnVarChar := entity.NewColumnVarChar(name string, values []string)

// Add more values to the column
columnVarChar.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]string

Return all data in the column.

ValueByIdx(idx int)

string, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsInt64()

entity.ColumnVarCharArray

This struct type defines a VarChar array column. You can use entity.NewColumnVarCharArray() to create one for the insert() request as follows:

// Initiate a VarChar array column
columnVarCharArray := entity.NewColumnVarCharArray(name string, values [][]string)

// Add more values to the column
columnVarCharArray.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]string

Return all data in the column.

ValueByIdx(idx int)

[]string, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnBFloat16Vector

This struct type defines a binary float16 vector column. You can use entity.NewColumnBFloat16Vector() to create one for the insert() request as follows:

// Initiate a binary float16 vector column
columnBFloat16Vector := entity.NewColumnBFloat16Vector(name string, dim int, values [][]byte)

// Add more values to the column
columnBFloat16Vector.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]byte

Return all data in the column.

Dim()

int

Return the dimensionality of this vector field.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnBinaryVector

This struct type defines a binary vector column. You can use entity.NewColumnBinaryVector() to create one for the insert() request as follows:

// Initiate a binary vector column
columnBinaryVector := entity.NewColumnBinaryVector(name string, dim int, values [][]byte)

// Add more values to the column
columnBinaryVector.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]byte

Return all data in the column.

Dim()

int

Return the dimensionality of this vector field.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnFloat16Vector

This struct type defines a binary float16 vector column. You can use entity.NewColumnBFloat16Vector() to create one for the insert() request as follows:

// Initiate a float16 vector column
columnFloat16Vector := entity.NewColumnFloat16Vector(name string, dim int, values [][]byte)

// Add more values to the column
columnFloat16Vector.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]byte

Return all data in the column.

Dim()

int

Return the dimensionality of this vector field.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnFloatVector

This struct type defines a float vector column. You can use entity.NewColumnFloatVector() to create one for the insert() request as follows:

// Initiate a float vector column
columnFloatVector := entity.NewColumnFloatVector(name string, dim int, values [][]byte)

// Add more values to the column
columnFloatVector.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[][]byte

Return all data in the column.

Dim()

int

Return the dimensionality of this vector field.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.ColumnSparseFloatVector

This struct type defines a sparse float vector column. You can use entity.NewColumnSparseFloatVector() to create one for the insert() request as follows:

// Initiate a sparse float vector column
columnSparseFloatVector := entity.NewColumnFloatVector(name string, values []SparseEmbedding)

// Add more values to the column
columnSparseFloatVector.AppendValue(i interface{})

In addition to the methods defined in the entity.Column interface, this struct type also defines the following methods.

Method

Return Type

Description

Data()

[]entity.SparseEmbedding

Return all data in the column.

ValueByIdx(idx int)

entity.SparseEmbedding, error

Return the value at the specified ID in the column or an error.

This struct type does not implement the following methods:

  • GetAsBool()

  • GetAsDouble()

  • GetAsString()

  • GetAsInt64()

entity.SparseEmbedding

This interface type defines a set of signatures as follows:

type SparseEmbedding interface {
Dim() int // the dimension
Len() int // the actual items in this vector
Get(idx int) (pos uint32, value float32, ok bool)
Serialize() []byte
FieldType() FieldType
}

Method Signature

Return Type

Description

Dim()

int

Return the dimensionality of the sparse vector embedding.

Len()

int

Return the number of rows in the column.

Get(idx int)

pos unit32, value float32, ok bool

Return the value at the specified ID in the column or an error.

Serialize()

[]byte

Return the serialized sparse vector embedding.

FieldType()

entity.FieldType

Return the field type of the sparse vector embedding.

You can create a sparse embedding slice using the entity.NewSliceSparseEmbedding() method.

slice := entity.NewSliceSparseEmbedding(postitions []uint32, values []float32)