Skip to content

v0.1.1

Choose a tag to compare

@github-actions github-actions released this 13 Sep 07:16
· 7 commits to main since this release

New: can_default override flag

Params structs derive Default when every field can be defaulted. Until now the plugin only recognised std types (primitives, String, uuid::Uuid, serde_json::Value, optionals, and borrowed fields), so any params struct that used a type supplied through overrides.rs_type lost the derive, even when that type implements Default.

Overrides now accept an opt-in can_default: true key, alongside copy_cheap and rs_slice, that marks the override type as defaultable:

overrides:
  - db_type: pg_catalog.int8
    rs_type: crate::money::Cents
    copy_cheap: true
    can_default: true

With the flag set, params structs whose other fields also default derive Default again, so ..Default::default() construction keeps working. The plugin runs inside sqlc's WASM sandbox and cannot inspect your crate, which is why this is declared rather than inferred.

Install

plugins:
  - name: sqlc-gen-rust
    wasm:
      url: https://github.com/orlandoc01/sqlc-gen-rust/releases/download/v0.1.1/sqlc-gen-rust.wasm
      sha256: a68a1aac823e7ab49160bf68e2f2635b7abf12475a7aee902dd5c276f6098a47

Full Changelog: v0.1.0...v0.1.1