reddb-sdk 3.0.0 → 4.0.0
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.
- package/package.json +1 -1
- package/teste.js +0 -40
package/package.json
CHANGED
package/teste.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// teste.js
|
|
2
|
-
const RedDBClient = require('reddb-sdk'); // npm link ou npm install reddb-sdk
|
|
3
|
-
|
|
4
|
-
const client = new RedDBClient('http://localhost:3000', 'senha_reddb', 'senha_admin', {
|
|
5
|
-
debug: true // mostra logs detalhados
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
(async () => {
|
|
9
|
-
try {
|
|
10
|
-
console.log('--- Teste RedDB SDK ---');
|
|
11
|
-
|
|
12
|
-
// Criar/atualizar uma chave em batata.json
|
|
13
|
-
const setResult = await client.set('batata', 'valor da batata', 'batata.json');
|
|
14
|
-
console.log('SET:', setResult);
|
|
15
|
-
|
|
16
|
-
// Ler a chave
|
|
17
|
-
const getResult = await client.get('batata', 'batata.json');
|
|
18
|
-
console.log('GET:', getResult);
|
|
19
|
-
|
|
20
|
-
// Listar chaves do documento
|
|
21
|
-
const listKeysResult = await client.listKeys('batata.json');
|
|
22
|
-
console.log('LIST KEYS:', listKeysResult);
|
|
23
|
-
|
|
24
|
-
// Deletar a chave
|
|
25
|
-
const deleteResult = await client.delete('batata', 'batata.json');
|
|
26
|
-
console.log('DELETE:', deleteResult);
|
|
27
|
-
|
|
28
|
-
// Criar outro documento sem resetar
|
|
29
|
-
await client.set('minhaChave', 'meuValor', 'meu_doc.json');
|
|
30
|
-
console.log('SET novo documento:', await client.listKeys('meu_doc.json'));
|
|
31
|
-
|
|
32
|
-
// Listar chaves do admin
|
|
33
|
-
const adminKeys = await client.listAdminKeys();
|
|
34
|
-
console.log('ADMIN KEYS:', adminKeys);
|
|
35
|
-
|
|
36
|
-
console.log('--- Teste finalizado ---');
|
|
37
|
-
} catch (err) {
|
|
38
|
-
console.error('Erro no teste RedDB SDK:', err);
|
|
39
|
-
}
|
|
40
|
-
})();
|