File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -174,3 +174,40 @@ fragment getCreated on userTaskEdge {
174174 wasCreatedByUser
175175}
176176```
177+
178+ You can pass custom args in your connection definition and they will
179+ automaticly be turned into where arguments. These can be further modified
180+ using the ` where ` option in ` sequelizeConnection ` .
181+
182+ ``` js
183+ const userTaskConnection = sequelizeConnection ({
184+ name: ' userTask' ,
185+ nodeType: taskType,
186+ target: User .Tasks ,
187+ where : function (key , value ) {
188+ if (key === ' titleStartsWith' ) {
189+ return { title: { $like: ` ${ value} %` } };
190+ } else {
191+ return {[key]: value};
192+ }
193+ },
194+ });
195+ const userType = new GraphQLObjectType ({
196+ name: User .name ,
197+ fields: {
198+ id: globalIdField (User .name ),
199+ name: {
200+ type: GraphQLString
201+ },
202+ tasks: {
203+ type: userTaskConnection .connectionType ,
204+ args: {
205+ ... userTaskConnection .connectionArgs , // <-- Load the defaults
206+ titleStartsWith: { // <-- Extend further yourself
207+ type: GraphQLString,
208+ }
209+ },
210+ resolve: userTaskConnection .resolve
211+ }
212+ }
213+ });
You can’t perform that action at this time.
0 commit comments