diff --git a/docs/guides/plugins.md b/docs/guides/plugins.md index 0f3efe026d..031f8f979f 100644 --- a/docs/guides/plugins.md +++ b/docs/guides/plugins.md @@ -1,10 +1,58 @@ # Authoring plugins +To use plugins, you must be using [Version 2](../reference/config.html) of +the configuration file. The top-level `plugins` array defines the available +plugins. + +## WASM plugins + +> WASM plugins are fully sandboxed. Plugins do not have access to the network, +> filesystem, or environment variables. + +In the `codegen` section, the `out` field dictates what directory will contain +the new files. The `plugin` key must reference a plugin defined in the +top-level `plugins` map. The `options` are serialized to a string and passed on +to the plugin itself. + + +```json +{ + "version": "2", + "plugins": [ + { + "name": "greeter", + "wasm": { + "url": "https://github.com/kyleconroy/sqlc-gen-greeter/releases/download/v0.1.0/sqlc-gen-greeter.wasm", + "sha256": "afc486dac2068d741d7a4110146559d12a013fd0286f42a2fc7dcd802424ad07" + } + } + ], + "sql": [ + { + "schema": "schema.sql", + "queries": "query.sql", + "engine": "postgresql", + "codegen": [ + { + "out": "gen", + "plugin": "greeter" + } + ] + } + ] +} +``` + +For a complete working example see the following files: +- [sqlc-gen-greeter](https://github.com/kyleconroy/sqlc-gen-greeter) + - A WASM plugin (written in Rust) that outputs a friendly message +- [wasm_plugin_sqlc_gen_greeter](https://github.com/kyleconroy/sqlc/tree/main/internal/endtoend/testdata/wasm_plugin_sqlc_gen_greeter) + - An example project showing how to use a WASM plugin + ## Process plugins -To use process-based plugins, you must be using [Version -2](../reference/config.html) of the configuration file. The top-level `plugins` -array defines the available plugins and maps them to an executable on the system. +> Process-based plugins offer minimal security. Only use plugins that you +> trust. Better yet, only use plugins that you've written yourself. In the `codegen` section, the `out` field dictates what directory will contain the new files. The `plugin` key must reference a plugin defined in the @@ -47,12 +95,3 @@ For a complete working example see the following files: - A process-based plugin that serializes the CodeGenRequest to JSON - [process_plugin_sqlc_gen_json](https://github.com/kyleconroy/sqlc/tree/main/internal/endtoend/testdata/process_plugin_sqlc_gen_json) - An example project showing how to use a process-based plugin - -### Security - -Process-based plugins offer minimal security. Only use plugins that you trust. -Better yet, only use plugins that you've written yourself. - -## WASM plugins - -*Coming soon!* diff --git a/docs/reference/changelog.md b/docs/reference/changelog.md index ddabfb5781..21756e82dd 100644 --- a/docs/reference/changelog.md +++ b/docs/reference/changelog.md @@ -1,6 +1,55 @@ # Changelog All notable changes to this project will be documented in this file. +## [1.15.0](https://github.com/kyleconroy/sqlc/releases/tag/1.15.0) +Released 2022-08-07 + +### Bug Fixes + +- (mysql) Typo (#1700) +- (postgresql) Add quotes for CamelCase columns (#1729) +- Cannot parse SQLite upsert statement (#1732) +- (sqlite) Regenerate test output for builtins (#1735) +- (wasm) Version modules by wasmtime version (#1734) +- Missing imports (#1637) +- Missing slice import for querier (#1773) + +### Documentation + +- Add process-based plugin docs (#1669) +- Add links to downloads.sqlc.dev (#1681) +- Update transactions how to example (#1775) + +### Features + +- More SQL Syntax Support for SQLite (#1687) +- (sqlite) Promote SQLite support to beta (#1699) +- Codegen plugins, powered by WASM (#1684) +- Set user-agent for plugin downloads (#1707) +- Null enums types (#1485) +- (sqlite) Support stdlib functions (#1712) +- (sqlite) Add support for returning (#1741) + +### Miscellaneous Tasks + +- Add tests for quoting columns (#1733) +- Remove catalog tests (#1762) + +### Testing + +- Add tests for fixing slice imports (#1736) +- Add test cases for returning (#1737) + +### Build + +- Upgrade to Go 1.19 (#1780) +- Upgrade to go-wasmtime 0.39.0 (#1781) + +### Plugins + +- (wasm) Change default cache location (#1709) +- (wasm) Change the SHA-256 config key (#1710) + ## [1.14.0](https://github.com/kyleconroy/sqlc/releases/tag/1.14.0) Released 2022-06-09