Skip to content

Commit ff350b4

Browse files
committed
Rebase on 1.1.x
1 parent e7c32d8 commit ff350b4

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ time = { version = "0.3", features = ["formatting"], optional = true }
3535
[features]
3636
default = ["field-camel-case", "schema-meta"]
3737
macros = ["seaography-macros"]
38-
schema-meta = ["macros", "serde/derive", "with-postgres-array"]
38+
schema-meta = ["macros", "serde/derive"]
3939
rbac = ["sea-orm/rbac"]
4040
with-json = ["sea-orm/with-json"]
4141
with-chrono = ["sea-orm/with-chrono", "async-graphql/chrono"]

examples/postgres/tests/entity_metadata_tests.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use async_graphql::{dynamic::*, Response};
22
use sea_orm::Database;
33
use seaography::async_graphql;
44

5-
pub async fn get_schema() -> Schema {
5+
pub async fn schema() -> Schema {
66
let database = Database::connect("postgres://sea:[email protected]/sakila")
77
.await
88
.unwrap();
@@ -20,7 +20,7 @@ pub fn assert_eq(a: Response, b: &str) {
2020

2121
#[tokio::test]
2222
async fn test_entity_metadata() {
23-
let schema = get_schema().await;
23+
let schema = schema().await;
2424

2525
assert_eq(
2626
schema
@@ -244,6 +244,15 @@ async fn test_entity_metadata() {
244244
},
245245
"enumeration": null
246246
}
247+
},
248+
{
249+
"name": "metadata",
250+
"nullable": true,
251+
"type_": {
252+
"primitive": "json",
253+
"array": null,
254+
"enumeration": null
255+
}
247256
}
248257
],
249258
"primary_key": [

examples/postgres/tests/guard_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ async fn entity_guard() {
280280
.execute(
281281
r#"
282282
{
283-
language(orderBy: { languageId: ASC }) {
283+
language(filters: { languageId: { lte: 6 } }, orderBy: { languageId: ASC }) {
284284
nodes {
285285
languageId
286286
name

src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ impl Builder {
385385
self.register_custom_output::<schema::Array>();
386386
self.register_custom_output::<schema::Enumeration>();
387387

388-
use crate::GqlOutputModelType;
388+
use crate::CustomOutputType;
389389
use async_graphql::dynamic::FieldValue;
390390

391391
const TABLE_NAME: &str = "table_name";

src/schema.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use crate as seaography;
2-
use crate::macros::CustomOutput;
2+
use crate::CustomOutputType;
33
use serde::Deserialize;
44

5-
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutput)]
5+
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutputType)]
66
pub struct Table {
77
pub columns: Vec<Column>,
88
pub primary_key: Vec<String>,
99
pub comment: Option<String>,
1010
}
1111

12-
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutput)]
12+
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutputType)]
1313
pub struct Column {
1414
pub name: String,
1515
#[serde(rename = "type")]
@@ -19,19 +19,19 @@ pub struct Column {
1919
pub comment: Option<String>,
2020
}
2121

22-
#[derive(Debug, Clone, PartialEq, CustomOutput)]
22+
#[derive(Debug, Clone, PartialEq, CustomOutputType)]
2323
pub struct ColumnType {
2424
pub primitive: Option<String>,
2525
pub array: Option<Array>,
2626
pub enumeration: Option<Enumeration>,
2727
}
2828

29-
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutput)]
29+
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutputType)]
3030
pub struct Array {
3131
pub array: Box<ColumnType>,
3232
}
3333

34-
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutput)]
34+
#[derive(Debug, Clone, PartialEq, Deserialize, CustomOutputType)]
3535
pub struct Enumeration {
3636
pub name: String,
3737
pub variants: Vec<String>, // this requires `postgres-array`

0 commit comments

Comments
 (0)