简体   繁体   中英

Is there a way to use massivejs and use dynamic variable for table name to create table and select table?

I have setup a postgreSQL access through a node server using express and massive, but I cannot find a way to build new tables with dynamic table names or select a table dynamically using massive. Any direction would be most appreciated!

  1. You can create dynamic SQL through script files. Massive does exactly what you're intending internally when you create document tables .

  2. Tables (and other database objects) are properties on the db object so you can use bracket accessor syntax with a variable, viz. await db[thisOrThatTableName].find(...) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM