Class: DuckDB::ColumnDescription
- Inherits:
-
Data
- Object
- Data
- DuckDB::ColumnDescription
- Defined in:
- lib/duckdb/column_description.rb
Overview
DuckDB::ColumnDescription is an immutable value object describing a single column returned by DuckDB::TableDescription#column_descriptions.
It is defined using Data.define and exposes three attributes:
-
name— the column name as a String -
logical_type— a DuckDB::LogicalType representing the column’s type -
has_default—trueif the column has a DEFAULT value,falseotherwise
A predicate alias has_default? is provided for idiomatic Ruby usage.
Requires DuckDB >= 1.5.0.
require 'duckdb'
db = DuckDB::Database.open
con = db.connect
con.query("CREATE TABLE t (id INTEGER, name VARCHAR DEFAULT 'anon')")
td = DuckDB::TableDescription.new(con, 't')
cd = td.column_descriptions.last
cd.name #=> "name"
cd.logical_type.type #=> :varchar
cd.has_default? #=> true
Instance Attribute Summary collapse
-
#has_default ⇒ Object
(also: #has_default?)
readonly
Returns the value of attribute has_default.
-
#logical_type ⇒ Object
readonly
Returns the value of attribute logical_type.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Attribute Details
#has_default ⇒ Object (readonly) Also known as: has_default?
Returns the value of attribute has_default
28 29 30 |
# File 'lib/duckdb/column_description.rb', line 28 def has_default @has_default end |
#logical_type ⇒ Object (readonly)
Returns the value of attribute logical_type
28 29 30 |
# File 'lib/duckdb/column_description.rb', line 28 def logical_type @logical_type end |
#name ⇒ Object (readonly)
Returns the value of attribute name
28 29 30 |
# File 'lib/duckdb/column_description.rb', line 28 def name @name end |