Sha256: c6afe06d6301705e1e733722a76a4f62d3d6c2b8d2386d6176b736713c610362

Contents?: true

Size: 1.34 KB

Versions: 9

Compression:

Stored size: 1.34 KB

Contents

package org.embulk.output.jdbc;

import java.util.List;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public class JdbcSchema
{
    private List<JdbcColumn> columns;

    @JsonCreator
    public JdbcSchema(List<JdbcColumn> columns)
    {
        this.columns = columns;
    }

    @JsonValue
    public List<JdbcColumn> getColumns()
    {
        return columns;
    }

    public Optional<JdbcColumn> findColumn(String name)
    {
        for (JdbcColumn column : columns) {
            if (column.getName().equals(name)) {
                return Optional.of(column);
            }
        }
        return Optional.absent();
    }

    public int getCount()
    {
        return columns.size();
    }

    public JdbcColumn getColumn(int i)
    {
        return columns.get(i);
    }

    public String getColumnName(int i)
    {
        return columns.get(i).getName();
    }

    public static JdbcSchema filterSkipColumns(JdbcSchema schema)
    {
        ImmutableList.Builder<JdbcColumn> builder = ImmutableList.builder();
        for (JdbcColumn c : schema.getColumns()) {
            if (!c.isSkipColumn()) {
                builder.add(c);
            }
        }
        return new JdbcSchema(builder.build());
    }
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
embulk-output-jdbc-0.6.0 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.5.1 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.5.0 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.4.5 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.4.4 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.4.3 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.4.2 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.4.0 src/main/java/org/embulk/output/jdbc/JdbcSchema.java
embulk-output-jdbc-0.3.0 src/main/java/org/embulk/output/jdbc/JdbcSchema.java