update pgx to pgrx crate
This commit is contained in:
parent
3943a0fe27
commit
01d79841f2
18
Cargo.toml
18
Cargo.toml
|
@ -9,9 +9,9 @@ include = [
|
||||||
"README.md"
|
"README.md"
|
||||||
]
|
]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/publicmatt/pg_str"
|
repository = "https://gitea.publicmatt.com/public/pg_str"
|
||||||
documentation = "https://docs.rs/pg_str"
|
documentation = "https://docs.rs/pg_str"
|
||||||
homepage = "https://github.com/publicmatt/pg_str"
|
homepage = "https://gitea.publicmatt.com/public/pg_str"
|
||||||
license="MIT"
|
license="MIT"
|
||||||
description = """
|
description = """
|
||||||
Adds str functions to Postgresql via an extension."""
|
Adds str functions to Postgresql via an extension."""
|
||||||
|
@ -23,15 +23,15 @@ crate-type = ["cdylib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["pg13"]
|
default = ["pg13"]
|
||||||
pg11 = ["pgx/pg11", "pgx-tests/pg11"]
|
pg11 = ["pgrx/pg11", "pgrx-tests/pg11"]
|
||||||
pg12 = ["pgx/pg12", "pgx-tests/pg12"]
|
pg12 = ["pgrx/pg12", "pgrx-tests/pg12"]
|
||||||
pg13 = ["pgx/pg13", "pgx-tests/pg13"]
|
pg13 = ["pgrx/pg13", "pgrx-tests/pg13"]
|
||||||
pg14 = ["pgx/pg14", "pgx-tests/pg14"]
|
pg14 = ["pgrx/pg14", "pgrx-tests/pg14"]
|
||||||
pg15 = ["pgx/pg15", "pgx-tests/pg15"]
|
pg15 = ["pgrx/pg15", "pgrx-tests/pg15"]
|
||||||
pg_test = []
|
pg_test = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
pgx = "=0.6.1"
|
pgrx = "=0.11.2"
|
||||||
Inflector = "0.11.4"
|
Inflector = "0.11.4"
|
||||||
str_slug = "0.1.3"
|
str_slug = "0.1.3"
|
||||||
pulldown-cmark = "0.9.1"
|
pulldown-cmark = "0.9.1"
|
||||||
|
@ -40,7 +40,7 @@ rand = "0.8.4"
|
||||||
uuid = "1.2.2"
|
uuid = "1.2.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
pgx-tests = "=0.6.1"
|
pgrx-tests = "=0.11.2"
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
panic = "unwind"
|
panic = "unwind"
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -1,7 +1,7 @@
|
||||||
use pgx::prelude::*;
|
use pgrx::prelude::*;
|
||||||
|
|
||||||
use rand::distributions::{Alphanumeric, DistString};
|
use rand::distributions::{Alphanumeric, DistString};
|
||||||
use rand::thread_rng;
|
|
||||||
use any_ascii::any_ascii;
|
use any_ascii::any_ascii;
|
||||||
use inflector::cases::{
|
use inflector::cases::{
|
||||||
camelcase, kebabcase, pascalcase, screamingsnakecase, snakecase, titlecase,
|
camelcase, kebabcase, pascalcase, screamingsnakecase, snakecase, titlecase,
|
||||||
|
@ -11,8 +11,7 @@ use pulldown_cmark::{html, Options, Parser};
|
||||||
use str_slug::StrSlug;
|
use str_slug::StrSlug;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
pgrx::pg_module_magic!();
|
||||||
pgx::pg_module_magic!();
|
|
||||||
|
|
||||||
#[pg_extern]
|
#[pg_extern]
|
||||||
fn str_random(length: i32) -> String {
|
fn str_random(length: i32) -> String {
|
||||||
|
@ -29,7 +28,7 @@ fn str_after<'a>(input: &'a str, search: &str) -> &'a str {
|
||||||
let matches: Vec<_> = input.match_indices(search).collect();
|
let matches: Vec<_> = input.match_indices(search).collect();
|
||||||
match matches.first() {
|
match matches.first() {
|
||||||
None => input,
|
None => input,
|
||||||
Some(x) => &input[x.1.len()..]
|
Some(x) => &input[x.1.len()..],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #[pg_extern]
|
// #[pg_extern]
|
||||||
|
@ -43,7 +42,6 @@ fn str_after<'a>(input: &'a str, search: &str) -> &'a str {
|
||||||
// fn str_between<'a>(input: &'a str, search: &str) -> &'a str {
|
// fn str_between<'a>(input: &'a str, search: &str) -> &'a str {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
#[pg_extern]
|
#[pg_extern]
|
||||||
fn str_uuid() -> String {
|
fn str_uuid() -> String {
|
||||||
Uuid::new_v4().to_string()
|
Uuid::new_v4().to_string()
|
||||||
|
@ -168,7 +166,6 @@ fn str_split_set<'a>(input: &'a str, pattern: &'a str) -> SetOfIterator<'a, &'a
|
||||||
#[cfg(any(test, feature = "pg_test"))]
|
#[cfg(any(test, feature = "pg_test"))]
|
||||||
#[pg_schema]
|
#[pg_schema]
|
||||||
mod tests {
|
mod tests {
|
||||||
use pgx::prelude::*;
|
|
||||||
|
|
||||||
// #[pg_test]
|
// #[pg_test]
|
||||||
// fn test_hello_pg_str() {
|
// fn test_hello_pg_str() {
|
||||||
|
|
Loading…
Reference in New Issue