All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fuzzycsv.rdbms.ExportParams.groovy Maven / Gradle / Ivy

Go to download

A groovy/java tabular Data (from CSV,SQL,JSON) processing library that supports fuzzy column matching,tranformations/merging/querying etc

There is a newer version: 1.9.1-groovy4
Show newest version
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()
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy