Module: Sequel::Extension::PgComment::DatasetMethods

Defined in:
lib/sequel/extensions/pg_comment/dataset_methods.rb

Overview

Support for retrieving column comments from a PostgreSQL database via a dataset. For example:

DB[:foo_tbl].comment_for(:some_column)

Will retrieve the comment for foo_tbl.some_column, if such a column exists.

Instance Method Summary collapse

Instance Method Details

#comment_for(col) ⇒ String, NilClass

Retrieve the comment for the column named col in the "primary" table for this dataset.

Parameters:

  • col (#to_s)

    The name of the column for which to retrieve the comment.

Returns:

  • (String, NilClass)

    The comment defined for the column, or nil if there is no defined comment.



19
20
21
# File 'lib/sequel/extensions/pg_comment/dataset_methods.rb', line 19

def comment_for(col)
  db.comment_for("#{first_source_table}__#{col}")
end