This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('devbox-linq'); | |
var listaNumeros = [1, 6, 2, 5, 9, 6]; | |
var listaNumerosMaioresQueCinco = listaNumeros.Where(x => x > 5); | |
var listaOrdenada = listaNumeros.OrderBy(x => x).ToList(); | |
var listaOrdenadaDecrescente = listaNumeros.OrderByDesc(x => x).ToList(); | |
var soma = listaNumeros.Sum(x => x); | |
var distinct = listaNumeros.Distinct(x => x); | |
var possuiAlgumNumeroCinco = listaNumeros.Any(x => x == 5); | |
var todosOsNumerosSaoCinco = listaNumeros.All(x => x == 5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let config = { | |
user: 'username', | |
database: 'database', | |
password: 'pass', | |
host: 'host', | |
port: 5432, | |
max: 10, | |
idleTimeoutMillis: 30000 | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION autenticacao.BuscarUsuario(pNome varchar(50), pNomeDaMae varchar(50)) | |
RETURNS TABLE( | |
"id" integer, | |
"nome" varchar(50), | |
"nomeDaMae" varchar(50) | |
) AS $$ | |
BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pg.request() | |
.input('Rafael') //pNome | |
.input('Magally') //pNomeDaMae | |
.execute('autenticacao.BuscarUsuario', (err, data) => { | |
if (err) | |
return console.log(err); | |
console.log(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pg.request() | |
.input('pNome','Douglas') | |
.input('pNomeDaMae','Marina') | |
.execute('autenticacao.BuscarUsuario', (err, data) => { | |
if (err) | |
return console.log(err); | |
console.log(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let parameters = { | |
pNome: 'Maria', | |
pNomeDaMae: 'Mãe da Maria' | |
}; | |
pg.request() | |
.input(parameters) | |
.execute('autenticacao.BuscarUsuario', (err, data) => { | |
if (err) | |
return console.log(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let parameters = { | |
nome: 'Mateus', | |
nomeDaMae: 'Neide' | |
}; | |
pg.request() | |
.input(parameters, 'p') | |
.execute('autenticacao.BuscarUsuario', (err, data) => { | |
if (err) | |
return console.log(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pg.request() | |
.inputMany('Jorge' /*pNome*/, 'Maria das Dores' /*pNomeDaMae*/) | |
.execute('autenticacao.BuscarUsuario', (err, data) => { | |
if (err) | |
return console.log(err); | |
console.log(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let config = { | |
user: 'username', | |
password: 'senha', | |
server: 'servidor', | |
database: 'database', | |
options: { | |
encrypt: true //Caso esteja utilizando o SQL no Azure, utilize este parâmetro :) | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE BuscarUsuario | |
@Nome varchar(50), | |
@NomeDaMae varchar(50) | |
AS | |
BEGIN | |
SELECT u.Id, | |
u.Nome, |