-
-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo-pgx
template support
#490
base: develop
Are you sure you want to change the base?
cargo-pgx
template support
#490
Conversation
…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)
cargo-pgx
template support
@@ -1,41 +1,74 @@ | |||
[package] | |||
name = "cargo-pgx" |
There was a problem hiding this comment.
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.
use serde::{Deserialize, Serialize}; | ||
use structmap::{value::Value, GenericMap, StringMap, ToMap}; | ||
use structmap_derive::ToMap; | ||
|
||
/// Create a new extension crate | ||
#[derive(clap::Args, Debug)] | ||
#[clap(author)] | ||
pub(crate) struct New { | ||
/// The name of the extension | ||
name: String, | ||
/// Create a background worker template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// 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 |
There was a problem hiding this comment.
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 }}; |
There was a problem hiding this comment.
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 :|
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? |
They replace the previous single shot bgworker config switch
All files are templated out of the
./src/templates
directoriesPossible to do:
./src/lib.rs
,Cargo.toml
etc..)./src/template
directories to include (static atm)