Skip to content

cargo-pgx template support#490

Closed
jamessewell wants to merge 1 commit intopgcentralfoundation:developfrom
jamessewell:cargo-pgx-templates
Closed

cargo-pgx template support#490
jamessewell wants to merge 1 commit intopgcentralfoundation:developfrom
jamessewell:cargo-pgx-templates

Conversation

@jamessewell
Copy link
Contributor

@jamessewell jamessewell commented Mar 21, 2022

They replace the previous single shot bgworker config switch

All files are templated out of the ./src/templates directories

Possible to do:

  • check (at compile time) that templates have a MVP list of files (./src/lib.rs, Cargo.toml etc..)
  • Build (at compile time) a list of ./src/template directories to include (static atm)

…o-pgx

to replace the previous bgworker config

All files are templated out of the ./src/templates directories

Possible to do:

- check (at compile time) that templates have a MVP list of files (./src/lib.rs, Cargo.toml etc..)
- Build (at compile time) a list of ./src/template directories to include (static atm)
@Hoverbear Hoverbear changed the title These changes are a first go at a concept of cargo-pgx templates cargo-pgx template support Mar 21, 2022
@@ -1,41 +1,74 @@
[package]
name = "cargo-pgx"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be quite a bit of unrelated changes in this file.

pub(crate) struct New {
/// The name of the extension
name: String,
/// Create a background worker template
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Create a background worker template
/// Create an extension from a template


// This is an example of a basic agg which adds values to a HashSet
// then returns the number of elements which have been added
// see https://hoverbear.org/blog/postgresql-aggregates-with-rust/ for more examples
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, we should add this to /articles in the repo...

pg_module_magic!();

#[derive(Copy, Clone, Default, Debug)]
pub struct {{ camel-case name }};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unfortunate how the template syntax is so similar to Rust :|

@Hoverbear
Copy link
Contributor

All in all I'm pretty pleased with this @jamessewell . :) In your commit you mentioned this was a first go, are you planning on making further changes or should I take it for a spin?

@eeeebbbbrrrr
Copy link
Contributor

eeeebbbbrrrr commented Jun 28, 2025

Looks like this has bitrotted quite a bit. @jamessewell if you wanted to bring this up to modern times I'd be happy to help get your vision over the finish line. Until then, I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants