Synclets logoSynclets

getTableSchema

The getTableSchema function retrieves the schema of a table from a Cloudflare Durable Object SQL Storage, returning an object mapping column names to their data types.

getTableSchema(
  sqlStorage: SqlStorage,
  table: string,
): Promise<TableSchema>
TypeDescription
sqlStorageSqlStorage

The Durable Object SQL Storage instance.

tablestring

The name of the table to inspect.

returnsPromise<TableSchema>

A Promise that resolves to an object mapping column names to types.

This utility function provides a standardized way to inspect table structure across different database connectors, with consistent output format regardless of the underlying database engine.

Since

v0.0.7