ali_ots 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ali_ots/client.rb +6 -5
- data/lib/ali_ots/connection.rb +1 -1
- data/lib/ali_ots/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37a5d22183cd846cd63e2e6757483bb1b6d1ff3b
|
4
|
+
data.tar.gz: 4bcff8d636cfada5927451a319c1a4661d4e5f73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49d048a417ceab7d76f3fbfe0d8857d334c32db178df7f76f5f58004ba291e0c16a93bf4b2921990e5942bf4d9fd51c584604b0c29986ffb0b39baebcc388e34
|
7
|
+
data.tar.gz: 757e2b791875c3970f1472cf810570d74e5cf529dfbc4f54c47af4a7713665f5a0efaba8547951efdf499753d1608f222fd2c0aa72dd666a854c5e5b4c862dac
|
data/lib/ali_ots/client.rb
CHANGED
@@ -19,7 +19,7 @@ module AliOts
|
|
19
19
|
self.conn.request("CreateTable", request_meta)
|
20
20
|
end
|
21
21
|
|
22
|
-
#
|
22
|
+
# 删除表
|
23
23
|
# example:
|
24
24
|
# client.delete_table("myTable")
|
25
25
|
def delete_table(table_name)
|
@@ -41,7 +41,6 @@ module AliOts
|
|
41
41
|
|
42
42
|
# 更新表
|
43
43
|
# example:
|
44
|
-
# schema_of_primary_keys = [AliOts::Metas::ColumnSchema.new(name: 'id', type: AliOts::Metas::Enums::ColumnType::INTEGER)]
|
45
44
|
#
|
46
45
|
# client.update_table("myTable", 9, 9)
|
47
46
|
def update_table(table_name, capacity_read, capacity_write)
|
@@ -84,7 +83,7 @@ module AliOts
|
|
84
83
|
return status, body, response_status
|
85
84
|
end
|
86
85
|
|
87
|
-
#
|
86
|
+
# 根据给定的主键读取单行数据
|
88
87
|
# example:
|
89
88
|
# primary_keys = [AliOts::Metas::Column.new(name: "id", value: AliOts::Metas::ColumnValue.new(type: AliOts::Metas::Enums::ColumnType::INTEGER, v_int: 1))]
|
90
89
|
# columns = ["user_name", "age"]
|
@@ -98,7 +97,7 @@ module AliOts
|
|
98
97
|
return status, body, response_status
|
99
98
|
end
|
100
99
|
|
101
|
-
#
|
100
|
+
# 更新指定行的数据,如果该行不存在,则新增一行;若该行存在,则根据请求的内容在这一行中新增、修改或者删除指定列的值
|
102
101
|
# example:
|
103
102
|
# condition_type = AliOts::Metas::Enums::RowExistenceExpectation::IGNORE
|
104
103
|
# primary_keys = [AliOts::Metas::Column.new(name: "id", value: AliOts::Metas::ColumnValue.new(type: AliOts::Metas::Enums::ColumnType::INTEGER, v_int: 1))]
|
@@ -154,6 +153,7 @@ module AliOts
|
|
154
153
|
# rows = [row]
|
155
154
|
# table1 = AliOts::Metas::TableInBatchGetRowRequest.new(table_name: "myTable", rows: rows, columns_to_get: ['name', 'age'])
|
156
155
|
# tables = [table1]
|
156
|
+
#
|
157
157
|
# client.batch_get_row(tables)
|
158
158
|
def batch_get_row(tables)
|
159
159
|
request_meta = AliOts::Metas::BatchGetRowRequest.new(tables: tables)
|
@@ -163,7 +163,7 @@ module AliOts
|
|
163
163
|
return status, body, response_status
|
164
164
|
end
|
165
165
|
|
166
|
-
#
|
166
|
+
# 批量插入,修改或删除一个或多个表中的若干行数据
|
167
167
|
# example:
|
168
168
|
# condition = AliOts::Metas::Condition.new(row_existence: AliOts::Metas::Enums::RowExistenceExpectation::EXPECT_NOT_EXIST)
|
169
169
|
# primary_keys = [AliOts::Metas::Column.new(name: "id", value: AliOts::Metas::ColumnValue.new(type: AliOts::Metas::Enums::ColumnType::INTEGER, v_int: 100))]
|
@@ -171,6 +171,7 @@ module AliOts
|
|
171
171
|
# row1 = AliOts::Metas::PutRowInBatchWriteRowRequest.new(condition: condition, primary_key: primary_keys, attribute_columns: columns)
|
172
172
|
# rows = [row1]
|
173
173
|
# tables = [AliOts::Metas::TableInBatchWriteRowRequest.new(table_name: 'myTable', put_rows: rows)]
|
174
|
+
#
|
174
175
|
# client.batch_write_row(tables)
|
175
176
|
def batch_write_row(tables)
|
176
177
|
request_meta = AliOts::Metas::BatchWriteRowRequest.new(tables: tables)
|
data/lib/ali_ots/connection.rb
CHANGED
@@ -18,7 +18,7 @@ module AliOts
|
|
18
18
|
self.logger.info body.to_json
|
19
19
|
|
20
20
|
headers ||= {}
|
21
|
-
url = AliOts::END_POSITION + "/" + action
|
21
|
+
url = AliOts::CONFIG[:END_POSITION] + "/" + action
|
22
22
|
serialize_body = body.serialize_to_string
|
23
23
|
ots_headers = make_headers(url, serialize_body)
|
24
24
|
headers.merge!(ots_headers)
|
data/lib/ali_ots/version.rb
CHANGED