@@ -105,16 +105,16 @@ end
105
105
---
106
106
--- @treturn table result of the operation
107
107
local function compile_and_execute (state , query , variables , operation_name ,
108
- opts )
108
+ compile_opts )
109
109
assert (type (state ) == ' table' , ' use :compile_and_execute(...) ' ..
110
110
' instead of .compile_and_execute(...)' )
111
111
assert (state .schema ~= nil , ' have not compiled schema' )
112
112
check (query , ' query' , ' string' )
113
113
check (variables , ' variables' , ' table' , ' nil' )
114
114
check (operation_name , ' operation_name' , ' string' , ' nil' )
115
- check (opts , ' opts ' , ' table' , ' nil' )
115
+ check (compile_opts , ' compile_opts ' , ' table' , ' nil' )
116
116
117
- local compiled_query = state :compile (query , opts )
117
+ local compiled_query = state :compile (query , compile_opts )
118
118
return compiled_query :execute (variables , operation_name )
119
119
end
120
120
@@ -170,14 +170,14 @@ local function gql_compile(state, query, opts)
170
170
return gql_query
171
171
end
172
172
173
- local function start_server (gql , host , port )
173
+ local function start_server (gql , host , port , compile_opts )
174
174
assert (type (gql ) == ' table' ,
175
175
' use :start_server(...) instead of .start_server(...)' )
176
176
177
177
check (host , ' host' , ' nil' , ' string' )
178
178
check (port , ' port' , ' nil' , ' number' )
179
179
180
- gql .server = server .init (gql , host , port )
180
+ gql .server = server .init (gql , host , port , compile_opts )
181
181
gql .server :start ()
182
182
183
183
return (' The GraphQL server started at http://%s:%s' ):format (
@@ -231,26 +231,27 @@ local function create_default_accessor(cfg)
231
231
end
232
232
end
233
233
234
- function impl .compile (query )
234
+ function impl .compile (query , opts )
235
235
if default_instance == nil then
236
236
default_instance = impl .new ()
237
237
end
238
- return default_instance :compile (query )
238
+ return default_instance :compile (query , opts )
239
239
end
240
240
241
- function impl .execute (query , variables , operation_name )
241
+ function impl .execute (query , variables , operation_name , compile_opts )
242
242
if default_instance == nil then
243
243
default_instance = impl .new ()
244
244
end
245
- return default_instance :execute (query , variables , operation_name )
245
+ return default_instance :execute (query , variables , operation_name ,
246
+ compile_opts )
246
247
end
247
248
248
- function impl .start_server ()
249
+ function impl .start_server (host , port , compile_opts )
249
250
if default_instance == nil then
250
251
default_instance = impl .new ()
251
252
end
252
253
253
- return default_instance :start_server ()
254
+ return default_instance :start_server (host , port , compile_opts )
254
255
end
255
256
256
257
function impl .stop_server ()
0 commit comments