Skip to content

Commit

Permalink
fix: added stored procedures
Browse files Browse the repository at this point in the history
  • Loading branch information
AbelHristodor committed Feb 5, 2024
1 parent 7393c3b commit afebf51
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgcronner"
version = "0.1.9"
version = "0.1.13"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
14 changes: 7 additions & 7 deletions pgcronner.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PgCronner(object):
Get all jobs in the table
:return: List of jobs as dicts
:throws: OSError
:throws: OSError, ValueError
"""

def one(self, jobname: str) -> Optional[Dict[str, str]]:
Expand All @@ -49,7 +49,7 @@ class PgCronner(object):
:param jobname: job name
:return: Job instance or None, as dict
:throws: OsError
:throws: OsError, ValueError
"""

def add(self, job: Job) -> bool:
Expand All @@ -59,7 +59,7 @@ class PgCronner(object):
:param job: Job instance
:return: True if successful
:throws: OsError
:throws: OsError, ValueError
"""

def remove(self, jobname: str) -> bool:
Expand All @@ -69,7 +69,7 @@ class PgCronner(object):
:param jobname: job name
:return: True if successful
:throws: OsError
:throws: OsError, ValueError
"""

def refresh(self) -> bool:
Expand All @@ -78,7 +78,7 @@ class PgCronner(object):
:return: True if successful
:throws: OsError
:throws: OsError, ValueError
"""

def clear(self) -> bool:
Expand All @@ -87,7 +87,7 @@ class PgCronner(object):
:return: True if successful
:throws: OsError
:throws: OsError, ValueError
"""


Expand All @@ -97,6 +97,6 @@ class PgCronner(object):
:return: True if successful
:throws: OsError
:throws: OsError, ValueError
"""

7 changes: 3 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ pub fn create_stored_procedure(
) -> Result<(), DbError> {
match client.query(
&format!(
"CREATE OR REPLACE FUNCTION {}() RETURNS void AS $$
BEGIN
"CREATE OR REPLACE PROCEDURE {}() LANGUAGE SQL
BEGIN ATOMIC
{}
END;
$$ LANGUAGE plpgsql;",
END;",
name, source
),
&[],
Expand Down

0 comments on commit afebf51

Please sign in to comment.