github.com/milvus-io/milvus-sdk-go/v2@v2.4.1/entity/columns_array_gen.go (about)

     1  // Code generated by go generate; DO NOT EDIT
     2  // This file is generated by go generate 
     3  
     4  package entity 
     5  
     6  import (
     7  	"fmt"
     8  
     9  	"github.com/cockroachdb/errors"
    10  	"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
    11  )
    12  
    13  
    14  // ColumnBoolArray generated columns type for Bool
    15  type ColumnBoolArray struct {
    16  	ColumnBase
    17  	name   string
    18  	values [][]bool
    19  }
    20  
    21  // Name returns column name
    22  func (c *ColumnBoolArray) Name() string {
    23  	return c.name
    24  }
    25  
    26  // Type returns column FieldType
    27  func (c *ColumnBoolArray) Type() FieldType {
    28  	return FieldTypeArray
    29  }
    30  
    31  // Len returns column values length
    32  func (c *ColumnBoolArray) Len() int {
    33  	return len(c.values)
    34  }
    35  
    36  func (c *ColumnBoolArray) Slice(start, end int) Column {
    37  	l := c.Len()
    38  	if start > l {
    39  		start = l
    40  	}
    41  	if end == -1 || end > l {
    42  		end = l
    43  	}
    44  	if end == -1 || end > l {
    45  		end = l
    46  	}
    47  	return &ColumnBoolArray{
    48  		ColumnBase: c.ColumnBase,
    49  		name:       c.name,
    50  		values:     c.values[start:end],
    51  	}
    52  }
    53  
    54  // Get returns value at index as interface{}.
    55  func (c *ColumnBoolArray) Get(idx int) (interface{}, error) {
    56  	var r []bool // use default value
    57  	if idx < 0 || idx >= c.Len() {
    58  		return r, errors.New("index out of range")
    59  	}
    60  	return c.values[idx], nil
    61  }
    62  
    63  // FieldData return column data mapped to schemapb.FieldData
    64  func (c *ColumnBoolArray) FieldData() *schemapb.FieldData {
    65  	fd := &schemapb.FieldData{
    66  		Type:      schemapb.DataType_Array,
    67  		FieldName: c.name,
    68  	}
    69  
    70  	data := make([]*schemapb.ScalarField, 0, c.Len())
    71  	for _, arr := range c.values {
    72  		converted := make([]bool, 0, c.Len())
    73  		for i := 0; i < len(arr); i++ {
    74  			converted = append(converted, bool(arr[i]))
    75  		}
    76  		data = append(data, &schemapb.ScalarField{
    77  			Data: &schemapb.ScalarField_BoolData{
    78  				BoolData: &schemapb.BoolArray{
    79  					Data: converted,
    80  				},
    81  			},
    82  		})
    83  	}
    84  	fd.Field = &schemapb.FieldData_Scalars{
    85  		Scalars: &schemapb.ScalarField{
    86  			Data: &schemapb.ScalarField_ArrayData{
    87  				ArrayData: &schemapb.ArrayArray{
    88  					Data:        data,
    89  					ElementType: schemapb.DataType_Bool,
    90  				},
    91  			},
    92  		},
    93  	}
    94  	return fd
    95  }
    96  
    97  // ValueByIdx returns value of the provided index
    98  // error occurs when index out of range
    99  func (c *ColumnBoolArray) ValueByIdx(idx int) ([]bool, error) {
   100  	var r []bool // use default value
   101  	if idx < 0 || idx >= c.Len() {
   102  		return r, errors.New("index out of range")
   103  	}
   104  	return c.values[idx], nil
   105  }
   106  
   107  // AppendValue append value into column
   108  func(c *ColumnBoolArray) AppendValue(i interface{}) error {
   109  	v, ok := i.([]bool)
   110  	if !ok {
   111  		return fmt.Errorf("invalid type, expected []bool, got %T", i)
   112  	}
   113  	c.values = append(c.values, v)
   114  
   115  	return nil
   116  }
   117  
   118  // Data returns column data
   119  func (c *ColumnBoolArray) Data() [][]bool {
   120  	return c.values
   121  }
   122  
   123  // NewColumnBool auto generated constructor
   124  func NewColumnBoolArray(name string, values [][]bool) *ColumnBoolArray {
   125  	return &ColumnBoolArray {
   126  		name: name,
   127  		values: values,
   128  	}
   129  }
   130  
   131  // ColumnInt8Array generated columns type for Int8
   132  type ColumnInt8Array struct {
   133  	ColumnBase
   134  	name   string
   135  	values [][]int8
   136  }
   137  
   138  // Name returns column name
   139  func (c *ColumnInt8Array) Name() string {
   140  	return c.name
   141  }
   142  
   143  // Type returns column FieldType
   144  func (c *ColumnInt8Array) Type() FieldType {
   145  	return FieldTypeArray
   146  }
   147  
   148  // Len returns column values length
   149  func (c *ColumnInt8Array) Len() int {
   150  	return len(c.values)
   151  }
   152  
   153  func (c *ColumnInt8Array) Slice(start, end int) Column {
   154  	l := c.Len()
   155  	if start > l {
   156  		start = l
   157  	}
   158  	if end == -1 || end > l {
   159  		end = l
   160  	}
   161  	return &ColumnInt8Array{
   162  		ColumnBase: c.ColumnBase,
   163  		name:       c.name,
   164  		values:     c.values[start:end],
   165  	}
   166  }
   167  
   168  // Get returns value at index as interface{}.
   169  func (c *ColumnInt8Array) Get(idx int) (interface{}, error) {
   170  	var r []int8 // use default value
   171  	if idx < 0 || idx >= c.Len() {
   172  		return r, errors.New("index out of range")
   173  	}
   174  	return c.values[idx], nil
   175  }
   176  
   177  // FieldData return column data mapped to schemapb.FieldData
   178  func (c *ColumnInt8Array) FieldData() *schemapb.FieldData {
   179  	fd := &schemapb.FieldData{
   180  		Type:      schemapb.DataType_Array,
   181  		FieldName: c.name,
   182  	}
   183  
   184  	data := make([]*schemapb.ScalarField, 0, c.Len())
   185  	for _, arr := range c.values {
   186  		converted := make([]int32, 0, c.Len())
   187  		for i := 0; i < len(arr); i++ {
   188  			converted = append(converted, int32(arr[i]))
   189  		}
   190  		data = append(data, &schemapb.ScalarField{
   191  			Data: &schemapb.ScalarField_IntData{
   192  				IntData: &schemapb.IntArray{
   193  					Data: converted,
   194  				},
   195  			},
   196  		})
   197  	}
   198  	fd.Field = &schemapb.FieldData_Scalars{
   199  		Scalars: &schemapb.ScalarField{
   200  			Data: &schemapb.ScalarField_ArrayData{
   201  				ArrayData: &schemapb.ArrayArray{
   202  					Data:        data,
   203  					ElementType: schemapb.DataType_Int8,
   204  				},
   205  			},
   206  		},
   207  	}
   208  	return fd
   209  }
   210  
   211  // ValueByIdx returns value of the provided index
   212  // error occurs when index out of range
   213  func (c *ColumnInt8Array) ValueByIdx(idx int) ([]int8, error) {
   214  	var r []int8 // use default value
   215  	if idx < 0 || idx >= c.Len() {
   216  		return r, errors.New("index out of range")
   217  	}
   218  	return c.values[idx], nil
   219  }
   220  
   221  // AppendValue append value into column
   222  func(c *ColumnInt8Array) AppendValue(i interface{}) error {
   223  	v, ok := i.([]int8)
   224  	if !ok {
   225  		return fmt.Errorf("invalid type, expected []int8, got %T", i)
   226  	}
   227  	c.values = append(c.values, v)
   228  
   229  	return nil
   230  }
   231  
   232  // Data returns column data
   233  func (c *ColumnInt8Array) Data() [][]int8 {
   234  	return c.values
   235  }
   236  
   237  // NewColumnInt8 auto generated constructor
   238  func NewColumnInt8Array(name string, values [][]int8) *ColumnInt8Array {
   239  	return &ColumnInt8Array {
   240  		name: name,
   241  		values: values,
   242  	}
   243  }
   244  
   245  // ColumnInt16Array generated columns type for Int16
   246  type ColumnInt16Array struct {
   247  	ColumnBase
   248  	name   string
   249  	values [][]int16
   250  }
   251  
   252  // Name returns column name
   253  func (c *ColumnInt16Array) Name() string {
   254  	return c.name
   255  }
   256  
   257  // Type returns column FieldType
   258  func (c *ColumnInt16Array) Type() FieldType {
   259  	return FieldTypeArray
   260  }
   261  
   262  // Len returns column values length
   263  func (c *ColumnInt16Array) Len() int {
   264  	return len(c.values)
   265  }
   266  
   267  func (c *ColumnInt16Array) Slice(start, end int) Column {
   268  	l := c.Len()
   269  	if start > l {
   270  		start = l
   271  	}
   272  	if end == -1 || end > l {
   273  		end = l
   274  	}
   275  	return &ColumnInt16Array{
   276  		ColumnBase: c.ColumnBase,
   277  		name:       c.name,
   278  		values:     c.values[start:end],
   279  	}
   280  }
   281  
   282  // Get returns value at index as interface{}.
   283  func (c *ColumnInt16Array) Get(idx int) (interface{}, error) {
   284  	var r []int16 // use default value
   285  	if idx < 0 || idx >= c.Len() {
   286  		return r, errors.New("index out of range")
   287  	}
   288  	return c.values[idx], nil
   289  }
   290  
   291  // FieldData return column data mapped to schemapb.FieldData
   292  func (c *ColumnInt16Array) FieldData() *schemapb.FieldData {
   293  	fd := &schemapb.FieldData{
   294  		Type:      schemapb.DataType_Array,
   295  		FieldName: c.name,
   296  	}
   297  
   298  	data := make([]*schemapb.ScalarField, 0, c.Len())
   299  	for _, arr := range c.values {
   300  		converted := make([]int32, 0, c.Len())
   301  		for i := 0; i < len(arr); i++ {
   302  			converted = append(converted, int32(arr[i]))
   303  		}
   304  		data = append(data, &schemapb.ScalarField{
   305  			Data: &schemapb.ScalarField_IntData{
   306  				IntData: &schemapb.IntArray{
   307  					Data: converted,
   308  				},
   309  			},
   310  		})
   311  	}
   312  	fd.Field = &schemapb.FieldData_Scalars{
   313  		Scalars: &schemapb.ScalarField{
   314  			Data: &schemapb.ScalarField_ArrayData{
   315  				ArrayData: &schemapb.ArrayArray{
   316  					Data:        data,
   317  					ElementType: schemapb.DataType_Int16,
   318  				},
   319  			},
   320  		},
   321  	}
   322  	return fd
   323  }
   324  
   325  // ValueByIdx returns value of the provided index
   326  // error occurs when index out of range
   327  func (c *ColumnInt16Array) ValueByIdx(idx int) ([]int16, error) {
   328  	var r []int16 // use default value
   329  	if idx < 0 || idx >= c.Len() {
   330  		return r, errors.New("index out of range")
   331  	}
   332  	return c.values[idx], nil
   333  }
   334  
   335  // AppendValue append value into column
   336  func(c *ColumnInt16Array) AppendValue(i interface{}) error {
   337  	v, ok := i.([]int16)
   338  	if !ok {
   339  		return fmt.Errorf("invalid type, expected []int16, got %T", i)
   340  	}
   341  	c.values = append(c.values, v)
   342  
   343  	return nil
   344  }
   345  
   346  // Data returns column data
   347  func (c *ColumnInt16Array) Data() [][]int16 {
   348  	return c.values
   349  }
   350  
   351  // NewColumnInt16 auto generated constructor
   352  func NewColumnInt16Array(name string, values [][]int16) *ColumnInt16Array {
   353  	return &ColumnInt16Array {
   354  		name: name,
   355  		values: values,
   356  	}
   357  }
   358  
   359  // ColumnInt32Array generated columns type for Int32
   360  type ColumnInt32Array struct {
   361  	ColumnBase
   362  	name   string
   363  	values [][]int32
   364  }
   365  
   366  // Name returns column name
   367  func (c *ColumnInt32Array) Name() string {
   368  	return c.name
   369  }
   370  
   371  // Type returns column FieldType
   372  func (c *ColumnInt32Array) Type() FieldType {
   373  	return FieldTypeArray
   374  }
   375  
   376  // Len returns column values length
   377  func (c *ColumnInt32Array) Len() int {
   378  	return len(c.values)
   379  }
   380  
   381  func (c *ColumnInt32Array) Slice(start, end int) Column {
   382  	l := c.Len()
   383  	if start > l {
   384  		start = l
   385  	}
   386  	if end == -1 || end > l {
   387  		end = l
   388  	}
   389  	return &ColumnInt32Array{
   390  		ColumnBase: c.ColumnBase,
   391  		name:       c.name,
   392  		values:     c.values[start:end],
   393  	}
   394  }
   395  
   396  // Get returns value at index as interface{}.
   397  func (c *ColumnInt32Array) Get(idx int) (interface{}, error) {
   398  	var r []int32 // use default value
   399  	if idx < 0 || idx >= c.Len() {
   400  		return r, errors.New("index out of range")
   401  	}
   402  	return c.values[idx], nil
   403  }
   404  
   405  // FieldData return column data mapped to schemapb.FieldData
   406  func (c *ColumnInt32Array) FieldData() *schemapb.FieldData {
   407  	fd := &schemapb.FieldData{
   408  		Type:      schemapb.DataType_Array,
   409  		FieldName: c.name,
   410  	}
   411  
   412  	data := make([]*schemapb.ScalarField, 0, c.Len())
   413  	for _, arr := range c.values {
   414  		converted := make([]int32, 0, c.Len())
   415  		for i := 0; i < len(arr); i++ {
   416  			converted = append(converted, int32(arr[i]))
   417  		}
   418  		data = append(data, &schemapb.ScalarField{
   419  			Data: &schemapb.ScalarField_IntData{
   420  				IntData: &schemapb.IntArray{
   421  					Data: converted,
   422  				},
   423  			},
   424  		})
   425  	}
   426  	fd.Field = &schemapb.FieldData_Scalars{
   427  		Scalars: &schemapb.ScalarField{
   428  			Data: &schemapb.ScalarField_ArrayData{
   429  				ArrayData: &schemapb.ArrayArray{
   430  					Data:        data,
   431  					ElementType: schemapb.DataType_Int32,
   432  				},
   433  			},
   434  		},
   435  	}
   436  	return fd
   437  }
   438  
   439  // ValueByIdx returns value of the provided index
   440  // error occurs when index out of range
   441  func (c *ColumnInt32Array) ValueByIdx(idx int) ([]int32, error) {
   442  	var r []int32 // use default value
   443  	if idx < 0 || idx >= c.Len() {
   444  		return r, errors.New("index out of range")
   445  	}
   446  	return c.values[idx], nil
   447  }
   448  
   449  // AppendValue append value into column
   450  func(c *ColumnInt32Array) AppendValue(i interface{}) error {
   451  	v, ok := i.([]int32)
   452  	if !ok {
   453  		return fmt.Errorf("invalid type, expected []int32, got %T", i)
   454  	}
   455  	c.values = append(c.values, v)
   456  
   457  	return nil
   458  }
   459  
   460  // Data returns column data
   461  func (c *ColumnInt32Array) Data() [][]int32 {
   462  	return c.values
   463  }
   464  
   465  // NewColumnInt32 auto generated constructor
   466  func NewColumnInt32Array(name string, values [][]int32) *ColumnInt32Array {
   467  	return &ColumnInt32Array {
   468  		name: name,
   469  		values: values,
   470  	}
   471  }
   472  
   473  // ColumnInt64Array generated columns type for Int64
   474  type ColumnInt64Array struct {
   475  	ColumnBase
   476  	name   string
   477  	values [][]int64
   478  }
   479  
   480  // Name returns column name
   481  func (c *ColumnInt64Array) Name() string {
   482  	return c.name
   483  }
   484  
   485  // Type returns column FieldType
   486  func (c *ColumnInt64Array) Type() FieldType {
   487  	return FieldTypeArray
   488  }
   489  
   490  // Len returns column values length
   491  func (c *ColumnInt64Array) Len() int {
   492  	return len(c.values)
   493  }
   494  
   495  func (c *ColumnInt64Array) Slice(start, end int) Column {
   496  	l := c.Len()
   497  	if start > l {
   498  		start = l
   499  	}
   500  	if end == -1 || end > l {
   501  		end = l
   502  	}
   503  	return &ColumnInt64Array{
   504  		ColumnBase: c.ColumnBase,
   505  		name:       c.name,
   506  		values:     c.values[start:end],
   507  	}
   508  }
   509  
   510  // Get returns value at index as interface{}.
   511  func (c *ColumnInt64Array) Get(idx int) (interface{}, error) {
   512  	var r []int64 // use default value
   513  	if idx < 0 || idx >= c.Len() {
   514  		return r, errors.New("index out of range")
   515  	}
   516  	return c.values[idx], nil
   517  }
   518  
   519  // FieldData return column data mapped to schemapb.FieldData
   520  func (c *ColumnInt64Array) FieldData() *schemapb.FieldData {
   521  	fd := &schemapb.FieldData{
   522  		Type:      schemapb.DataType_Array,
   523  		FieldName: c.name,
   524  	}
   525  
   526  	data := make([]*schemapb.ScalarField, 0, c.Len())
   527  	for _, arr := range c.values {
   528  		converted := make([]int64, 0, c.Len())
   529  		for i := 0; i < len(arr); i++ {
   530  			converted = append(converted, int64(arr[i]))
   531  		}
   532  		data = append(data, &schemapb.ScalarField{
   533  			Data: &schemapb.ScalarField_LongData{
   534  				LongData: &schemapb.LongArray{
   535  					Data: converted,
   536  				},
   537  			},
   538  		})
   539  	}
   540  	fd.Field = &schemapb.FieldData_Scalars{
   541  		Scalars: &schemapb.ScalarField{
   542  			Data: &schemapb.ScalarField_ArrayData{
   543  				ArrayData: &schemapb.ArrayArray{
   544  					Data:        data,
   545  					ElementType: schemapb.DataType_Int64,
   546  				},
   547  			},
   548  		},
   549  	}
   550  	return fd
   551  }
   552  
   553  // ValueByIdx returns value of the provided index
   554  // error occurs when index out of range
   555  func (c *ColumnInt64Array) ValueByIdx(idx int) ([]int64, error) {
   556  	var r []int64 // use default value
   557  	if idx < 0 || idx >= c.Len() {
   558  		return r, errors.New("index out of range")
   559  	}
   560  	return c.values[idx], nil
   561  }
   562  
   563  // AppendValue append value into column
   564  func(c *ColumnInt64Array) AppendValue(i interface{}) error {
   565  	v, ok := i.([]int64)
   566  	if !ok {
   567  		return fmt.Errorf("invalid type, expected []int64, got %T", i)
   568  	}
   569  	c.values = append(c.values, v)
   570  
   571  	return nil
   572  }
   573  
   574  // Data returns column data
   575  func (c *ColumnInt64Array) Data() [][]int64 {
   576  	return c.values
   577  }
   578  
   579  // NewColumnInt64 auto generated constructor
   580  func NewColumnInt64Array(name string, values [][]int64) *ColumnInt64Array {
   581  	return &ColumnInt64Array {
   582  		name: name,
   583  		values: values,
   584  	}
   585  }
   586  
   587  // ColumnFloatArray generated columns type for Float
   588  type ColumnFloatArray struct {
   589  	ColumnBase
   590  	name   string
   591  	values [][]float32
   592  }
   593  
   594  // Name returns column name
   595  func (c *ColumnFloatArray) Name() string {
   596  	return c.name
   597  }
   598  
   599  // Type returns column FieldType
   600  func (c *ColumnFloatArray) Type() FieldType {
   601  	return FieldTypeArray
   602  }
   603  
   604  // Len returns column values length
   605  func (c *ColumnFloatArray) Len() int {
   606  	return len(c.values)
   607  }
   608  
   609  func (c *ColumnFloatArray) Slice(start, end int) Column {
   610  	l := c.Len()
   611  	if start > l {
   612  		start = l
   613  	}
   614  	if end == -1 || end > l {
   615  		end = l
   616  	}
   617  	return &ColumnFloatArray{
   618  		ColumnBase: c.ColumnBase,
   619  		name:       c.name,
   620  		values:     c.values[start:end],
   621  	}
   622  }
   623  
   624  // Get returns value at index as interface{}.
   625  func (c *ColumnFloatArray) Get(idx int) (interface{}, error) {
   626  	var r []float32 // use default value
   627  	if idx < 0 || idx >= c.Len() {
   628  		return r, errors.New("index out of range")
   629  	}
   630  	return c.values[idx], nil
   631  }
   632  
   633  // FieldData return column data mapped to schemapb.FieldData
   634  func (c *ColumnFloatArray) FieldData() *schemapb.FieldData {
   635  	fd := &schemapb.FieldData{
   636  		Type:      schemapb.DataType_Array,
   637  		FieldName: c.name,
   638  	}
   639  
   640  	data := make([]*schemapb.ScalarField, 0, c.Len())
   641  	for _, arr := range c.values {
   642  		converted := make([]float32, 0, c.Len())
   643  		for i := 0; i < len(arr); i++ {
   644  			converted = append(converted, float32(arr[i]))
   645  		}
   646  		data = append(data, &schemapb.ScalarField{
   647  			Data: &schemapb.ScalarField_FloatData{
   648  				FloatData: &schemapb.FloatArray{
   649  					Data: converted,
   650  				},
   651  			},
   652  		})
   653  	}
   654  	fd.Field = &schemapb.FieldData_Scalars{
   655  		Scalars: &schemapb.ScalarField{
   656  			Data: &schemapb.ScalarField_ArrayData{
   657  				ArrayData: &schemapb.ArrayArray{
   658  					Data:        data,
   659  					ElementType: schemapb.DataType_Float,
   660  				},
   661  			},
   662  		},
   663  	}
   664  	return fd
   665  }
   666  
   667  // ValueByIdx returns value of the provided index
   668  // error occurs when index out of range
   669  func (c *ColumnFloatArray) ValueByIdx(idx int) ([]float32, error) {
   670  	var r []float32 // use default value
   671  	if idx < 0 || idx >= c.Len() {
   672  		return r, errors.New("index out of range")
   673  	}
   674  	return c.values[idx], nil
   675  }
   676  
   677  // AppendValue append value into column
   678  func(c *ColumnFloatArray) AppendValue(i interface{}) error {
   679  	v, ok := i.([]float32)
   680  	if !ok {
   681  		return fmt.Errorf("invalid type, expected []float32, got %T", i)
   682  	}
   683  	c.values = append(c.values, v)
   684  
   685  	return nil
   686  }
   687  
   688  // Data returns column data
   689  func (c *ColumnFloatArray) Data() [][]float32 {
   690  	return c.values
   691  }
   692  
   693  // NewColumnFloat auto generated constructor
   694  func NewColumnFloatArray(name string, values [][]float32) *ColumnFloatArray {
   695  	return &ColumnFloatArray {
   696  		name: name,
   697  		values: values,
   698  	}
   699  }
   700  
   701  // ColumnDoubleArray generated columns type for Double
   702  type ColumnDoubleArray struct {
   703  	ColumnBase
   704  	name   string
   705  	values [][]float64
   706  }
   707  
   708  // Name returns column name
   709  func (c *ColumnDoubleArray) Name() string {
   710  	return c.name
   711  }
   712  
   713  // Type returns column FieldType
   714  func (c *ColumnDoubleArray) Type() FieldType {
   715  	return FieldTypeArray
   716  }
   717  
   718  // Len returns column values length
   719  func (c *ColumnDoubleArray) Len() int {
   720  	return len(c.values)
   721  }
   722  
   723  func (c *ColumnDoubleArray) Slice(start, end int) Column {
   724  	l := c.Len()
   725  	if start > l {
   726  		start = l
   727  	}
   728  	if end == -1 || end > l {
   729  		end = l
   730  	}
   731  	return &ColumnDoubleArray{
   732  		ColumnBase: c.ColumnBase,
   733  		name:       c.name,
   734  		values:     c.values[start:end],
   735  	}
   736  }
   737  
   738  // Get returns value at index as interface{}.
   739  func (c *ColumnDoubleArray) Get(idx int) (interface{}, error) {
   740  	var r []float64 // use default value
   741  	if idx < 0 || idx >= c.Len() {
   742  		return r, errors.New("index out of range")
   743  	}
   744  	return c.values[idx], nil
   745  }
   746  
   747  // FieldData return column data mapped to schemapb.FieldData
   748  func (c *ColumnDoubleArray) FieldData() *schemapb.FieldData {
   749  	fd := &schemapb.FieldData{
   750  		Type:      schemapb.DataType_Array,
   751  		FieldName: c.name,
   752  	}
   753  
   754  	data := make([]*schemapb.ScalarField, 0, c.Len())
   755  	for _, arr := range c.values {
   756  		converted := make([]float64, 0, c.Len())
   757  		for i := 0; i < len(arr); i++ {
   758  			converted = append(converted, float64(arr[i]))
   759  		}
   760  		data = append(data, &schemapb.ScalarField{
   761  			Data: &schemapb.ScalarField_DoubleData{
   762  				DoubleData: &schemapb.DoubleArray{
   763  					Data: converted,
   764  				},
   765  			},
   766  		})
   767  	}
   768  	fd.Field = &schemapb.FieldData_Scalars{
   769  		Scalars: &schemapb.ScalarField{
   770  			Data: &schemapb.ScalarField_ArrayData{
   771  				ArrayData: &schemapb.ArrayArray{
   772  					Data:        data,
   773  					ElementType: schemapb.DataType_Double,
   774  				},
   775  			},
   776  		},
   777  	}
   778  	return fd
   779  }
   780  
   781  // ValueByIdx returns value of the provided index
   782  // error occurs when index out of range
   783  func (c *ColumnDoubleArray) ValueByIdx(idx int) ([]float64, error) {
   784  	var r []float64 // use default value
   785  	if idx < 0 || idx >= c.Len() {
   786  		return r, errors.New("index out of range")
   787  	}
   788  	return c.values[idx], nil
   789  }
   790  
   791  // AppendValue append value into column
   792  func(c *ColumnDoubleArray) AppendValue(i interface{}) error {
   793  	v, ok := i.([]float64)
   794  	if !ok {
   795  		return fmt.Errorf("invalid type, expected []float64, got %T", i)
   796  	}
   797  	c.values = append(c.values, v)
   798  
   799  	return nil
   800  }
   801  
   802  // Data returns column data
   803  func (c *ColumnDoubleArray) Data() [][]float64 {
   804  	return c.values
   805  }
   806  
   807  // NewColumnDouble auto generated constructor
   808  func NewColumnDoubleArray(name string, values [][]float64) *ColumnDoubleArray {
   809  	return &ColumnDoubleArray {
   810  		name: name,
   811  		values: values,
   812  	}
   813  }
   814  
   815