Skip to content
n-tdi edited this page Feb 21, 2023 · 2 revisions

Columns are basically the opposite of rows! What's best is that they are super easy to understand with Postglam!

Referencing a column inside of a table

We're going to assume we have access to the table object we are talking about, and that the column exists inside the table already. If you want to add a column, see Table

Table table = ...

Column name = new Column(table, "name");

Super easy right! Postglam takes care of all the important methods of getting a column and such.

With a Postglam column, the most important thing you'd want is all the data inside the column

Column name = ...

Object[] values = name.getValues(); // Access to all values unsorted,

Now it's great that we can get anonymous data, but sometimes we want access to the primary key associated with that column! For this, we use Postglam's IDColumn

IDColumn

IDColumn is quite literally, the exact same, as Column in terms of making it.

Table table = ...

IDColumn name = new IDColumn(table, "name");

As you would expect, Postglam gives you a super easy method to get all the data from that column!

IDColumn name = ...

LinkedHashMap<String, Object> values = name.getValues(); // Access to all values with their corresponding primary key unsorted

Postglam is your best friend here.

Other Methods

Column name = ...

Table table = name.getTable(); // Get the table used to create the column
String columnName = name.getColumnName(); // Get the column's name
Map.Entry<String, DataTypes> type = name.getColumnValues(); // Get the column's meta value, Name and Datatype

Advanced

For all the information you could possibly want on columns. Check out the Javadocs.

Clone this wiki locally