-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphqls
76 lines (67 loc) · 1.77 KB
/
schema.graphqls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# GraphQL schema example
#
# https://gqlgen.com/getting-started/
enum TodoType{
Bug, Feature
}
scalar Test
type Todo @SQL(order: 3){
id: ID! @SQL_PRIMARY @SQL_GORM(value: "autoIncrement")
name: String!
users: [User!]! @SQL_GORM(value:"many2many:todo_users;constraint:OnDelete:CASCADE") @SQL_SKIP_MUTATION
owner: User! @SQL_SKIP_MUTATION
ownerID: ID! @SQL_SKIP_MUTATION
createdAt: Time
updatedAt: Time
deletedAt: Time
etype1: TodoType
# etype2: [TodoType]
# etype3: [TodoType!]
# etype4: [TodoType!]!
etype5: TodoType!
test123: Test
noControl: NoSqlControl @SQL_GORM(value: "-")
}
type NoSqlControl {
id: ID!
a: String
b: Int!
}
type User @SQL(order: 2) @SQL_INPUTTYPE_DIRECTIVE(value:" @VALIDATE"){
id: ID! @SQL_PRIMARY @SQL_GORM(value: "autoIncrement")
name: String!
createdAt: Time
updatedAt: Time
deletedAt: SoftDelete
cat: Cat @SQL_GORM(value:"constraint:OnUpdate:CASCADE,OnDelete:SET NULL;")
companyID: Int
money: Float
company: Company
smartPhones: [SmartPhone]
favoritColor: String @SQL_INPUTTYPE_TAGS(value:"validate:\"omitempty,hexcolor|rgb|rgba\"")
email: String! @SQL_INPUTTYPE_TAGS(value:"validate:\"required,email\"")
otherDate: Time
}
type Company @SQL(order: 1){
id: ID! @SQL_PRIMARY @SQL_GORM(value: "autoIncrement")
name: String!
description: String
motherCompanyID: Int
motherCompany: Company
createdAt: Time
}
type Cat @SQL(order: 4){
id: ID! @SQL_PRIMARY @SQL_GORM(value: "autoIncrement")
name: String!
birthDay: Time!
age: Int @SQL_GORM(value:"-")
userID: Int!
alive: Boolean @SQL_GORM(value: "default:true")
}
type SmartPhone @SQL(order: 5){
id: ID! @SQL_PRIMARY @SQL_GORM(value: "autoIncrement")
brand: String!
phonenumber: String!
userID: ID!
}
directive @VALIDATE on INPUT_OBJECT