Update.
This commit is contained in:
		
							parent
							
								
									69855fa118
								
							
						
					
					
						commit
						e0255b28ec
					
				| @ -74,6 +74,10 @@ class BaseMapper: | ||||
|         for record in await self.run_in_executor(self.db.query,sql, *args): | ||||
|             yield dict(record) | ||||
| 
 | ||||
|     async def update(self, model): | ||||
|         model.updated_at.update() | ||||
|         return await self.run_in_executor(self.table.update, model.record, ["uid"]) | ||||
| 
 | ||||
|     async def delete(self, **kwargs) -> int: | ||||
|         if not kwargs or not isinstance(kwargs, dict): | ||||
|             raise Exception("Can't execute delete with no filter.") | ||||
|  | ||||
| @ -26,6 +26,9 @@ class BaseService: | ||||
|             kwargs["uid"] = uid | ||||
|         return await self.count(**kwargs) > 0 | ||||
| 
 | ||||
|     async def update(self, model): | ||||
|         return await self.mapper.update(model) | ||||
| 
 | ||||
|     async def count(self, **kwargs): | ||||
|         return await self.mapper.count(**kwargs) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user