You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// in a workerimport{useSQL}from'sqlite-wasm'// needs to load the WASM, hence asyncconstsql=awaituseSQL(/* options */)// initialization/migrationssql`CREATE TABLE IF NOT EXISTS things(id, name)`// return array of array by defaultconst[[currentId]]=sql`SELECT id FROM things ORDER BY name LIMIT 1`// do the binding thing properlyconstfind=(name)=>sql`SELECT id FROM things WHERE name LIKE ${`${name}%`}`// receive queries from main threadself.onmessage=(evt)=>postMessage(find(evt.data.name))
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
the idea is to be able to write code like this
Beta Was this translation helpful? Give feedback.
All reactions