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