File tree 6 files changed +61
-60
lines changed
6 files changed +61
-60
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ RUN curl -sSL https://www.sqlite.org/2024/sqlite-autoconf-$SQLITE_VER.tar.gz | t
138
138
# See https://github.com/sgrif/pq-sys/pull/18
139
139
ENV PATH=/root/.cargo/bin:$PREFIX/bin:$PATH \
140
140
RUSTUP_HOME=/root/.rustup \
141
- CARGO_BUILD_TARGET=x86_64-unknown-linux-musl \
141
+ CARGO_BUILD_TARGET=x86_64-unknown-linux-musl \
142
142
PKG_CONFIG_ALLOW_CROSS=true \
143
143
PKG_CONFIG_ALL_STATIC=true \
144
144
PQ_LIB_STATIC_X86_64_UNKNOWN_LINUX_MUSL=true \
Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ name = "dieselpgcrate"
4
4
version = " 0.1.0"
5
5
6
6
[dependencies ]
7
- diesel = { version = " 1.4 .*" , features = [" postgres" ] }
7
+ diesel = { version = " 2.1 .*" , features = [" postgres" ] }
8
8
openssl = " *"
Original file line number Diff line number Diff line change 1
1
// The order of these extern crate lines matter for ssl!
2
2
extern crate openssl;
3
- #[ macro_use] extern crate diesel;
3
+ #[ macro_use]
4
+ extern crate diesel;
4
5
// openssl must be included before diesel atm.
5
6
6
7
mod schema {
7
- table ! {
8
- posts ( id) {
9
- id -> Int4 ,
10
- title -> Varchar ,
11
- body -> Text ,
12
- published -> Bool ,
13
- }
14
- }
8
+ table ! {
9
+ posts ( id) {
10
+ id -> Int4 ,
11
+ title -> Varchar ,
12
+ body -> Text ,
13
+ published -> Bool ,
14
+ }
15
+ }
15
16
}
16
17
17
18
mod models {
18
- use schema:: posts;
19
- #[ derive( Queryable ) ]
20
- pub struct Post {
21
- pub id : i32 ,
22
- pub title : String ,
23
- pub body : String ,
24
- pub published : bool ,
25
- }
19
+ use schema:: posts;
20
+ #[ derive( Queryable ) ]
21
+ pub struct Post {
22
+ pub id : i32 ,
23
+ pub title : String ,
24
+ pub body : String ,
25
+ pub published : bool ,
26
+ }
26
27
27
- // apparently this can be done without heap storage, but lifetimes spread far..
28
- #[ derive( Insertable ) ]
29
- # [ table_name= " posts" ]
30
- pub struct NewPost {
31
- pub title : String ,
32
- pub body : String ,
33
- }
28
+ // apparently this can be done without heap storage, but lifetimes spread far..
29
+ #[ derive( Insertable ) ]
30
+ # [ diesel ( table_name = posts) ]
31
+ pub struct NewPost {
32
+ pub title : String ,
33
+ pub body : String ,
34
+ }
34
35
}
35
36
36
- use diesel:: prelude:: * ;
37
37
use diesel:: pg:: PgConnection ;
38
+ use diesel:: prelude:: * ;
38
39
39
40
fn main ( ) {
40
41
let database_url = std:: env:: var ( "DATABASE_URL" )
41
- . unwrap_or ( "postgres://localhost?connect_timeout=1&sslmode=require" . into ( ) ) ;
42
+ . unwrap_or ( "postgres://localhost?connect_timeout=1&sslmode=require" . into ( ) ) ;
42
43
match PgConnection :: establish ( & database_url) {
43
- Err ( e) => {
44
- println ! ( "Should fail to connect here:" ) ;
45
- println ! ( "{}" , e) ;
46
- }
47
- Ok ( _) => {
48
- unreachable ! ( ) ;
49
- }
44
+ Err ( e) => {
45
+ println ! ( "Should fail to connect here:" ) ;
46
+ println ! ( "{}" , e) ;
47
+ }
48
+ Ok ( _) => {
49
+ unreachable ! ( ) ;
50
+ }
50
51
}
51
52
}
Original file line number Diff line number Diff line change @@ -4,4 +4,4 @@ name = "dieselsqlitecrate"
4
4
version = " 0.1.0"
5
5
6
6
[dependencies ]
7
- diesel = { version = " 1.4 .*" , features = [" sqlite" ] }
7
+ diesel = { version = " 2.1 .*" , features = [" sqlite" ] }
Original file line number Diff line number Diff line change 2
2
extern crate diesel;
3
3
4
4
mod schema {
5
- table ! {
6
- posts ( id) {
7
- id -> Int4 ,
8
- title -> Varchar ,
9
- body -> Text ,
10
- published -> Bool ,
11
- }
12
- }
5
+ table ! {
6
+ posts ( id) {
7
+ id -> Int4 ,
8
+ title -> Varchar ,
9
+ body -> Text ,
10
+ published -> Bool ,
11
+ }
12
+ }
13
13
}
14
14
15
15
mod models {
16
- use schema:: posts;
17
- #[ derive( Queryable ) ]
18
- pub struct Post {
19
- pub id : i32 ,
20
- pub title : String ,
21
- pub body : String ,
22
- pub published : bool ,
23
- }
16
+ use schema:: posts;
17
+ #[ derive( Queryable ) ]
18
+ pub struct Post {
19
+ pub id : i32 ,
20
+ pub title : String ,
21
+ pub body : String ,
22
+ pub published : bool ,
23
+ }
24
24
25
- // apparently this can be done without heap storage, but lifetimes spread far..
26
- #[ derive( Insertable ) ]
27
- # [ table_name= " posts" ]
28
- pub struct NewPost {
29
- pub title : String ,
30
- pub body : String ,
31
- }
25
+ // apparently this can be done without heap storage, but lifetimes spread far..
26
+ #[ derive( Insertable ) ]
27
+ # [ diesel ( table_name = posts) ]
28
+ pub struct NewPost {
29
+ pub title : String ,
30
+ pub body : String ,
31
+ }
32
32
}
33
33
34
34
use diesel:: prelude:: * ;
Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ name = "pqcrate"
4
4
version = " 0.1.0"
5
5
6
6
[dependencies ]
7
- pq-sys = " 0.4. 5"
7
+ pq-sys = " 0.5"
8
8
openssl = " *"
You can’t perform that action at this time.
0 commit comments