Ë
    ¨j   ã            
       óì   — U d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ d	ae
d	z  ed
<   de
fd„Zdd„Zdee   fd„Zddededeez  d	z  ded	z  fd„Zddededeez  d	z  dee   fd„Zg d¢Zy	)zIPostgres access: a psycopg3 connection pool and raw SQL (no ORM queries).é    )ÚIterator)Ú
Connection)Údict_row)ÚJsonb)ÚConnectionPoolé   )Úget_settingsNÚ_poolÚreturnc                  ój   — t         €(t        t        «       j                  dddt        id¬«      a t         S )Nr   é   Úrow_factoryT)Úmin_sizeÚmax_sizeÚkwargsÚopen)r
   r   r	   Údatabase_urlr   © ó    ú#/var/www/avy-guidance/api/app/db.pyÚpoolr      s4   € ä€}ÜÜ‹N×'Ñ'ØØØ!¤8Ð,Øô
ˆô €Lr   c                  ó>   — t         �t         j                  «        d a y y ©N)r
   Úcloser   r   r   Ú
close_poolr      s   € äÐÜ�‰ŒØ‰ð r   c               #   ón   K  — t        «       j                  «       5 } | –— ddd«       y# 1 sw Y   yxY w­w)zEFastAPI dependency: one transaction per request (commits on success).N)r   Ú
connection)Úconns    r   Úget_connr   #   s/   è ø€ ä	‹×	Ñ	Ó	ð  ØŠ
÷÷ ñ üs   ‚5›) 	5©2®5r   ÚsqlÚparamsc                 óB   — | j                  ||«      j                  «       S r   )ÚexecuteÚfetchone©r   r    r!   s      r   r$   r$   )   ó   € Ø�<‰<˜˜VÓ$×-Ñ-Ó/Ð/r   c                 óB   — | j                  ||«      j                  «       S r   )r#   Úfetchallr%   s      r   r(   r(   -   r&   r   )r   r   r(   r$   r   r   )r   Nr   )Ú__doc__Úcollections.abcr   Úpsycopgr   Úpsycopg.rowsr   Úpsycopg.types.jsonr   Úpsycopg_poolr   Úsettingsr	   r
   Ú__annotations__r   r   r   ÚstrÚdictÚtupler$   Úlistr(   Ú__all__r   r   r   ú<module>r6      sµ   ðÚ Oå $å Ý !Ý $Ý 'å "à#€€~˜ÑÓ #ð
ˆnó 
óð�(˜:Ñ&ó ñ0�:ð 0 Cð 0°¸±ÀÑ1Dð 0ÐPTÐW[ÑP[ó 0ñ0�:ð 0 Cð 0°¸±ÀÑ1Dð 0ÐPTÐUYÑPZó 0ò N�r   