Skip to content

Commit b09d82a

Browse files
authored
Merge pull request #43 from diesel-rs/prepare/2.2.x
Make the crate compatible with diesel 2.2
2 parents a1484bf + 82acb64 commit b09d82a

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
[package]
22
name = "diesel_full_text_search"
3-
version = "2.1.1"
3+
version = "2.2.0"
44
description = "Adds support for PostgreSQL full text search to Diesel"
55
license = "MIT"
66
repository = "https://github.com/diesel-rs/diesel_full_text_search"
7+
edition = "2021"
78

89
[dependencies]
9-
diesel = { version = "~2.1.0", features = ["postgres_backend"], default-features = false }
10+
diesel = { version = "~2.2.0", features = ["postgres_backend"], default-features = false }
1011

1112
[features]
1213
default = ["with-diesel-postgres"]

src/lib.rs

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#[macro_use]
2-
extern crate diesel;
3-
41
mod types {
52
use diesel::sql_types::*;
63

@@ -110,63 +107,64 @@ pub mod configuration {
110107

111108
#[allow(deprecated)]
112109
mod functions {
110+
use crate::types::*;
111+
use diesel::define_sql_function;
113112
use diesel::sql_types::*;
114-
use types::*;
115113

116-
sql_function!(fn length(x: TsVector) -> Integer);
117-
sql_function!(fn numnode(x: TsQuery) -> Integer);
118-
sql_function!(fn plainto_tsquery(x: Text) -> TsQuery);
119-
sql_function! {
114+
define_sql_function!(fn length(x: TsVector) -> Integer);
115+
define_sql_function!(fn numnode(x: TsQuery) -> Integer);
116+
define_sql_function!(fn plainto_tsquery(x: Text) -> TsQuery);
117+
define_sql_function! {
120118
#[sql_name = "plainto_tsquery"]
121119
fn plainto_tsquery_with_search_config(config: RegConfig, querytext: Text) -> TsQuery;
122120
}
123-
sql_function!(fn querytree(x: TsQuery) -> Text);
124-
sql_function!(fn strip(x: TsVector) -> TsVector);
125-
sql_function!(fn to_tsquery(x: Text) -> TsQuery);
126-
sql_function! {
121+
define_sql_function!(fn querytree(x: TsQuery) -> Text);
122+
define_sql_function!(fn strip(x: TsVector) -> TsVector);
123+
define_sql_function!(fn to_tsquery(x: Text) -> TsQuery);
124+
define_sql_function! {
127125
#[sql_name = "to_tsquery"]
128126
fn to_tsquery_with_search_config(config: RegConfig, querytext: Text) -> TsQuery;
129127
}
130-
sql_function!(fn to_tsvector<T: TextOrNullableText + SingleValue>(x: T) -> TsVector);
131-
sql_function! {
128+
define_sql_function!(fn to_tsvector<T: TextOrNullableText + SingleValue>(x: T) -> TsVector);
129+
define_sql_function! {
132130
#[sql_name = "to_tsvector"]
133131
fn to_tsvector_with_search_config<T: TextOrNullableText + SingleValue>(config: RegConfig, document_content: T) -> TsVector;
134132
}
135-
sql_function!(fn ts_headline(x: Text, y: TsQuery) -> Text);
136-
sql_function! {
133+
define_sql_function!(fn ts_headline(x: Text, y: TsQuery) -> Text);
134+
define_sql_function! {
137135
#[sql_name = "ts_headline"]
138136
fn ts_headline_with_search_config(config: RegConfig, x: Text, y: TsQuery) -> Text;
139137
}
140-
sql_function!(fn ts_rank(x: TsVector, y: TsQuery) -> Float);
141-
sql_function!(fn ts_rank_cd(x: TsVector, y: TsQuery) -> Float);
142-
sql_function! {
138+
define_sql_function!(fn ts_rank(x: TsVector, y: TsQuery) -> Float);
139+
define_sql_function!(fn ts_rank_cd(x: TsVector, y: TsQuery) -> Float);
140+
define_sql_function! {
143141
#[sql_name = "ts_rank_cd"]
144142
fn ts_rank_cd_weighted(w: Array<Float>, x: TsVector, y: TsQuery) -> Float;
145143
}
146-
sql_function! {
144+
define_sql_function! {
147145
#[sql_name = "ts_rank_cd"]
148146
fn ts_rank_cd_normalized(x: TsVector, y: TsQuery, n: Integer) -> Float;
149147
}
150-
sql_function! {
148+
define_sql_function! {
151149
#[sql_name = "ts_rank_cd"]
152150
fn ts_rank_cd_weighted_normalized(w: Array<Float>, x: TsVector, y: TsQuery, n: Integer) -> Float;
153151
}
154-
sql_function!(fn phraseto_tsquery(x: Text) -> TsQuery);
155-
sql_function!(fn websearch_to_tsquery(x: Text) -> TsQuery);
156-
sql_function! {
152+
define_sql_function!(fn phraseto_tsquery(x: Text) -> TsQuery);
153+
define_sql_function!(fn websearch_to_tsquery(x: Text) -> TsQuery);
154+
define_sql_function! {
157155
#[sql_name = "websearch_to_tsquery"]
158156
fn websearch_to_tsquery_with_search_config(config: RegConfig, x: Text) -> TsQuery;
159157
}
160-
sql_function!(fn setweight(x: TsVector, w: CChar) -> TsVector);
158+
define_sql_function!(fn setweight(x: TsVector, w: CChar) -> TsVector);
161159
}
162160

163161
mod dsl {
162+
use crate::types::*;
164163
use diesel::expression::{AsExpression, Expression};
165-
use types::*;
166164

167165
mod predicates {
166+
use crate::types::*;
168167
use diesel::pg::Pg;
169-
use types::*;
170168

171169
diesel::infix_operator!(Matches, " @@ ", backend: Pg);
172170
diesel::infix_operator!(Concat, " || ", TsVector, backend: Pg);

0 commit comments

Comments
 (0)