client.go
func (c *Client) ImportField(field *Field, iterator RecordIterator, options ...ImportOption) error {
	span := c.tracer.StartSpan("Client.ImportField")
	defer span.Finish()

	importOptions := ImportOptions{}
	for _, option := range options {
		if err := option(&importOptions); err != nil {
			return err
		}
	}
	importOptions = importOptions.withDefaults()
	if importOptions.importRecordsFunction == nil {
		// if import records function was not already set, set it.
		if field.options != nil && field.options.fieldType == FieldTypeInt {
			importRecordsFunction(c.importValues)(&importOptions)
		} else {
			// Check whether roaring imports is available
			if importOptions.wantRoaring != nil && *importOptions.wantRoaring == true {
				importOptions.hasRoaring = c.hasRoaringImportSupport(field)
			}
			importRecordsFunction(c.importColumns)(&importOptions)
		}
	}
	// if the index doesn't have its shardWidth set, we need to get it from the schema
	if field.index.shardWidth == 0 {
		indexes, err := c.readSchema()
		if err != nil {
			return err
		}
		for _, index := range indexes {
			if index.Name != field.index.name {
				continue
			}
			indexCopy := field.index.copy()
			indexCopy.shardWidth = index.ShardWidth
			field = field.copy()
			field.index = indexCopy
			break
		}
		if field.index.shardWidth == 0 {
			// the index does not have shard width, use the default
			field.index.shardWidth = DefaultShardWidth
		}
	}
	return c.importManager.run(field, iterator, importOptions)
}
func (c *Client) ImportField(field *Field, iterator RecordIterator, options ...ImportOption) error {
	span := c.tracer.StartSpan("Client.ImportField")
	defer span.Finish()

	importOptions := ImportOptions{}
	for _, option := range options {
		if err := option(&importOptions); err != nil {
			return err
		}
	}
	importOptions = importOptions.withDefaults()
	if importOptions.importRecordsFunction == nil {
		// if import records function was not already set, set it.
		if field.options != nil && field.options.fieldType == FieldTypeInt {
			importRecordsFunction(c.importValues)(&importOptions)
		} else {
			// Check whether roaring imports is available
			if importOptions.wantRoaring != nil && *importOptions.wantRoaring == true {
				importOptions.hasRoaring = c.hasRoaringImportSupport(field)
			}
			importRecordsFunction(c.importColumns)(&importOptions)
		}
	}
	// if the index doesn't have its shardWidth set, we need to get it from the schema
	if field.index.shardWidth == 0 {
		indexes, err := c.readSchema()
		if err != nil {
			return err
		}
		for _, index := range indexes {
			if index.Name != field.index.name {
				continue
			}
			indexCopy := field.index.copy()
			indexCopy.shardWidth = index.ShardWidth
			field = field.copy()
			field.index = indexCopy
			break
		}
		if field.index.shardWidth == 0 {
			// the index does not have shard width, use the default
			field.index.shardWidth = DefaultShardWidth
		}
	}
	return c.importManager.run(field, iterator, importOptions)
}
func ( c * Client ) ImportField ( field * Field , iterator RecordIterator , options ... ImportOption ) error { span := c . tracer . StartSpan ( " " ) defer span . Finish ( ) importOptions := ImportOptions { } for _ , option := range options { if err := option ( & importOptions ) ; err != nil { return err } } importOptions = importOptions . withDefaults ( ) if importOptions . importRecordsFunction == nil { // if import records function was not already set, set it. if field . options != nil && field . options . fieldType == FieldTypeInt { importRecordsFunction ( c . importValues ) ( & importOptions ) } else { // Check whether roaring imports is available if importOptions . wantRoaring != nil && * importOptions . wantRoaring == true { importOptions . hasRoaring = c . hasRoaringImportSupport ( field ) } importRecordsFunction ( c . importColumns ) ( & importOptions ) } } // if the index doesn't have its shardWidth set, we need to get it from the schema if field . index . shardWidth == 0 { indexes , err := c . readSchema ( ) if err != nil { return err } for _ , index := range indexes { if index . Name != field . index . name { continue } indexCopy := field . index . copy ( ) indexCopy . shardWidth = index . ShardWidth field = field . copy ( ) field . index = indexCopy break } if field . index . shardWidth == 0 { // the index does not have shard width, use the default field . index . shardWidth = DefaultShardWidth } } return c . importManager . run ( field , iterator , importOptions ) }
// ImportField imports records from the given iterator.
ImportField imports records from the given iterator .