-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTable.sol
67 lines (54 loc) · 2.48 KB
/
Table.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
contract TableFactory {
function openTable(string memory) public view returns (Table) {} //open table
function createTable(string memory, string memory, string memory) public returns (int256) {} //create table
}
//select condition
contract Condition {
function EQ(string memory, int256) public view{}
function EQ(string memory, string memory) public view{}
function NE(string memory, int256) public view{}
function NE(string memory, string memory) public view{}
function GT(string memory, int256) public view{}
function GE(string memory, int256) public view{}
function LT(string memory, int256) public view{}
function LE(string memory, int256) public view{}
function limit(int256) public view{}
function limit(int256, int256) public view{}
}
//one record
contract Entry {
function getInt(string memory) public view returns (int256) {}
function getUInt(string memory) public view returns (uint256) {}
function getAddress(string memory) public view returns (address) {}
function getBytes64(string memory) public view returns (bytes1[64] memory) {}
function getBytes32(string memory) public view returns (bytes32) {}
function getString(string memory) public view returns (string memory) {}
function set(string memory, int256) public {}
function set(string memory, uint256) public {}
function set(string memory, string memory) public {}
function set(string memory, address) public {}
}
//record sets
contract Entries {
function get(int256) public view returns (Entry) {}
function size() public view returns (int256) {}
}
//Table main contract
contract Table {
function select(string memory, Condition) public view returns (Entries) {}
function insert(string memory, Entry) public returns (int256) {}
function update(string memory, Entry, Condition) public returns (int256) {}
function remove(string memory, Condition) public returns (int256) {}
function newEntry() public view returns (Entry) {}
function newCondition() public view returns (Condition) {}
}
contract KVTableFactory {
function openTable(string memory) public view returns (KVTable) {}
function createTable(string memory, string memory, string memory) public returns (int256) {}
}
//KVTable per permiary key has only one Entry
contract KVTable {
function get(string memory) public view returns (bool, Entry) {}
function set(string memory, Entry) public returns (int256) {}
function newEntry() public view returns (Entry) {}
}