Bladeren bron

ft: 代码调整

master
SisMaker 3 jaren geleden
bovenliggende
commit
8bf50d83d7
5 gewijzigde bestanden met toevoegingen van 216 en 462 verwijderingen
  1. +15
    -16
      src/agApi/agAsyncResultHandling.erl
  2. +0
    -231
      src/agApi/agBulkImportExport.erl
  3. +110
    -0
      src/agApi/agBulkImports.erl
  4. +86
    -206
      src/agApi/agIndexes.erl
  5. +5
    -9
      src/agApi/agViews.erl

+ 15
- 16
src/agApi/agAsyncResultHandling.erl Bestand weergeven

@ -67,8 +67,8 @@
% 400IDx-arango-async-id HTTP标头
% 404404x-arango-async-id HTTP标头
getAsyncJobRet(PoolNameOrSocket, JodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path).
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path).
%
@ -81,8 +81,8 @@ getAsyncJobRet(PoolNameOrSocket, JodId) ->
% 400IDx-arango-async-id HTTP标头
% 404404x-arango-async-id HTTP标头
cancelAsyncJob(PoolNameOrSocket, JodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary, "/cancel">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path).
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary, "/cancel">>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path).
%
% DELETE /_api/job/{type}#by-type
@ -99,12 +99,12 @@ cancelAsyncJob(PoolNameOrSocket, JodId) ->
% 400type或值无效
% 404type为job-idid的异步作业404
delAsyncJobRet(PoolNameOrSocket, TypeOrJodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
Path = <<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
delAsyncJobRet(PoolNameOrSocket, TypeOrJodId, QueryPars) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
Path = <<"/_api/job/", (agMiscUtils:toBinary(TypeOrJodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path, QueryPars).
%
% GET /_api/job/{job-id}
@ -116,8 +116,8 @@ delAsyncJobRet(PoolNameOrSocket, TypeOrJodId, QueryPars) ->
% 204job-id请求的作业仍在待处理
% 404404
getAsyncJobStatus(PoolNameOrSocket, JodId) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
Path = <<"/_api/job/", (agMiscUtils:toBinary(JodId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
% ID
% GET /_api/job/{type}#by-type
@ -130,10 +130,9 @@ getAsyncJobStatus(PoolNameOrSocket, JodId) ->
% 200
% 400type或值无效
getAsyncJobList(PoolNameOrSocket, Type) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
getAsyncJobList(PoolNameOrSocket, Type, Count) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary, "?count=", (agMiscUtils:toBinary(Count))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
getAsyncJobList(PoolNameOrSocket, Type, QueryPars) ->
Path = <<"/_api/job/", (agMiscUtils:toBinary(Type))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path, QueryPars).

+ 0
- 231
src/agApi/agBulkImportExport.erl Bestand weergeven

@ -1,231 +0,0 @@
-module(agBulkImportExport).
-include("eArango.hrl").
-compile(inline).
-compile({inline_size, 128}).
-compile([export_all, nowarn_export_all]).
%% IMY-todo json
% doc_address:https://www.arangodb.com/docs/stable/http/bulk-imports.html
% HTTP接口
% ArangoDB提供了一个HTTP接口
% JSON格式提供
% JSON文档
%
% / _api / import使HTTP POST请求将数据发送到此URLPOST请求的正文中
%
% waitForSync查询参数设置为true
% complete查询参数设置为true使使
% complete具有除true以外的其他值
% details查询参数设置为true使API返回有关无法导入的文档的详细信息details为truedetails属性false或省略
% JSON编码的列表中导入文档
% POST /_api/import#document
%
% collection
% fromPrefix_from属性中值的可选前缀_from输入值之前_from
% toPrefix_to属性中值的可选前缀_to输入值之前_to
% overwrite true或yes
% waitForSync
% onDuplicate
% error
% update使
% replace
% ignore
% _key属性时updatereplace和ignore才起作用
%
% complete true或yes使使
% detailstrue或yesdetails
%
%
% JSON编码的属性值数组组成JSON编码的属性名称数组
% collection-nameJSON编码的属性名称数组JSON编码的属性值数组
%
% JSON对象
% created
% errors
% emptydocuments或只能包含大于零的值auto
% updated/onDuplicate update或replace
% ignored onDuplicate设置为ignore
% detailsdetails设置为truedetails属性
%
%
% 201
% 400type包含无效值collection指定no
% 404collection或导入边的_from或_to属性引用未知集合
% 409complete则返回 true
% 500500
docImport(PoolNameOrSocket, ListOfList, QueryPars) ->
BodyStr = <<<<(jiffy:encode(OneList))/binary, "\n">> || OneList <- ListOfList>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/import">>, QueryPars, ?AgDefHeader, BodyStr).
% JSON导入文档
% POST /_api/import#json
%
% type type可以具有以下值
% documents使JSON编码的文档JSON对象需要用换行符分隔
% list使JSON编码数组
% auto documents或list
% collection
% fromPrefix_from属性中值的可选前缀_from输入值之前_from
% toPrefix_to属性中值的可选前缀_to输入值之前_to
% overwrite true或yes
% waitForSync
% onDuplicate
% error
% update使
% replace
% ignore
% _key属性时updatereplace和ignore才起作用
% complete true或yes使使
% detailstrue或yesdetails
%
% JSON编码的对象数组JSON对象的字符串
% collection-nameJSON表示形式必须作为POST请求的主体传递JSON对象JSON数组
%
% JSON对象
% created
% errors
% emptydocuments或只能包含大于零的值auto
% updated/onDuplicate update或replace
% ignored onDuplicate设置为ignore
% detailsdetails设置为truedetails属性
%
% 201
% 400type包含无效值collection指定no
% 404collection或导入边的_from或_to属性引用未知集合
% 409complete则返回 true
% 500500
jsonImport(PoolNameOrSocket, MapDataList, QueryPars) ->
case QueryPars of
#{type := list} ->
BodyStr = jiffy:encode(MapDataList);
#{type := documents} ->
BodyStr = <<<<(jiffy:encode(OneList))/binary, "\n">> || OneList <- MapDataList>>;
_ ->
BodyStr = MapDataList
end,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/import">>, QueryPars, ?AgDefHeader, BodyStr).
% ------->
% JSON文档
% JSON文档HTTP POST请求的正文中使
%
% { _key key1} { _key key2}
%
% 使documents
%
% JSON数组中的自包含JSON文档
%
%
%
% [
% { "_key": "key1", ... },
% { "_key": "key2", ... },
% ...
% ]
% JSON数据中允许使用任何空格JSON格式的结果数组arangosh中ArangoDB中使ArangoDB解析整个数组
%
% 使array
%
% auto将使服务器自动检测数据是按行的JSON文档=JSON数组=
%
%
%
% curl --data-binary @- -X POST --dump - "http://localhost:8529/_api/import?type=documents&collection=test"
% { "name" : "test", "gender" : "male", "age" : 39 }
% { "type" : "bird", "name" : "robin" }
%
% HTTP/1.1 201 Created
% Server: ArangoDB
% Connection: Keep-Alive
% Content-type: application/json; charset=utf-8
%
% {"error":false,"created":2,"empty":0,"errors":0}
% HTTP 201errors属性中返回该文档0
%
% details参数设置为truedetails
%
% 使HTTP POST请求正文的第一行必须是JSON数组JSON数组
%
% curl --data-binary @- -X POST --dump - "http://localhost:8529/_api/import?collection=test"
% [ "firstName", "lastName", "age", "gender" ]
% [ "Joe", "Public", 42, "male" ]
% [ "Jane", "Doe", 31, "female" ]
%
% HTTP/1.1 201 Created
% Server: ArangoDB
% Connection: Keep-Alive
% Content-type: application/json; charset=utf-8
%
% {"error":false,"created":2,"empty":0,"errors":0}
% HTTP 201errors属性中返回该文档empty属性中返回
%
% details参数设置为truedetails
%
%
% _from和_to属性
% HTTP接口
% HTTP请求中向ArangoDB发送单独的操作
% ArangoDB提供了一个批处理请求API使API批量向ArangoDB发送多个操作/HTTP请求并且各个请求的结果彼此不依赖时
% URL / _api / batch处理程序发出多部分HTTP POST请求来使用ArangoDB的批处理API Content-type为multipart / form-dataArangoDB将使用此边界将批处理请求分解为各个部分ArangoDB将多部分请求分为其各个部分时ArangoDB将生成一个多部分HTTP响应5ArangoDB还将发送包含5个部分的多部分响应
%
% Content-type: application/x-arango-batchpart
% Content-Id Content-IdContent-IdContent-Id的唯一性Content-type和可选Content-Id标头之后Windows换行符\ r \ n \ r \ nHTTP请求Windows换行符
% Content-typeapplication / x-arango-batchpart是MIME部分的标头HTTP请求MIME部分的正文部分
% HTTP方法URL和HTTP协议版本开头HTTP标头\ r \ n \ r \ n HTTP请求
% 3使 XXXsubpartXXX
% *******************************************************************
% HTTP接口
% *******************************************************************
% 使
% POST /_api/export
%
% collection
% JSON对象是必需的
% flushtrueWAL刷新操作WAL复制到集合的数据文件中flushWait秒的额外等待时间使WAL收集器也可以更改调整后的文档元数据以指向数据文件false
% flushWait10flush设置为true时
% count count count count
% batchSize使
% limitlimit属性或将其设置为0将导致不使用任何限制使
% ttl使
% restrict
% type使 include or exclude
% fields
% API相比API生成的内部数据结构更轻便
% /_api/cursorREST API中相似的方式返回文档hasMore属性将设置为 falsehasMore属性将设置为trueid属性将包含游标id
% 退
%
% WAL
% API或设置flush属性之前发出WAL刷新请求 WAL冲洗便WAL复制到集合数据文件
% 使HTTP 201 JSON对象
% JSON对象具有以下属性
% error false
% codeHTTP状态码
% result
% hasMore
% countcount属性的情况下执行的
% idID
% JSON格式不正确或请求中缺少查询规范使HTTP 400
% JSON对象
% errortrue
% codeHTTP状态码
% errorNum
% errorMessage
% 使ttl值来调整此空闲时间
% API
%
% 201
% 400JSON表示格式错误或请求中缺少查询规范
% 404访HTTP 404
% 405使HTTP方法HTTP 405
% 501API使HTTP 501
docExport(PoolNameOrSocket, CollName, MapData) ->
Path = <<"/_api/export?collection=", CollName/binary>>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).

+ 110
- 0
src/agApi/agBulkImports.erl Bestand weergeven

@ -0,0 +1,110 @@
-module(agBulkImports).
-include("eArango.hrl").
-compile(inline).
-compile({inline_size, 128}).
-compile([export_all, nowarn_export_all]).
%% IMY-todo
% doc_address:https://www.arangodb.com/docs/stable/http/bulk-imports.html
% HTTP接口
% ArangoDB提供了一个HTTP接口
% JSON格式提供
% JSON文档
%
% / _api / import使HTTP POST请求将数据发送到此URLPOST请求的正文中
%
% waitForSync查询参数设置为true
% complete查询参数设置为true使使
% complete具有除true以外的其他值
% details查询参数设置为true使API返回有关无法导入的文档的详细信息details为truedetails属性false或省略
% JSON编码的列表中导入文档
% POST /_api/import#document
%
% collection
% fromPrefix_from属性中值的可选前缀_from输入值之前_from
% toPrefix_to属性中值的可选前缀_to输入值之前_to
% overwrite true或yes
% waitForSync
% onDuplicate
% error
% update使
% replace
% ignore
% _key属性时updatereplace和ignore才起作用
%
% complete true或yes使使
% detailstrue或yesdetails
%
%
% JSON编码的属性值数组组成JSON编码的属性名称数组
% collection-nameJSON编码的属性名称数组JSON编码的属性值数组
%
% JSON对象
% created
% errors
% emptydocuments或只能包含大于零的值auto
% updated/onDuplicate update或replace
% ignored onDuplicate设置为ignore
% detailsdetails设置为truedetails属性
%
%
% 201
% 400type包含无效值collection指定no
% 404collection或导入边的_from或_to属性引用未知集合
% 409complete则返回 true
% 500500
docImports(PoolNameOrSocket, ListOfList, QueryPars) ->
BodyStr = <<<<(eVPack:encodeBin(OneList))/binary, "\n">> || OneList <- ListOfList>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/import">>, QueryPars, ?AgDefHeader, BodyStr).
% JSON导入文档
% POST /_api/import#json
%
% type type可以具有以下值
% documents使JSON编码的文档JSON对象需要用换行符分隔
% list使JSON编码数组
% auto documents或list
% collection
% fromPrefix_from属性中值的可选前缀_from输入值之前_from
% toPrefix_to属性中值的可选前缀_to输入值之前_to
% overwrite true或yes
% waitForSync
% onDuplicate
% error
% update使
% replace
% ignore
% _key属性时updatereplace和ignore才起作用
% complete true或yes使使
% detailstrue或yesdetails
%
% JSON编码的对象数组JSON对象的字符串
% collection-nameJSON表示形式必须作为POST请求的主体传递JSON对象JSON数组
%
% JSON对象
% created
% errors
% emptydocuments或只能包含大于零的值auto
% updated/onDuplicate update或replace
% ignored onDuplicate设置为ignore
% detailsdetails设置为truedetails属性
%
% 201
% 400type包含无效值collection指定no
% 404collection或导入边的_from或_to属性引用未知集合
% 409complete则返回 true
% 500500
jsonImports(PoolNameOrSocket, MapDataList, QueryPars) ->
case QueryPars of
#{type := list} ->
BodyStr = eVPack:encodeBin(MapDataList);
#{type := documents} ->
BodyStr = <<<<(eVPack:encodeBin(OneList))/binary, "\n">> || OneList <- MapDataList>>;
_ ->
BodyStr = MapDataList
end,
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/import">>, QueryPars, ?AgDefHeader, BodyStr).

+ 86
- 206
src/agApi/agIndexes.erl Bestand weergeven

@ -7,43 +7,33 @@
% doc_address:https://www.arangodb.com/docs/stable/http/indexes.html
% HTTP接口
%
% ArangoDB HTTP
%
% ArangoDB索引的HTTP接口的一般介绍
%
% 访_key属性 _from和_to属性快速访问文档
%
% _id任何索引类型均不支持在用户定义的索引中使用system属性
% 访_key _from和_to属性提供对文档的快速访问
%
% _id任何索引类型都不支持在用户定义的索引中使用系统属性
%
% /访
%
% _keysystem属性中_key和_id属性的查询
% / 访
%
% _key系统属性中_key和_id属性
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
%
% TTL
% TTL索引可用于自动从集合中删除过期的文档线
% TTL 线
%
% 使libicu提供的单词边界分析来完成单词标记化
% 使 libicu
%
% ArangoDB中的所有索引都有唯一的句柄ArangoDB管理URI下找到
% http://server:port/_api/index/index-handle
% demo / 63563528URL为
% http://localhost:8529/_api/index/demo/63563528
% ArangoDB ArangoDB URI
% http://server:port/_api/index/index-handle
% demo/63563528 URL
% http://localhost:8529/_api/index/demo/63563528
%
% GET /_api/index/{index-id}
@ -57,8 +47,8 @@
% 200HTTP 200
% 404 HTTP 404
getIndexInfo(PoolNameOrSocket, IndexId) ->
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, Path).
%
% POST /_api/index#general
@ -72,10 +62,9 @@ getIndexInfo(PoolNameOrSocket, IndexId) ->
% name属性中指定为字符串
% true将创建唯一索引false或忽略unique属性将创建一个非唯一索引
% 使unique属性可能会导致错误
%
%
%
%
%
%
% sparse属性设置为truenull的文档
%
% hash或skiplist的数组索引支持可选的重复数据删除属性true
@ -86,8 +75,7 @@ getIndexInfo(PoolNameOrSocket, IndexId) ->
% 400使HTTP 400
% 404HTTP 404
newIndex(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, eVPack:encodeBin(MapData)).
%
% DELETE /_api/index/{index-id}
@ -98,8 +86,8 @@ newIndex(PoolNameOrSocket, MapData, QueryPars) ->
% 200HTTP 200
% 404index-id未知HTTP 404
delIndex(PoolNameOrSocket, IndexId) ->
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
Path = <<"/_api/index/", (agMiscUtils:toBinary(IndexId))/binary>>,
agVstCli:callAgency(PoolNameOrSocket, ?AgDelete, Path).
%
% GET /_api/index
@ -109,7 +97,7 @@ delIndex(PoolNameOrSocket, IndexId) ->
%
% 200JSON对象
getIndexList(PoolNameOrSocket, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/index">>, QueryPars).
agVstCli:callAgency(PoolNameOrSocket, ?AgGet, <<"/_api/index">>, QueryPars).
% 使
% /_api/simple/by-example则将使用该索引执行示例查询
@ -134,93 +122,57 @@ getIndexList(PoolNameOrSocket, QueryPars) ->
% 400使HTTP 400
% 404HTTP 404
newIndexOfHash(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, BodyStr).
%
% PUT /_api/simple/by-example
% 使3.4.0使AQL查询取代
% ArangoDB版本3.2.133.3.7API相当昂贵使HTTP Cursor API3.2.143.3.8API的内部实现已更改
% JSON对象是必需的
% collection
% example
% skip
% limit
% batchSize使BATCHSIZE的值 0
%
% HTTP Cursor
%
% 201
% 400JSON表示形式
% 404collection指定的collection未知
%
% PUT /_api/simple/first-example
% 使3.4.0使AQL查询取代
% ArangoDB版本3.2.133.3.7API相当昂贵使HTTP Cursor API3.2.143.3.8API的内部实现已更改
% JSON对象是必需的
% collection
% example
%
% HTTP 404
%
%
% 200
% 400JSON表示形式
% 404collection指定的collection未知
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, eVPack:encodeBin(MapData)).
% 使
% /_api/simple/range其他操作将使用该索引来执行查询
% /_api/simple/range和其他操作将使用该索引来执行查询
%
%
% POST /_api/index#skiplist
%
% collection
% JSON对象是必需的
% type skiplist
% fields
% uniquetrue
% sparsetrue
% deduplicatefalse
% collection-name创建一个跳过列表索引
% fieldnull的文档将从索引中排除
% 使null值
% collection
% JSON
% type : skiplist
% fields
% unique : true
% sparsetrue
% deduplicatefalse
% collection-name创建一个跳过列表索引
% fieldsnull值的文档都将从索引中排除
% 使null值
%
%
%
% 200HTTP 200
% 201 HTTP 201
% 400HTTP 400
% 201 HTTP 201
% 400HTTP 400
% 404HTTP 404
newIndexOfSkipList(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, eVPack:encodeBin(MapData)).
% 使
% /_api/simple/range其他操作将使用该索引执行查询
%
%
%
% POST /_api/index#persistent
%
% collection
% JSON对象是必需的
% type persistent
% fields
% uniquetrue
% sparsetrue
% collection-name创建一个持久索引
% fieldnull的文档将从索引中排除
% 使null值
%
% JSON
% type : persistent
% fields
% unique : true
% sparsetrue
% deduplicatededuplicate由类型persistent hash或skiplist true
% estimatesestimates由持久类型的索引支持 AQL
% collection-name尚不存在
% fieldsnull值的文档都将从索引中排除
% 使null值
%
%
% 200HTTP 200
% 201 HTTP 201
% 400HTTP 400
% 404HTTP 404
%
% 200HTTP 200
% 201 HTTP 201
% 400HTTP 400
% 404HTTP 404
newIndexOfPersistent(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, eVPack:encodeBin(MapData)).
% 使TTL
%
@ -238,9 +190,8 @@ newIndexOfPersistent(PoolNameOrSocket, MapData, QueryPars) ->
% 201 HTTP 201
% 400TTL索引HTTP 400TTL索引
% 404HTTP 404
newIndexOfTtl(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
newIndexOfTtl(PoolNameOrSocket, MapData, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, eVPack:encodeBin(MapData)).
%
% POST /_api/index#geo
@ -249,10 +200,9 @@ newIndexOfTtl(PoolNameOrSocket, MapData, QueryPars) ->
% JSON对象是必需的
% type geo
% fields
% location的数组使location作为坐标的路径在所有文档上创建地理空间索引double值的数组
% latitude和经度的数组使
%
% geoJsongeoJson为truehttp://geojson.org/geojson-spec.html#positions中描述的格式
% location的数组使location作为坐标的路径在所有文档上创建地理空间索引double值的数组
% latitude和经度的数组使
% geoJsongeoJson为truehttp://geojson.org/geojson-spec.html#positions中描述的格式
% collection-name中创建地理空间索引
%
%
@ -260,93 +210,23 @@ newIndexOfTtl(PoolNameOrSocket, MapData, QueryPars) ->
% 200HTTP 200
% 201 HTTP 201
% 404HTTP 404
newIndexOfGeo(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
%
%PUT /_api/simple/near
%使3.4.0使AQL查询取代
%JSON对象是必需的
%collection
%latitude
%
%distance
%skip
%limit100
%geo使
%100
%使Near运算符使geo字段来选择特定的索引
%HTTP Cursor
%ArangoDB 2.6使ArangoDB版本中可能会删除此API使Near运算符从集合中检索文档的首选方法是使用NEAR函数发出AQL查询
%FOR doc IN NEAR(@@collection, @latitude, @longitude, @limit)
%RETURN doc`
%
%201
%400JSON表示形式
%404collection指定的collection未知
%
%
% PUT /_api/simple/within
% 使3.4.0使AQL查询取代
% JSON对象是必需的
% collection
% latitude
%
% radius
% distance
% limit100
% geo使
%
% 使使geo字段来选择特定的索引
% HTTP Cursor
% ArangoDB 2.6使ArangoDB版本中可能会删除此API使Near运算符从集合中检索文档的首选方法是使用WITHIN函数发出AQL查询
% FOR doc IN WITHIN(@@collection, @latitude, @longitude, @radius, @distanceAttributeName)
% RETURN doc
%
% 201
% 400JSON表示形式
% 404collection指定的collection未知
newIndexOfGeo(PoolNameOrSocket, MapData, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, eVPack:encodeBin(MapData)).
%
% /_api/simple/fulltext则将使用该索引执行指定的全文查询
%
% POST /_api/index#fulltext
% POST /_api/index#fulltext
%
% collection
% JSON对象是必需的
% type
% fields
% minLength
% collection-name创建全文索引
%
% 200HTTP 200
% 201 HTTP 201
% 404HTTP 404
newIndexOfFulltext(PoolNameOrSocket, MapData, QueryPars) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>,QueryPars, ?AgDefHeader, BodyStr).
%
%
% PUT /_api/simple/fulltext
% 使3.4.0使AQL查询取代
% JSON对象是必需的
% collection
% attribute
%
% skip
% limit
% index使
%
% 使
% HTTP Cursor
% ArangoDB 2.6使ArangoDB版本中可能会删除此API使Near运算符从集合中检索文档的首选方法是使用FULLTEXT AQL函数发出AQL查询
% FOR doc IN FULLTEXT(@@collection, @attributeName, @queryString, @limit)
% RETURN doc
%
% 201
% 400JSON表示形式
% 404collection指定的collection未知
% collection
% JSON
% type : fulltext
% fields
% minLength
% collection-name尚不存在
%
% 200HTTP 200
% 201 HTTP 201
% 404HTTP 404
newIndexOfFulltext(PoolNameOrSocket, MapData, QueryPars) ->
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/index">>, QueryPars, ?AgDefHeader, eVPack:encodeBin(MapData)).

+ 5
- 9
src/agApi/agViews.erl Bestand weergeven

@ -64,8 +64,7 @@
% 400name或type属性丢失或无效 HTTP 400
% 409name的视图HTTP 409
newView(PoolNameOrSocket, MapData) ->
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/view">>, ?AgDefQuery, ?AgDefHeader, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPost, <<"/_api/view">>, ?AgDefQuery, ?AgDefHeader, eVPack:encodeBin(MapData)).
%
% GET /_api/view/{view-name}
@ -140,8 +139,7 @@ getViewProps(PoolNameOrSocket, ViewName) ->
% 404HTTP 404
changeViewAllProps(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, eVPack:encodeBin(MapData)).
% ArangoSearch视图的属性
% PATCH /_api/view/{view-name}/properties#ArangoSearch
@ -178,8 +176,7 @@ changeViewAllProps(PoolNameOrSocket, ViewName, MapData) ->
% 404HTTP 404
changeViewPartProps(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/properties">>,
BodyStr = eVPack:encodeBin(MapData),
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, ?AgDefQuery, ?AgDefHeader, BodyStr).
agVstCli:callAgency(PoolNameOrSocket, ?AgPatch, Path, ?AgDefQuery, ?AgDefHeader, eVPack:encodeBin(MapData)).
%
% PUT /_api/view/{view-name}/rename
@ -195,10 +192,9 @@ changeViewPartProps(PoolNameOrSocket, ViewName, MapData) ->
%
% 400HTTP 400
% 404HTTP 404
renameView(PoolNameOrSocket, ViewName, NewViewName) ->
renameView(PoolNameOrSocket, ViewName, MapData) ->
Path = <<"/_api/view/", ViewName/binary, "/rename">>,
NameStr = eVPack:encodeBin(NewViewName),
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, [], <<"{\"name\":", NameStr/binary, "}">>).
agVstCli:callAgency(PoolNameOrSocket, ?AgPut, Path, ?AgDefQuery, ?AgDefHeader, eVPack:encodeBin(MapData)).
%
% DELETE /_api/view/{view-name}

Laden…
Annuleren
Opslaan