orm-database 0.3.20__tar.gz → 0.3.22__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orm_database
3
- Version: 0.3.20
3
+ Version: 0.3.22
4
4
  Summary: This module is written to launch your programs with any database you want in the shortest time
5
5
  Home-page: https://github.com/sisrsis/orm-database
6
6
  Author: SISRSIS
@@ -253,4 +253,26 @@ output
253
253
  ```
254
254
 
255
255
 
256
+ ## edit delete postgres
257
+ ```python
258
+ from orm_database import PostgreSQL
259
+ import asyncio
260
+
261
+
262
+ postgres = PostgreSQL(host="127.0.0.1",user="postgres",database="wallet",password="123412341234")
263
+
264
+
265
+
266
+
256
267
 
268
+ async def main():
269
+
270
+ await postgres.start()
271
+
272
+
273
+
274
+ await postgres.delete_one("pending_order",{"id":1})
275
+
276
+ await postgres.update_one("pending_order1",{"id":1},{"users":"sis"})
277
+
278
+ ```
@@ -231,4 +231,26 @@ output
231
231
  ```
232
232
 
233
233
 
234
+ ## edit delete postgres
235
+ ```python
236
+ from orm_database import PostgreSQL
237
+ import asyncio
238
+
239
+
240
+ postgres = PostgreSQL(host="127.0.0.1",user="postgres",database="wallet",password="123412341234")
241
+
242
+
243
+
244
+
234
245
 
246
+ async def main():
247
+
248
+ await postgres.start()
249
+
250
+
251
+
252
+ await postgres.delete_one("pending_order",{"id":1})
253
+
254
+ await postgres.update_one("pending_order1",{"id":1},{"users":"sis"})
255
+
256
+ ```
@@ -156,10 +156,29 @@ class PostgreSQL:
156
156
 
157
157
  async def delete_one(self,table:str,filed:dict):
158
158
  query = query_delete_one(table=table,filed=filed)
159
- await self.db.execute(query)
160
-
159
+ try:
160
+ await self.db.execute(query)
161
+ return True
162
+ except:
163
+ return False
164
+
161
165
 
166
+ async def update_one(self,table:str,find:dict,value:dict):
167
+ query = query_update_one(table=table,find=find,value=value)
168
+ try:
169
+ await self.db.execute(query)
170
+ return True
171
+ except:
172
+ return False
173
+
162
174
 
175
+ async def find_list(self,table:str,find:dict):
176
+ query = query_find_list(table=table,find=find)
177
+ data = await self.db.fetch(query)
178
+ result = []
179
+ for a in data:
180
+ result.append(dict(a))
181
+ return result
163
182
 
164
183
  class Mongodb:
165
184
  def __init__(self, url, name):
@@ -112,4 +112,26 @@ def query_delete_one(table:str,filed:dict):
112
112
  key = list(key)
113
113
  key = key[0]
114
114
  query = query + " " + str(key) + "="+ str(filed[key])
115
+ return query
116
+
117
+
118
+
119
+ def query_update_one(table:str,find:dict,value:dict):
120
+ query = f"UPDATE {table} SET"
121
+ key = find.keys()
122
+ key = list(key)
123
+ key = key[0]
124
+ key_v = value.keys()
125
+ key_v = list(key_v)
126
+ key_v = key_v[0]
127
+ query = query+ " " + str(key_v)+ "='" + str(value[key_v]) + "' " +"WHERE" + " " + str(key) + "="+ str(find[key])
128
+ return query
129
+
130
+
131
+
132
+ def query_find_list(table:str,find:dict):
133
+ query = f"SELECT * FROM {table} WHERE"
134
+ key = list(find.keys())
135
+ key = key[0]
136
+ query = f"{query} {key}='{find[key]}'"
115
137
  return query
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: orm_database
3
- Version: 0.3.20
3
+ Version: 0.3.22
4
4
  Summary: This module is written to launch your programs with any database you want in the shortest time
5
5
  Home-page: https://github.com/sisrsis/orm-database
6
6
  Author: SISRSIS
@@ -253,4 +253,26 @@ output
253
253
  ```
254
254
 
255
255
 
256
+ ## edit delete postgres
257
+ ```python
258
+ from orm_database import PostgreSQL
259
+ import asyncio
260
+
261
+
262
+ postgres = PostgreSQL(host="127.0.0.1",user="postgres",database="wallet",password="123412341234")
263
+
264
+
265
+
266
+
256
267
 
268
+ async def main():
269
+
270
+ await postgres.start()
271
+
272
+
273
+
274
+ await postgres.delete_one("pending_order",{"id":1})
275
+
276
+ await postgres.update_one("pending_order1",{"id":1},{"users":"sis"})
277
+
278
+ ```
@@ -6,7 +6,7 @@ long_description = (this_directory / "README.md").read_text()
6
6
 
7
7
  setup(
8
8
  name='orm_database',
9
- version='0.3.20',
9
+ version='0.3.22',
10
10
  description='This module is written to launch your programs with any database you want in the shortest time ',
11
11
  license="MIT",
12
12
  author='SISRSIS',
File without changes
File without changes