orm-database 0.3.20__tar.gz → 0.3.21__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.21
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,7 +156,21 @@ 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)
159
+ try:
160
+ await self.db.execute(query)
161
+ return True
162
+ except:
163
+ return False
164
+
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
+
160
174
 
161
175
 
162
176
 
@@ -112,4 +112,17 @@ 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])
115
128
  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.21
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.21',
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