Skip to content

Instantly share code, notes, and snippets.

@Hywan
Created August 28, 2019 14:36
Show Gist options
  • Save Hywan/973d227be5ee91de3bb9973a81e7035e to your computer and use it in GitHub Desktop.
Save Hywan/973d227be5ee91de3bb9973a81e7035e to your computer and use it in GitHub Desktop.
Introspect a WebAssembly module with Postgres
-- Select all WebAssembly instances.
SELECT * FROM wasm.instances;
-- id | wasm_file
-- --------------------------------------+-------------------------------
-- 426e17af-c32f-5027-ad73-239e5450dd91 | /absolute/path/to/simple.wasm
-- (1 row)
-- Select all exported functions for a specific instance.
SELECT
name,
inputs,
outputs
FROM
wasm.exported_functions
WHERE
instance_id = '426e17af-c32f-5027-ad73-239e5450dd91';
-- name | inputs | outputs
-- --------+-----------------+---------
-- ns_sum | integer,integer | integer
-- (1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment