瀏覽代碼

arangoApi 新增接口封装

erlArango_v1
SisMaker 5 年之前
父節點
當前提交
bb18382764
共有 4 個文件被更改,包括 867 次插入8 次删除
  1. +1
    -0
      README.md
  2. +2
    -2
      src/arangoApi/agCollections.erl
  3. +853
    -6
      src/arangoApi/agGeneralGraphs.erl
  4. +11
    -0
      src/arangoApi/agTraversals.erl

+ 1
- 0
README.md 查看文件

@ -1,5 +1,6 @@
# erlArango
arangodb多模数据库erlang驱动程序
erlang otp21.2+ 基于arangodb3.6.2http文档
## 特点
高效,快速,简单易用。

+ 2
- 2
src/arangoApi/agCollections.erl 查看文件

@ -79,7 +79,7 @@ newColl(PoolNameOrSocket, MapData) ->
newColl(PoolNameOrSocket, MapData, WaitForSyncReplication, ForceReplicationFactor) ->
BodyStr = jiffy:encode(MapData),
Path = <<"/_api/collection?waitForSyncReplication=", (erlang:integer_to_binary(WaitForSyncReplication))/binary, "&forceReplicationFactor=", (erlang:integer_to_binary(ForceReplicationFactor))/binary>>,
Path = <<"/_api/collection?waitForSyncReplication=", (agMiscUtils:toBinary(WaitForSyncReplication))/binary, "&forceReplicationFactor=", (agMiscUtils:toBinary(ForceReplicationFactor))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
%
@ -229,7 +229,7 @@ collChecksum(PoolNameOrSocket, CollName, IsWithRevisions, IsWithData) ->
Path = <<"/_api/collection/", CollName/binary, "/checksum">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined);
_ ->
Path = <<"/_api/collection/", CollName/binary, "/checksum?withRevisions=", (erlang:atom_to_binary(IsWithRevisions, utf8))/binary, "&withData=", (erlang:atom_to_binary(IsWithRevisions, utf8))/binary>>,
Path = <<"/_api/collection/", CollName/binary, "/checksum?withRevisions=", (agMiscUtils:toBinary(IsWithRevisions, utf8))/binary, "&withData=", (erlang:atom_to_binary(IsWithRevisions, utf8))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined)
end.

+ 853
- 6
src/arangoApi/agGeneralGraphs.erl 查看文件

@ -22,7 +22,7 @@
% ReplicationFactor使
% isSmartSmartGraph
% smartGraphAttribute
getGharial(PoolNameOrSocket) ->
getGharialList(PoolNameOrSocket) ->
agHttpCli:callAgency(PoolNameOrSocket, ?Get, <<"/_api/gharial">>, [], undefined).
@ -73,10 +73,857 @@ newGharial(PoolNameOrSocket, MapData) ->
newGharial(PoolNameOrSocket, MapData, WaitForSync) ->
Path =
case WaitForSync of
true ->
<<"/_api/gharial?waitForSync=true">>;
_ ->
<<"/_api/gharial?waitForSync=false">>
end,
true ->
<<"/_api/gharial?waitForSync=true">>;
_ ->
<<"/_api/gharial?waitForSync=false">>
end,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
%
% GET /_api/gharial/{graph}
%
%
% 404
% HTTP 200
% errortruefalse
% code
% graph
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
getGharial(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
%
% DELETE /_api/gharial/{graph}
%
%
%
% dropCollections使
% 使
% 201_graphs集合启用了waitForSync
% 202_graphs集合禁用了waitForSync
% HTTP 403
% Administrate 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
delGharial(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
delGharial(PoolNameOrSocket, GraphName, DropCollections) ->
Path =
case DropCollections of
true ->
<<"/_api/gharial/", GraphName/binary, "?dropCollections=true">>;
_ ->
<<"/_api/gharial/", GraphName/binary, "?dropCollections=false">>
end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
% 使
% GET /_api/gharial/{graph}/vertex
%
%
%
% HTTP 200
% errortruefalse
% code
% collectionsedgeDefinitions和孤儿中包括集合
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
getGharialVertexCollList(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
%
% POST /_api/gharial/{graph}/vertex
%
%
%
% _graphs集合启用waitForSync HTTPHTTP 201
% errortruefalse
% code
% graph
% _graphs集合禁用了waitForSync HTTPHTTP 202
% errortruefalse
% code
% graph
% HTTP 400
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 403
% Administrate 访
% Read Only 访使
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
%% MapData = #{"collection" => "otherVertices"}
addGharialVertexColl(PoolNameOrSocket, GraphName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex">>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
%
% DELETE /_api/gharial/{graph}/vertex/{collection}
%
%
%
%
% dropCollection使
% 使使
% HTTP 200waitForSync为true
% errortruefalse
% code
% graph
% HTTP 202waitForSync为false
% errortruefalse
% code
% graph
% HTTP 400使
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 403
% Administrate 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
delGharialVertexColl(PoolNameOrSocket, GraphName, CollName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
delGharialVertexColl(PoolNameOrSocket, GraphName, CollName, DropCollection) ->
Path =
case DropCollection of
true ->
<<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "?dropCollection=true">>;
_ ->
<<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "?dropCollection=false">>
end,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
%
% GET /_api/gharial/{graph}/edge
%
%
%
% HTTP 200
% errortruefalse
% code
% collectionsedgeDefinitions和孤儿中包括集合
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
getGharialEdgeDefList(PoolNameOrSocket, GraphName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge">>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
%
% POST /_api/gharial/{graph}/edge
%
%
% JSON对象是必需的
% collection使
% from
% to
%
% 使使 v1 v2 e v2 v1 e
% HTTP 201_graphs集合启用了waitForSync
% errortruefalse
% code
% graph
% HTTP 202_graphs集合禁用了waitForSync
% errortruefalse
% code
% graph
% HTTP 400使
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 403
% Administrate 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
addGharialEdgeDef(PoolNameOrSocket, GraphName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge">>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
%
% PUT /_api/gharial/{graph}/edge/{definition}#definition
%
%
% 使
%
% waitForSync
% dropCollections使
% JSON对象是必需的
% collection使
% from
% to
%
% HTTP 201waitForSync为true
% errortruefalse
% code
% graph
% HTTP 202waitForSync为false
% errortruefalse
% code
% graph
% HTTP 400使
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 403
% Administrate 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
replaceGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
%
% DELETE /_api/gharial/{graph}/edge/{definition}#definition
%
%
% 使
%
% waitForSync
% dropCollections使
% 使
% HTTP 201waitForSync为true
% errortruefalse
% code
% graph
% HTTP 202waitForSync为false
% errortruefalse
% code
% graph
% HTTP 403
% Administrate 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
delGharialEdgeDef(PoolNameOrSocket, GraphName, CollName) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
delGharialEdgeDef(PoolNameOrSocket, GraphName, CollName, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
%
% POST /_api/gharial/{graph}/vertex/{collection}
%
%
%
%
% waitForSync
% returnNew
%
% JSON对象
%
% HTTP 201waitForSync为true
% errortruefalse
%
% newArangoDB生成的所有内部属性returnNew为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
%
% newArangoDB生成的所有内部属性returnNew为true时存在
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
newGharialVertex(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
%
% GET /_api/gharial/{graph}/vertex/{collection}/{vertex}
%
%
%
% _key属性
%
% revif-match标头作为替代方法
%
% if-match If-MatchEtagEtag相同HTTP 412rev中提供Etag
% if-none-match If-None-MatchEtagEtag不同时HTTP 304
%
% HTTP 200
% errortruefalse
% code
%
% HTTP 304if-none-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 403
% Read Only 访
% Read Only 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412if-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
getGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, Headers, undefined).
%
% PATCH /_api/gharial/{graph}/vertex/{collection}/{vertex}
%
%
%
% _key属性
%
% waitForSync
% keepNullnull的值truedocumentssnullfalse
% returnOld
% returnNew
%
% if-match If-MatchEtagEtag相同HTTP 412URL的属性rev中提供Etag
%
% JSON对象
%
% HTTP 200waitForSync为true
% errortruefalse
% code
%
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
%
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412if-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
updateGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, Headers, BodyStr).
%
% PUT /_api/gharial/{graph}/vertex/{collection}/{vertex}
%
%
%
% _key属性
%
% waitForSync
% keepNullnull的值
% returnOld
% returnNew
%
% if-match If-MatchEtagEtag相同HTTP 412URL的属性rev中提供Etag
%
% JSON对象
%
% HTTP 200waitForSync为true
% errortruefalse
% code
%
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
%
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412 if -match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
replaceGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, BodyStr).
%
% DELETE /_api/gharial/{graph}/vertex/{collection}/{vertex}
%
%
%
% _key属性
%
% waitForSync
% returnOld
%
% if-match If-MatchEtagEtag相同HTTP 412URL的属性rev中提供Etag
%
% HTTP 200
% errortruefalse
% code
% true
% oldreturnOld为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
% true
% oldreturnOld为true时存在
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412if-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary)>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], undefined).
delGharialVertex(PoolNameOrSocket, GraphName, CollName, VertexKey, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/vertex/", CollName/binary, "/", (agMiscUtils:toBinary(VertexKey) / binary), QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, undefined).
%
% POST /_api/gharial/{graph}/edge/{collection}
%
%
%
%
% waitForSync
% returnNew
% JSON对象是必需的
% _from使
% _to使
% _from和_to值使
% HTTP 201waitForSync为true
% errortruefalse
% code
% edge
% newArangoDB生成的所有内部属性returnNew为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
% edge
% newArangoDB生成的所有内部属性returnNew为true时存在
% HTTP 400_from或_to丢失
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
% _from或_to顶点不存在
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
newGharialEdge(PoolNameOrSocket, GraphName, CollName, MapData, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Post, Path, [], BodyStr).
%
% GET /_api/gharial/{graph}/edge/{collection}/{edge}
%
%
%
% edge_key属性
%
% revif-match标头作为替代方法
%
% if-match If-MatchEtagEtag相同HTTP 412URL的属性rev中提供Etag
% if-none-match If-None-MatchEtagEtag不同时HTTP 304
%
% HTTP 200
% errortruefalse
% code
% edge
% HTTP 304if-none-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 403
% Read Only 访
% Read Only 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412if-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, [], undefined).
getGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Get, Path, Headers, undefined).
%
% PATCH /_api/gharial/{graph}/edge/{collection}/{edge}
%
%
%
% edge_key属性
%
% waitForSync
% keepNullnull的值truedocumentssnullfalse
% returnOld
% returnNew
%
% if-match If-MatchEtagEtag相同HTTP 412URL的属性rev中提供Etag
%
% JSON对象
%
% HTTP 200waitForSync为false
% errortruefalse
% code
% edge
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
% edge
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% _from或_to顶点不存在
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412if-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, [], BodyStr).
updateGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Patch, Path, Headers, BodyStr).
%
% PUT /_api/gharial/{graph}/edge/{collection}/{edge}
%
%
%
% edge_key属性
%
% waitForSync
% keepNullnull的值
% returnOld
% returnNew
%
% if-match If-MatchEtagEtag相同HTTP 412URL的属性rev中提供Etag
% JSON对象是必需的
% _from使
% _to使
%
% HTTP 201waitForSync为true
% errortruefalse
% code
% edge
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
% edge
% newArangoDB生成的所有内部属性returnNew为true时存在
% oldreturnOld为true时存在
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% _from或_to顶点不存在
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412if-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, [], BodyStr).
replaceGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, MapData, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
BodyStr = jiffy:encode(MapData),
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, BodyStr).
%
% DELETE /_api/gharial/{graph}/edge/{collection}/{edge}
%
%
%
% edge_key属性
%
% waitForSync
% returnOld
%
% if-match If-MatchEtagEtag相同HTTP 412URL的属性rev中提供Etag
%
% HTTP 200
% errortruefalse
% code
% true
% oldreturnOld为true时存在
% HTTP 202waitForSync为false
% errortruefalse
% code
% true
% oldreturnOld为true时存在
% HTTP 403
% Read Only 访
% Write 访
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 404
%
%
%
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
% HTTP 412if-match标头
% errortruefalse
% code
% errorNumArangoDB错误号
% errorMessage
delGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey) ->
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Delete, Path, [], undefined).
delGharialEdge(PoolNameOrSocket, GraphName, CollName, EdgeKey, Headers, QueryPars) ->
QueryBinary = agMiscUtils:spellQueryPars(QueryPars),
Path = <<"/_api/gharial/", GraphName/binary, "/edge/", CollName/binary, "/", (agMiscUtils:toBinary(EdgeKey))/binary, QueryBinary/binary>>,
agHttpCli:callAgency(PoolNameOrSocket, ?Put, Path, Headers, undefined).

+ 11
- 0
src/arangoApi/agTraversals.erl 查看文件

@ -0,0 +1,11 @@
-module(agTraversals).
-include("erlArango.hrl").
-compile([export_all, nowarn_export_all]).
% doc_address:https://www.arangodb.com/docs/stable/http/traversal.html
%
%
% POST /_api/traversal
% 使3.4.0AQL图形遍历取代

Loading…
取消
儲存