Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Commit 2b972dd

Browse files
committed
Make shard module optional
1 parent 5dbe514 commit 2b972dd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

graphql/accessor_shard.lua

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
--- `accessor_shard.new` function to create a new shard data accessor instance.
44

55
local json = require('json')
6-
local shard = require('shard')
6+
local utils = require('graphql.utils')
7+
local shard = utils.optional_require('shard')
78
local accessor_general = require('graphql.accessor_general')
89

910
local accessor_shard = {}
@@ -118,6 +119,8 @@ function accessor_shard.new(opts, funcs)
118119
local funcs = funcs or {}
119120
assert(type(funcs) == 'table',
120121
'funcs must be nil or a table, got ' .. type(funcs))
122+
assert(shard ~= nil,
123+
'tarantool/shard module is needed to working with accessor_shard')
121124

122125
for k, v in pairs(funcs) do
123126
assert(type(k) == 'string',

0 commit comments

Comments
 (0)