Package org.dalesbred.result
Class ResultTable
java.lang.Object
org.dalesbred.result.ResultTable
- All Implemented Interfaces:
Iterable<ResultTable.ResultRow>
Represents the results of the query along with its metadata. Basically a detached
version of
ResultSet
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A builder for building ResultTables.static class
Provides metadata about a column of the result.static class
Represents a single row of results. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull ResultTable.Builder
builder
(@NotNull List<ResultTable.ColumnMetadata> columns) Returns a builder for building a ResultTable for given columns.void
formatTo
(@NotNull Appendable out) Pretty prints this table toout
in a format suitable for console.get
(int row, int column) Returns the value of given column of given row.Returns the value of given named column of given row.int
@NotNull List<ResultTable.ColumnMetadata>
int
@NotNull List<ResultTable.ResultRow>
getRows()
@NotNull Iterator<ResultTable.ResultRow>
iterator()
@NotNull String
toString()
@NotNull String
Returns a formatted representation of this table.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getRowCount
public int getRowCount() -
getColumnCount
public int getColumnCount() -
get
Returns the value of given column of given row. Both indices are zero-based. -
get
Returns the value of given named column of given row. -
getRows
-
getColumns
-
getColumnNames
-
getColumnTypes
-
getRawColumnTypes
-
iterator
- Specified by:
iterator
in interfaceIterable<ResultTable.ResultRow>
-
toString
-
toStringFormatted
Returns a formatted representation of this table. SeeformatTo(Appendable)
for details of the format.- See Also:
-
formatTo
Pretty prints this table toout
in a format suitable for console. Overly long columns are truncated and some effort is taken to make the result readable, but you should not depend on the exact details of the layout, since it might change.Hint: the output format is rouhgly that of Markdown tables, so you can use the result in your Markdown-documents. However, data is not escaped, since it's primarily meant to be written to console where escaping would hinder readability. Therefore, you might need to make manual adjustments to output if interpreting it as Markdown.
- Throws:
IOException
- See Also:
-
builder
@NotNull public static @NotNull ResultTable.Builder builder(@NotNull @NotNull List<ResultTable.ColumnMetadata> columns) Returns a builder for building a ResultTable for given columns.
-