mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	first experiments with note entity
This commit is contained in:
		| @@ -6,6 +6,7 @@ const fs = require('fs'); | ||||
| const sqlite = require('sqlite'); | ||||
| const app_info = require('./app_info'); | ||||
| const resource_dir = require('./resource_dir'); | ||||
| const Note = require('../entities/note'); | ||||
|  | ||||
| async function createConnection() { | ||||
|     return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise}); | ||||
| @@ -133,6 +134,12 @@ async function getAll(query, params = []) { | ||||
|     return await wrap(async db => db.all(query, ...params)); | ||||
| } | ||||
|  | ||||
| async function getAllEntities(query, params = []) { | ||||
|     const rows = await getAll(query, params); | ||||
|  | ||||
|     return rows.map(row => new Note(module.exports, row)); | ||||
| } | ||||
|  | ||||
| async function getMap(query, params = []) { | ||||
|     const map = {}; | ||||
|     const results = await getAll(query, params); | ||||
| @@ -266,6 +273,7 @@ module.exports = { | ||||
|     getFirst, | ||||
|     getFirstOrNull, | ||||
|     getAll, | ||||
|     getAllEntities, | ||||
|     getMap, | ||||
|     getFirstColumn, | ||||
|     execute, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user