fuzzycsv.rdbms.ExportParams.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fuzzy-csv Show documentation
Show all versions of fuzzy-csv Show documentation
A groovy/java tabular Data (from CSV,SQL,JSON) processing library that supports fuzzy column matching,tranformations/merging/querying etc
package fuzzycsv.rdbms
import fuzzycsv.rdbms.stmt.SqlDialect
import fuzzycsv.rdbms.stmt.SqlRenderer
import groovy.transform.builder.Builder
import groovy.transform.builder.SimpleStrategy
@Builder(builderStrategy = SimpleStrategy, prefix = 'with')
class ExportParams {
int pageSize = 10
List primaryKeys = []
List autoIncrement = []
Set exportFlags = Collections.emptySet()
SqlRenderer sqlRenderer
SqlDialect dialect = SqlDialect.DEFAULT
private ExportParams() {}
ExportParams autoIncrement(String key, String... otherKeys) {
if (autoIncrement == null) autoIncrement = []
autoIncrement.add(key)
if (otherKeys) autoIncrement.addAll(otherKeys)
return this
}
ExportParams withPrimaryKeys(String key, String... otherKeys) {
if (primaryKeys == null) primaryKeys = []
primaryKeys.add(key)
if (otherKeys) primaryKeys.addAll(otherKeys)
return this
}
static ExportParams of(DbExportFlags flag, DbExportFlags... flags) {
def exportFlags = DbExportFlags.of(flag, flags)
return new ExportParams().withExportFlags(exportFlags)
}
static ExportParams of(Set flags) {
return new ExportParams().withExportFlags(flags)
}
static ExportParams defaultParams(){
return new ExportParams()
}
}