@@ -1706,14 +1706,9 @@ end
1706
1706
--- The function creates an accessor of desired type with default configuration.
1707
1707
---
1708
1708
--- @tparam table cfg general tarantool_graphql config (contains schemas,
1709
- --- collections, service_fields and indexes)
1710
- --- @tparam string accessor type of desired accessor (space or shard)
1711
- --- @tparam table accessor_funcs set of functions to overwrite accessor
1712
- --- inner functions (`is_collection_exists`, `get_index`, `get_primary_index`,
1713
- --- `unflatten_tuple`, For more detailed description see @{accessor_general.new})
1714
- --- These function allow this abstract data accessor behaves in the certain way.
1715
- --- Note that accessor_space and accessor_shard have their own set of these functions
1716
- --- and accessorFuncs argument (if passed) will be used to overwrite them
1709
+ --- collections, service_fields, indexes and so on)
1710
+ ---
1711
+ --- @treturn table `accessor` created accessor instance
1717
1712
local function create_default_accessor (cfg )
1718
1713
check (cfg .accessor , ' cfg.accessor' , ' string' )
1719
1714
assert (cfg .accessor == ' space' or cfg .accessor == ' shard' ,
@@ -1723,32 +1718,24 @@ local function create_default_accessor(cfg)
1723
1718
check (cfg .collection_use_tomap , ' cfg.collection_use_tomap' , ' table' , ' nil' )
1724
1719
check (cfg .accessor_funcs , ' cfg.accessor_funcs' , ' table' , ' nil' )
1725
1720
1721
+ local accessor_cfg = {
1722
+ schemas = cfg .schemas ,
1723
+ collections = cfg .collections ,
1724
+ service_fields = cfg .service_fields ,
1725
+ indexes = cfg .indexes ,
1726
+ collection_use_tomap = cfg .collection_use_tomap ,
1727
+ resulting_object_cnt_max = cfg .resulting_object_cnt_max ,
1728
+ fetched_object_cnt_max = cfg .fetched_object_cnt_max ,
1729
+ timeout_ms = cfg .timeout_ms ,
1730
+ enable_mutations = cfg .enable_mutations ,
1731
+ }
1732
+
1726
1733
if cfg .accessor == ' space' then
1727
- return accessor_space .new ({
1728
- schemas = cfg .schemas ,
1729
- collections = cfg .collections ,
1730
- service_fields = cfg .service_fields ,
1731
- indexes = cfg .indexes ,
1732
- collection_use_tomap = cfg .collection_use_tomap ,
1733
- resulting_object_cnt_max = cfg .resulting_object_cnt_max ,
1734
- fetched_object_cnt_max = cfg .fetched_object_cnt_max ,
1735
- timeout_ms = cfg .timeout_ms ,
1736
- enable_mutations = cfg .enable_mutations ,
1737
- }, cfg .accessor_funcs )
1734
+ return accessor_space .new (accessor_cfg , cfg .accessor_funcs )
1738
1735
end
1739
1736
1740
1737
if cfg .accessor == ' shard' then
1741
- return accessor_shard .new ({
1742
- schemas = cfg .schemas ,
1743
- collections = cfg .collections ,
1744
- service_fields = cfg .service_fields ,
1745
- indexes = cfg .indexes ,
1746
- collection_use_tomap = cfg .collection_use_tomap ,
1747
- resulting_object_cnt_max = cfg .resulting_object_cnt_max ,
1748
- fetched_object_cnt_max = cfg .fetched_object_cnt_max ,
1749
- timeout_ms = cfg .timeout_ms ,
1750
- enable_mutations = cfg .enable_mutations ,
1751
- }, cfg .accessor_funcs )
1738
+ return accessor_shard .new (accessor_cfg , cfg .accessor_funcs )
1752
1739
end
1753
1740
end
1754
1741
0 commit comments