implementado typescript 7
This commit is contained in:
parent
cd4ea4d36b
commit
e9a323f18c
80 changed files with 5711 additions and 2455 deletions
22
dist-front/postgres.js
Normal file
22
dist-front/postgres.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* Trata um objeto para ser imput para postgres
|
||||
* @param entrada
|
||||
* @returns
|
||||
*/
|
||||
export const paraObjetoRegistroPg = (entrada) => {
|
||||
try {
|
||||
return Object.fromEntries(Object.entries(entrada).map(([k, v]) => [
|
||||
k,
|
||||
v === undefined || v == null
|
||||
? v
|
||||
: typeof v == "string" || typeof v == "number" || typeof v == "boolean"
|
||||
? v
|
||||
: JSON.stringify(v, null, 2),
|
||||
]));
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`Erro na função paraObjetoRegistroPg: ${error.message} ${error.stack}`);
|
||||
}
|
||||
};
|
||||
export const pgObjeto = paraObjetoRegistroPg;
|
||||
export const objetoPg = paraObjetoRegistroPg;
|
||||
Loading…
Add table
Add a link
Reference in a new issue