Skip to content

Core Objects

John James Jacoby edited this page May 27, 2026 · 1 revision

Core Objects

This page is a compact API guide for the objects in src/Database/Kern.

Column

Represents one database column.

Responsibilities:

  • store column metadata
  • infer SQL fragments
  • validate values before saving
  • cast values after reading
  • expose flags used by query parsers

Common methods:

  • Column::from_mysql()
  • is_json()
  • is_bool()
  • is_date_time()
  • is_int()
  • is_decimal()
  • is_numeric()
  • is_text()
  • is_binary()
  • cast()
  • validate()
  • get_name_sql()
  • get_create_string()

Index

Represents one database index.

Common fields:

  • name
  • type
  • columns
  • unique
  • method
  • using
  • comment

Common method:

  • get_create_string()

Schema

Stores column and index collections.

Common methods:

  • Schema::from_table()
  • setup()
  • clear()
  • add_item()
  • get_items()
  • get_item()
  • has_item()
  • remove_item()
  • add_column()
  • get_column()
  • has_column()
  • remove_column()
  • add_index()
  • get_index()
  • has_index()
  • remove_index()
  • get_create_table_string()
  • is_valid()
  • get_validation_errors()

Row

Shapes a database result into an application object.

Common method:

  • exists()

Common extension point:

  • $primary_column
  • $casts

Query

Reads, writes, filters, and shapes rows.

Common methods:

  • query()
  • set_query_var()
  • get_query_var()
  • get_column_names()
  • get_primary_column_name()
  • get_columns()
  • get_parsers()
  • get_table_name()
  • get_table_alias()
  • get_request()
  • get_found_items()
  • get_max_num_pages()
  • get_item()
  • get_item_by()
  • add_item()
  • copy_item()
  • update_item()
  • delete_item()
  • get_meta_type()
  • get_results()

Table

Manages the physical database table.

Common methods:

  • maybe_upgrade()
  • needs_upgrade()
  • install()
  • uninstall()
  • exists()
  • status()
  • columns()
  • indexes()
  • add_index()
  • drop_index()
  • create()
  • drop()
  • truncate()
  • delete_all()
  • duplicate()
  • copy()
  • count()
  • rename()
  • column_exists()
  • index_exists()
  • analyze()
  • check()
  • checksum()
  • optimize()
  • repair()
  • upgrade()
  • get_pending_upgrades()
  • upgrade_to()

Clone this wiki locally