com.redis.riot.db.DatabaseReaderArgs Maven / Gradle / Ivy
The newest version!
package com.redis.riot.db;
import java.util.Map;
import org.springframework.batch.item.database.AbstractCursorItemReader;
import org.springframework.batch.item.database.JdbcCursorItemReader;
import org.springframework.batch.item.database.builder.JdbcCursorItemReaderBuilder;
import org.springframework.jdbc.core.ColumnMapRowMapper;
import org.springframework.util.Assert;
import picocli.CommandLine.ArgGroup;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
public class DatabaseReaderArgs {
public static final int DEFAULT_FETCH_SIZE = AbstractCursorItemReader.VALUE_NOT_SET;
public static final int DEFAULT_MAX_RESULT_SET_ROWS = AbstractCursorItemReader.VALUE_NOT_SET;
public static final int DEFAULT_QUERY_TIMEOUT = AbstractCursorItemReader.VALUE_NOT_SET;
@ArgGroup(exclusive = false)
private DataSourceArgs dataSourceArgs = new DataSourceArgs();
@Parameters(arity = "1", description = "SQL SELECT statement", paramLabel = "SQL")
private String sql;
@Option(names = "--max", description = "Max number of rows to import.", paramLabel = "")
private int maxItemCount;
@Option(names = "--fetch", description = "Number of rows to return with each fetch.", paramLabel = "")
private int fetchSize = DEFAULT_FETCH_SIZE;
@Option(names = "--rows", description = "Max number of rows the ResultSet can contain.", paramLabel = "")
private int maxRows = DEFAULT_MAX_RESULT_SET_ROWS;
@Option(names = "--query-timeout", description = "The time in milliseconds for the query to timeout.", paramLabel = "")
private int queryTimeout = DEFAULT_QUERY_TIMEOUT;
@Option(names = "--shared-connection", description = "Use same connection for cursor and other processing.", hidden = true)
private boolean useSharedExtendedConnection;
@Option(names = "--verify", description = "Verify position of result set after row mapper.", hidden = true)
private boolean verifyCursorPosition;
public JdbcCursorItemReader