# InsertParam.Builder

Package io.milvus.param.dml

## Class InsertParam.Builder

- java.lang.Object
- - io.milvus.param.dml.InsertParam.Builder

Direct Known Subclasses:
  `UpsertParam.Builder`

Enclosing class:
  InsertParam

    public static class InsertParam.Builder
    extends java.lang.Object

Builder for `InsertParam` class.

### Field Summary

Fields
`protected java.lang.String` `collectionName`
`protected java.lang.String` `databaseName`
`protected java.util.List<InsertParam.Field>` `fields`
`protected java.lang.String` `partitionName`
`protected int` `rowCount`
`protected java.util.List<com.alibaba.fastjson.JSONObject>` `rows`

### Constructor Summary

Constructors
`protected` `Builder()`

### Method Summary

All Methods Instance Methods Concrete Methods
`InsertParam` `build()` Verifies parameters and creates a new `InsertParam` instance.
`protected void` `checkFields​(int count)`
`protected void` `checkRows()`
`InsertParam.Builder` `withCollectionName​(@NonNull java.lang.String collectionName)` Sets the collection name.
`InsertParam.Builder` `withDatabaseName​(java.lang.String databaseName)` Sets the database name.
`InsertParam.Builder` `withFields​(@NonNull java.util.List<InsertParam.Field> fields)` Sets the column data to insert.
`InsertParam.Builder` `withPartitionName​(@NonNull java.lang.String partitionName)` Set partition name (Optional).
`InsertParam.Builder` `withRows​(@NonNull java.util.List<com.alibaba.fastjson.JSONObject> rows)` Sets the row data to insert.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### databaseName

    protected java.lang.String databaseName

#### collectionName

    protected java.lang.String collectionName

#### partitionName

    protected java.lang.String partitionName

#### fields

    protected java.util.List<InsertParam.Field> fields

#### rows

    protected java.util.List<com.alibaba.fastjson.JSONObject> rows

#### rowCount

    protected int rowCount

### Constructor Detail

#### Builder

    protected Builder()

### Method Detail

#### withDatabaseName

    public InsertParam.Builder withDatabaseName​(java.lang.String databaseName)

Sets the database name. database name can be nil.

Parameters:
  `databaseName` - database name
Returns:
  `Builder`

#### withCollectionName

    public InsertParam.Builder withCollectionName​(@NonNull
                                                  @NonNull java.lang.String collectionName)

Sets the collection name. Collection name cannot be empty or null.

Parameters:
  `collectionName` - collection name
Returns:
  `Builder`

#### withPartitionName

    public InsertParam.Builder withPartitionName​(@NonNull
                                                 @NonNull java.lang.String partitionName)

Set partition name (Optional). This partition name will be ignored if the collection has a partition key field.

Parameters:
  `partitionName` - partition name
Returns:
  `Builder`

#### withFields

    public InsertParam.Builder withFields​(@NonNull
                                          @NonNull java.util.List<InsertParam.Field> fields)

Sets the column data to insert. The field list cannot be empty.

Parameters:
  `fields` - insert column data
Returns:
  `Builder`
See Also:
  `InsertParam.Field`

#### withRows

    public InsertParam.Builder withRows​(@NonNull
                                        @NonNull java.util.List<com.alibaba.fastjson.JSONObject> rows)

Sets the row data to insert. The rows list cannot be empty.

Parameters:
  `rows` - insert row data
Returns:
  `Builder`
See Also:
  `JSONObject`

#### build

    public InsertParam build()
                      throws ParamException

Verifies parameters and creates a new `InsertParam` instance.

Returns:
  `InsertParam`
Throws:
  `ParamException`

#### checkFields

    protected void checkFields​(int count)

#### checkRows

    protected void checkRows()