cache-database 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,16 @@
1
+ from cache_database.table import Table
2
+
3
+ class DataBase:
4
+ store:dict = {}
5
+
6
+ def __init__(self):
7
+ pass
8
+
9
+ def create_table(self,tableName:str,fields:list[str]):
10
+ table = Table()
11
+ table.create(fields)
12
+ self.store[tableName] = table
13
+
14
+
15
+ def use(self,tableName:str) -> Table:
16
+ return self.store[tableName]
@@ -0,0 +1,53 @@
1
+ class Table:
2
+ store:list[dict] =[]
3
+ id_index:int = 0
4
+ arr:list = []
5
+
6
+ def __init__(self):
7
+ pass
8
+
9
+ def create(self,arr:list):
10
+ self.arr = arr
11
+ return self.arr
12
+
13
+ def insert(self,data:dict) -> int:
14
+ self.id_index += 1
15
+ insert_data = {"id":self.id_index}
16
+ for key in self.arr:
17
+ insert_data[key] = data[key]
18
+ self.store.append(insert_data)
19
+ return self.id_index
20
+
21
+ def select(self,id:int) -> dict:
22
+ for i in self.store:
23
+ if i["id"] == id:
24
+ return i
25
+
26
+ def delete(self,id:int) -> bool:
27
+ for i in self.store:
28
+ if i["id"] == id:
29
+ self.store.remove(i)
30
+ return True
31
+ return False
32
+
33
+ def update(self,id:int,data:dict) -> bool:
34
+ for i in self.store:
35
+ if i["id"]==id:
36
+ for key in self.arr:
37
+ i[key]=data[key]
38
+ return True
39
+ return False
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: cache_database
3
+ Version: 0.1.0
4
+ Summary: cache database
5
+ Author-email: moon <lianjiao20@gmail.com>
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown; charset=UTF-8
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+
12
+ hello
@@ -0,0 +1,7 @@
1
+ cache_database/database.py,sha256=PXXdR1tWJg459B30rM7WBYvY0sF0JQ2BFXIZC4UNcnI,346
2
+ cache_database/table.py,sha256=lEZsYogXS38i3qpsYw_3YEkMTFdYoLagkgh99fBh1sM,1000
3
+ cache_database-0.1.0.dist-info/licenses/LICENSE,sha256=Ig9idZC71aPSdnh0b_d4Yk6STp__1X0ce144sdoO1ic,1060
4
+ cache_database-0.1.0.dist-info/METADATA,sha256=WMMuiC2I0GvzECsA8JxfS3q1s1j540arDE468tZoOGs,266
5
+ cache_database-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
6
+ cache_database-0.1.0.dist-info/top_level.txt,sha256=8qyXA78w4HzbsuCBh02BTRnWpLlR39YSSBapRsCbBJ0,15
7
+ cache_database-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 moon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ cache_database