PgRest.Registry (PgRest v0.1.0)

Copy Markdown View Source

GenServer that discovers and indexes PgRest resources at startup.

Uses ETS for concurrent read access — lookups don't serialize through the GenServer.

Summary

Functions

Returns a specification to start this module under a supervisor.

Looks up a resource by table name (string) or module (atom).

Returns all registered resource configs.

Starts the registry GenServer.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_resource(table_or_module)

@spec get_resource(String.t() | module()) :: {:ok, map()} | {:error, :not_found}

Looks up a resource by table name (string) or module (atom).

list_resources()

@spec list_resources() :: [map()]

Returns all registered resource configs.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()

Starts the registry GenServer.

Options

  • :otp_app - application to scan for PgRest resources (auto-discovery)
  • :modules - explicit list of modules to register (skips discovery)
  • :name - GenServer name (default: PgRest.Registry)