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

com.chutneytesting.admin.domain.SqlResult Maven / Gradle / Ivy

package com.chutneytesting.admin.domain;

import java.util.List;
import java.util.Optional;

public class SqlResult {
    public final Optional updatedRows;
    public final Optional error;
    public final Optional table;

    public SqlResult(Optional updatedRows, Optional error, Optional
table) { this.updatedRows = updatedRows; this.error = error; this.table = table; } public static SqlResult error(String error) { return new SqlResult(Optional.empty(), Optional.of(error), Optional.empty()); } public static SqlResult updatedRows(int updateCount) { return new SqlResult(Optional.of(updateCount), Optional.empty(), Optional.empty()); } public static SqlResult data(Table table) { return new SqlResult(Optional.empty(), Optional.empty(), Optional.of(table)); } public static class Table { public final List columnNames; public final List rows; public Table(List columnNames, List rows) { this.columnNames = columnNames; this.rows = rows; } } public static class Row { public final List values; public Row(List values) { this.values = values; } } }