Browse Source

agAqls.erl改进优化

erlArango_v1
AICells 5 years ago
parent
commit
8e31847e1d
3 changed files with 427 additions and 416 deletions
  1. +0
    -414
      src/agApi/agAqlMod.erl
  2. +426
    -0
      src/agApi/agAqls.erl
  3. +1
    -2
      src/agApi/agSimpleQueries.erl

+ 0
- 414
src/agApi/agAqlMod.erl View File

@ -1,414 +0,0 @@
-module(agAqlMod).
-include("erlArango.hrl").
-compile(inline).
-compile({inline_size, 128}).
-compile([export_all, nowarn_export_all]).
% doc_address:
% AQL Query Cursors:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL Query:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL Query Results Cache:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL User Functions Management:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL操作
% AQL查询游标的HTTP接口
% ArangoDB查询的HTTP接口的简介AQL的结果和简单查询作为游标返回便
% HTTP POST请求将查询详细信息从客户端传送到服务器
% HTTP访问游标
%
%
% POST /_api/cursor
% JSON对象
% JSON对象是必需的
% query
% count count count count
% batchSize使BATCHSIZE的值 0
% ttl使30
% cache使AQL查询结果缓存的标志false
% memoryLimit使0
% bindVars/
% options/
% FULLCOUNTLIMIT子句 FULLCOUNT{ ... , "extra": { "stats": { "fullCount": 123 } } }FULLCOUNT属性将包含的文档数量的结果应用于在查询的最后顶层限制之前MySQL的SQL_CALC_FOUND_ROWS暗示LIMIT优化使LIMIT子句并且在查询中实际使用LIMIT子句时fullCount属性才可能出现在结果中
% maxPlansAQL查询优化器创建的最大计划数
% maxWarningCount10
% failOnWarningtrue时使false时--query.fail-on-warning用于设置failOnWarning的默认值
% streamtruefalse时arangod实例上API进行访问ttl使使MMFiles上的写锁cachecount并且fullCount不适用于流查询false
% Optimizer
% rules-+all-all禁用所有规则
% profiletrue或1Extra Return属性的子属性配置文件中返回其他查询概要信息2Extra Return属性的子属性stats.nodes中包含每个查询计划节点的执行统计信息extra.plan中返回
% satelliteSyncWaitEnterprise Edition参数允许配置DBServer有多长时间将查询中涉及的附属集合同步60.0
% maxRuntime0.0
% maxTransactionSizeRocksDB存储引擎的尊敬
% middleCommitSizeRocksDB存储引擎的尊敬
% middleCommitCountRocksDB存储引擎的尊敬
% skipInaccessibleCollectionsAQL查询访访AQL查询访访
% POST请求的主体中以JSON表示形式传递
% HTTP 201
% errorfalse
% codeHTTP状态码
% result
% hasMore
% countcount属性的情况下执行的
% idID
% extraJSON对象 extra.stats子属性将包含已修改的文档数和由于错误而无法修改的文档数ignoreErrors查询选项
% cached return属性将不包含任何stats子属性
% JSON格式不正确或请求中缺少查询规范HTTP 400
% JSON格式不正确或请求中缺少查询规范使HTTP 400
% JSON对象
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
% 使HTTP 400
%
% 404访HTTP 404
% 405使HTTP方法HTTP 405
newAqlCursor(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/cursor">>, [], BodyStr).
%
% PUT /_api/cursor/{cursor-identifier}
%
% cursor-identifier
%
% id
%
% hasMorefalse
% count
% 使hasMore返回truehasMore为falsehasMore属性的值为 false
%
% 200HTTP 200
% 400使HTTP 404
% 404使HTTP 404
nextAqlCursor(PoolNameOrSocket, CursorId) ->
Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
%
% DELETE /_api/cursor/{cursor-identifier}
%
% cursor-identifierID
%
% 使HTTP DELETE请求在任何较早的时间显式销毁游标ID必须作为URL的一部分包含在内
%
%
% 202
% 404404使
delAqlCursor(PoolNameOrSocket, CursorId) ->
Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL查询的HTTP接口
%
%
% ArangoDB有一个HTTP接口AQL查询HTTP接口来检索任何有效AQL查询的执行计划
% AQL查询
% AQL查询
% AQL查询并返回有关它的信息
% POST /_api/explain
% JSON对象
% JSON对象是必需的
% querybindVars中传递options属性中传递查询的其他选项
% bindVars/
% options
% allPlanstruefalse
% maxNumberOfPlans
% Optimizer
% rules-+all-all禁用所有规则
% AQL查询HTTP POST请求将查询字符串发送到服务器
%
% allPlans选项
% warningsstats属性以及一些优化程序统计信息allPlans设置为false 使allPlans
% JSON对象
%
%
% collections使collections
% rules
% variables使
%
% 200使HTTP 200plan属性中返回最佳执行计划allPlansallPlans属性中返回一系列计划
% 400HTTP 400JSON对象中的错误详细信息HTTP 400
% 404访HTTP 404
explainAqlQuery(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/explain">>, [], BodyStr).
% AQL查询并返回有关它的信息
% POST /_api/query
% JSON对象是必需的
% queryHTTP POST请求将查询字符串传递到服务器
% /api/cursor
%
% 200使HTTP 200bindVars属性中返回在查询中找到的绑定参数的名称collections属性中返回查询中使用的collections的数组JSON ast属性将包含查询的抽象语法树表示形式ast的格式在将来的ArangoDB版本中可能会发生变化ArangoDB如何解释给定查询
% 400HTTP 400JSON对象中的错误详细信息
parseAqlQuery(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/query">>, [], BodyStr).
%
% ArangoDB具有HTTP接口AQL查询列表和慢速AQL查询列表使APIHTTP请求的数据库中启用查询跟踪
% AQL查询跟踪的配置
% GET /_api/query/properties
% JSON对象
% enabledtrue false
% trackSlowQueriestrueslowQueryThreshold中设置的值 enabled属性设置为true
% trackBindVarstrue使
% maxSlowQueries
% slowQueryThresholdslowQueryThreshold的值以秒为单位指定
% maxQueryStringLength使使
%
% 200
% 400HTTP 400
getAqlQueryProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/query/properties">>, [], undefined).
% AQL查询跟踪的配置
% PUT /_api/query/properties
% JSON对象是必需的
% enabledtrue false
% trackSlowQueriestrueslowQueryThreshold中设置的值 enabled属性设置为true
% trackBindVarstrue使
% maxSlowQueries
% slowQueryThresholdslowQueryThreshold的值以秒为单位指定
% maxQueryStringLength使使
% HTTP请求主体的属性属性中传递JSON对象
% HTTP响应中返回当前属性集
%
% 200
% 400HTTP 400
changeAqlQueryProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/query/properties">>, [], BodyStr).
% AQL查询的列表
% GET /_api/query/current
% AQL查询JSON对象
% idID
% query
% bindVars使
%
% runTime
% state
% stream使
%
% 200
% 400HTTP 400
getAqlQueryCurrent(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/current">>, [], undefined).
% AQL查询的列表
% GET /_api/query/slow
% AQL查询maxSlowQueries slowQueryThreshold
% JSON对象
% idID
% query
% bindVars使
%
% runTime
% state
% stream使
%
% 200
% 400HTTP 400
getAqlQuerySlow(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/slow">>, [], undefined).
% AQL查询列表
% DELETE /_api/query/slow
% AQL查询列表
%
% 200HTTP 200
% 400使HTTP 400
delAqlQuerySlow(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/query/slow">>, [], undefined).
% AQL查询
% DELETE /_api/query/{query-id}
%
% query-idID
%
%
% 200HTTP 200
% 400使HTTP 400
% 404ID的查询时HTTP 404
killAqlQuery(PoolNameOrSocket, QueryId) ->
Path = <<"/_api/query/", (agMiscUtils:toBinary(QueryId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL查询结果缓存的HTTP接口
% AQL查询结果缓存的API方法
% AQL查询结果缓存中存储结果的列表
% GET /_api/query-cache/entries
% AQL查询结果JSON对象
% hash
% query
% bindVars
% size
% /
%
% hits访 0
% runTime
% dataSources使/
%
% 200
% 400HTTP 400
getAqlQueryCaches(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/entries">>, [], undefined).
% AQL查询结果缓存
% DELETE /_api/query-cache
%
%
% 200HTTP 200
% 400使HTTP 400
clearAqlQueryCaches(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/query-cache">>, [], undefined).
% AQL查询结果缓存的全局配置
% GET /_api/query-cache/properties
% AQL查询结果缓存配置JSON对象
% modeAQL查询结果缓存运行的模式offon或demand
% maxResults
% maxResultsSize
% maxEntrySize
% includeSystem
%
% 200
% 400HTTP 400
getAqlQueryCacheProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/properties">>, [], undefined).
% AQL查询结果缓存的配置
% PUT /_api/query-cache/properties
% JSON对象是必需的
% modeAQL查询缓存应以哪种模式运行offon或demand
% maxResults
% maxResultsSize
% maxEntrySize
% includeSystem
% HTTP响应中返回当前属性集
% 使AQL查询缓存的全局属性HTTP请求主体的属性属性中传递JSON对象
%
% 200
% 400HTTP 400
changeAqlQueryCacheProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/properties">>, [], BodyStr).
% AQL用户功能管理的HTTP接口
% AQL用户功能管理
% AQL用户功能的ArangoDB HTTP接口的简介AQL用户功能是一种使用用户定义的JavaScript代码扩展ArangoDB查询语言AQL
%AQL用户功能及其含义的概述 AQL
%HTTP接口提供用于添加AQL用户功能的API
%_aqlfunctions中访访
% AQL用户功能
% AQL用户功能
% POST /_api/aqlfunction
% JSON对象是必需的
% name
% code
% isDeterministicisDeterministic属性是当前未使用但对于优化可以在以后使用
%
% HTTP 200
% HTTP 400
% HTTP 200使HTTP 200
% errorfalse
% codeHTTP状态码
% isNewlyCreatedfalse
% HTTP 201使HTTP 201
% errorfalse
% codeHTTP状态码
% isNewlyCreatedtrue
% HTTP 400JSON格式不正确或请求中缺少必需数据使HTTP 400
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
newAqlUserFun(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/aqlfunction">>, [], BodyStr).
% AQL用户功能
% DELETE /_api/aqlfunction/{name}
%
% AQL用户功能的名称
%
% - 0
% HTTP 404
% name标识的现有AQL用户功能或功能组
% HTTP 200使HTTP 200
% errorfalse
% codeHTTP状态码
% DeleteCount1group设置为false时true>= 0group
% HTTP 400使HTTP 400
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
% HTTP 404使HTTP 404
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
delAqlUserFun(PoolNameOrSocket, UserFunName) ->
Path = <<"/_api/aqlfunction/", (agMiscUtils:toBinary(UserFunName))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL用户功能
% GET /_api/aqlfunction
%
% namespaceresult下的命名空间namespace返回所有已注册的AQL用户函数
% AQL用户功能
% JSON数组result下找到的所有用户函数
% HTTP 200HTTP 200
% errorfalse
% codeHTTP状态码
%
% name
% code
% isDeterministicisDeterministic属性是当前未使用但对于优化可以在以后使用
% HTTP 400使HTTP 400
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
getAqlUserFuns(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/aqlfunction">>, [], undefined).
getAqlUserFuns(PoolNameOrSocket, Namespace) ->
Path = <<"/_api/aqlfunction?namespace=", (agMiscUtils:toBinary(Namespace))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).

+ 426
- 0
src/agApi/agAqls.erl View File

@ -0,0 +1,426 @@
-module(agAqls).
-include("erlArango.hrl").
-compile(inline).
-compile({inline_size, 128}).
-compile([export_all, nowarn_export_all]).
% doc_address:
% AQL Query Cursors:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL Query:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL Query Results Cache:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL User Functions Management:
% https://www.arangodb.com/docs/stable/http/aql-query-cursor.html
% AQL操作
% AQL查询游标的HTTP接口
% ArangoDB查询的HTTP接口的简介AQL的结果和简单查询作为游标返回便
% HTTP POST请求将查询详细信息从客户端传送到服务器
%
%
%
%
% 使
%
% batchSize属性来控制此数字
% hasMore属性来检查是否已检索到完整的结果集false
% 使
% batchSize属性设置的数量id属性中 hasMore属性将设置为true
% HTTP访问游标
%
%
% POST /_api/cursor
% JSON对象
% JSON对象是必需的
% query
% count count count count
% batchSize使BATCHSIZE的值 0
% ttl使30
% cache使AQL查询结果缓存的标志false
% memoryLimit使0
% bindVars/
% options/
% FULLCOUNTLIMIT子句 FULLCOUNT{ ... , "extra": { "stats": { "fullCount": 123 } } }FULLCOUNT属性将包含的文档数量的结果应用于在查询的最后顶层限制之前MySQL的SQL_CALC_FOUND_ROWS暗示LIMIT优化使LIMIT子句并且在查询中实际使用LIMIT子句时fullCount属性才可能出现在结果中
% maxPlansAQL查询优化器创建的最大计划数
% maxWarningCount10
% failOnWarningtrue时使false时--query.fail-on-warning用于设置failOnWarning的默认值
% streamtruefalse时arangod实例上API进行访问ttl使使MMFiles上的写锁cachecount并且fullCount不适用于流查询false
% Optimizer
% rules-+all-all禁用所有规则
% profiletrue或1Extra Return属性的子属性配置文件中返回其他查询概要信息2Extra Return属性的子属性stats.nodes中包含每个查询计划节点的执行统计信息extra.plan中返回
% satelliteSyncWaitEnterprise Edition参数允许配置DB-Server将有多长时间使查询中涉及的Satellite集合同步60.0
% maxRuntime0.0
% maxTransactionSizeRocksDB存储引擎的尊敬
% middleCommitSizeRocksDB存储引擎的尊敬
% middleCommitCountRocksDB存储引擎的尊敬
% skipInaccessibleCollectionsAQL查询访访AQL查询访访
%
% POST请求的主体中以JSON表示形式传递
% HTTP 201
% errorfalse
% codeHTTP状态码
% result
% hasMore
% countcount属性的情况下执行的
% idID
% extraJSON对象 extra.stats子属性将包含已修改的文档数和由于错误而无法修改的文档数ignoreErrors查询选项
% cached return属性将不包含任何stats子属性
%
% JSON格式不正确或请求中缺少查询规范HTTP 400
% JSON格式不正确或请求中缺少查询规范使HTTP 400
% JSON对象
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
% 使HTTP 400
%
% 404访HTTP 404
% 405使HTTP方法HTTP 405
newCursor(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/cursor">>, [], BodyStr).
%
% PUT /_api/cursor/{cursor-identifier}
%
% cursor-identifier
%
% id
%
% hasMorefalse
% count
% 使hasMore返回truehasMore为falsehasMore属性的值为 false
%
% 200HTTP 200
% 400使HTTP 404
% 404使HTTP 404
nextCursor(PoolNameOrSocket, CursorId) ->
Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], undefined).
%
% DELETE /_api/cursor/{cursor-identifier}
%
% cursor-identifierID
%
% 使HTTP DELETE请求在任何较早的时间显式销毁游标ID必须作为URL的一部分包含在内
%
%
% 202
% 404404使
delCursor(PoolNameOrSocket, CursorId) ->
Path = <<"/_api/cursor/", (agMiscUtils:toBinary(CursorId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL查询的HTTP接口
%
%
% ArangoDB有一个HTTP接口AQL查询HTTP接口来检索任何有效AQL查询的执行计划
% AQL查询
% AQL查询并返回有关它的信息
% POST /_api/explain
% JSON对象
% JSON对象是必需的
% querybindVars中传递options属性中传递查询的其他选项
% bindVars/
% options
% allPlanstruefalse
% maxNumberOfPlans
% Optimizer
% rules-+all-all禁用所有规则
%
% AQL查询HTTP POST请求将查询字符串发送到服务器
%
% allPlans选项
% warningsstats属性以及一些优化程序统计信息allPlans设置为false 使allPlans
% JSON对象
% nodes
% estimatedCost
% collections使collections
% rules
% variables使
%
% 200使HTTP 200plan属性中返回最佳执行计划allPlansallPlans属性中返回一系列计划
% 400HTTP 400JSON对象中的错误详细信息HTTP 400
% 404访HTTP 404
explainQuery(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/explain">>, [], BodyStr).
% AQL查询并返回有关它的信息
% POST /_api/query
% JSON对象是必需的
% queryHTTP POST请求将查询字符串传递到服务器
% /api/cursor
%
% 200使HTTP 200bindVars属性中返回在查询中找到的绑定参数的名称collections属性中返回查询中使用的collections的数组JSON ast属性将包含查询的抽象语法树表示形式ast的格式在将来的ArangoDB版本中可能会发生变化ArangoDB如何解释给定查询
% 400HTTP 400JSON对象中的错误详细信息
parseQuery(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/query">>, [], BodyStr).
%
% ArangoDB具有HTTP接口AQL查询列表和慢速AQL查询列表使APIHTTP请求的数据库中启用查询跟踪
% AQL查询跟踪的配置
% GET /_api/query/properties
% JSON对象
% enabledtrue false
% trackSlowQueriestrueslowQueryThreshold中设置的值 enabled属性设置为true
% trackBindVarstrue使
% maxSlowQueries
% slowQueryThresholdslowQueryThreshold的值以秒为单位指定
% maxQueryStringLength使使
%
% 200
% 400HTTP 400
getQueryProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/properties">>, [], undefined).
% AQL查询跟踪的配置
% PUT /_api/query/properties
% JSON对象是必需的
% enabledtrue false
% trackSlowQueriestrueslowQueryThreshold中设置的值 enabled属性设置为true
% trackBindVarstrue使
% maxSlowQueries
% slowQueryThresholdslowQueryThreshold的值以秒为单位指定
% maxQueryStringLength使使
% HTTP请求主体的属性属性中传递JSON对象
% HTTP响应中返回当前属性集
%
% 200
% 400HTTP 400
changeQueryProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/query/properties">>, [], BodyStr).
% AQL查询的列表
% GET /_api/query/current
% AQL查询JSON对象
% idID
% query
% bindVars使
% started
% runTime
% state
% stream使
%
% 200
% 400HTTP 400
currentQuery(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/current">>, [], undefined).
% AQL查询的列表
% GET /_api/query/slow
% AQL查询maxSlowQueries slowQueryThreshold
% JSON对象
% idID
% query
% bindVars使
% started
% runTime
% state
% stream使
%
% 200
% 400HTTP 400
getSlowQuery(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query/slow">>, [], undefined).
% AQL查询列表
% DELETE /_api/query/slow
% AQL查询列表
%
% 200HTTP 200
% 400使HTTP 400
delSlowQuery(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/query/slow">>, [], undefined).
%
% AQL查询也可以在服务器上终止ArangoDB通过HTTP接口提供了终止功能IDIDkill标志
% AQL查询
% DELETE /_api/query/{query-id}
%
% query-idID
%
%
% 200HTTP 200
% 400使HTTP 400
% 404ID的查询时HTTP 404
killQuery(PoolNameOrSocket, QueryId) ->
Path = <<"/_api/query/", (agMiscUtils:toBinary(QueryId))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL查询结果缓存的HTTP接口
% AQL查询结果缓存的API方法
% AQL查询结果缓存中存储结果的列表
% GET /_api/query-cache/entries
% AQL查询结果JSON对象
% hash
% query
% bindVars
% size
% results/
% started
% hits访 0
% runTime
% dataSources使/
%
% 200
% 400HTTP 400
getQueryCaches(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/entries">>, [], undefined).
% AQL查询结果缓存中的所有结果
% DELETE /_api/query-cache
%
%
% 200HTTP 200
% 400使HTTP 400
clearQueryCaches(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, <<"/_api/query-cache">>, [], undefined).
% AQL查询结果缓存的全局配置
% GET /_api/query-cache/properties
% AQL查询结果缓存配置JSON对象
% modeAQL查询结果缓存运行的模式offon或demand
% maxResults
% maxResultsSize
% maxEntrySize
% includeSystem
%
% 200
% 400HTTP 400
getQCacheProperties(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/query-cache/properties">>, [], undefined).
% AQL查询结果缓存属性
% PUT /_api/query-cache/properties
% JSON对象是必需的
% modeAQL查询缓存应以哪种模式运行offon或demand
% maxResults
% maxResultsSize
% maxEntrySize
% includeSystem
% HTTP响应中返回当前属性集
% 使AQL查询缓存的全局属性HTTP请求主体的属性属性中传递JSON对象
%
% 200
% 400HTTP 400
changeQCacheProperties(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPut, <<"/_api/query-cache/properties">>, [], BodyStr).
% AQL用户功能管理固定链接
% AQL用户功能的ArangoDB HTTP接口的简介AQL用户功能是一种使用用户定义的JavaScript代码扩展ArangoDB查询语言AQL
% AQL用户功能及其含义的概述 AQL
% HTTP接口提供用于添加AQL用户功能的API
% _aqlfunctions中访访
% AQL用户功能
% POST /_api/aqlfunction
% JSON对象是必需的
% name
% code
% isDeterministicisDeterministic属性是当前未使用但对于优化可以在以后使用
% HTTP 200HTTP 400
% HTTP 200使HTTP 200
% errorfalse
% codeHTTP状态码
% isNewlyCreatedfalse
% HTTP 201使HTTP 201
% errorfalse
% codeHTTP状态码
% isNewlyCreatedtrue
% HTTP 400JSON格式不正确或请求中缺少必需数据使HTTP 400
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
newUserFun(PoolNameOrSocket, MapData) ->
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/aqlfunction">>, [], BodyStr).
% AQL用户功能
% DELETE /_api/aqlfunction/{name}
%
% nameAQL用户功能的名称
%
% group - 0
% falseHTTP 404
% name标识的现有AQL用户功能或功能组
% HTTP 200使HTTP 200
% errorfalse
% codeHTTP状态码
% DeleteCount1group设置为false时true>= 0group
% HTTP 400使HTTP 400
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
% HTTP 404使HTTP 404
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
delUserFun(PoolNameOrSocket, UserFunName) ->
Path = <<"/_api/aqlfunction/", (agMiscUtils:toBinary(UserFunName))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
delUserFun(PoolNameOrSocket, UserFunName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/aqlfunction/", (agMiscUtils:toBinary(UserFunName))/binary, QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, [], undefined).
% AQL用户功能
% GET /_api/aqlfunction
%
% namespaceresult下的命名空间namespace返回所有已注册的AQL用户函数
% AQL用户功能
% JSON数组result下找到的所有用户函数
% HTTP 200HTTP 200
% errorfalse
% codeHTTP状态码
% result
% name
% code
% isDeterministicisDeterministic属性是当前未使用但对于优化可以在以后使用
% HTTP 400使HTTP 400
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
getUserFuns(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/aqlfunction">>, [], undefined).
getUserFuns(PoolNameOrSocket, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/aqlfunction", QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?AgGet, Path, [], undefined).

+ 1
- 2
src/agApi/agSimpleQueries.erl View File

@ -7,5 +7,4 @@
% doc_address:https://www.arangodb.com/docs/stable/http/simple-query.html % doc_address:https://www.arangodb.com/docs/stable/http/simple-query.html
% 3.4.0使API使AQL查询取代
% 3.4.0使API使AQL查询取代

Loading…
Cancel
Save