關於sequelize op模組返回資料的應用

2021-10-09 21:33:44 字數 419 閱讀 9513

const testname = await database.findall(

}})

比如以上例子,

假設

//testname為

[ food,

}]

我將op到的資料放在了testname裡,如果直接利用

console.log(testname.id)

//將會返回undefined

正確操作應該先將資料進行for....of...遍歷

for(const list of testname)
經測試,如果只有乙個資料,返回的內容是一樣的。但要應用其子內容屬性,則必須先遍歷。

以上純屬個人總結。。不知正確與否。

關於datetime模組

獲取當前日期當前時間 now datetime.now 獲得指定日期時間 time datetime 2020,1,20,9,20 轉化為浮點數時間 datetime.now timestamp 浮點數時間轉化為當地時間 datetime.fromtimestamp t 浮點數時間轉化為utc標準時...

關於模組的使用

1 模組的內建函式 在模組進行匯入的時候,使用的是import語句,在import的時候,實際使用的是 import 函式,例如在使用import sys的時候,實際上的呼叫是使用 import sys globals 表示為呼叫者的全域性字典,而locals 表示為區域性命名空間字典 reload...

os模組關於路徑

os模組關於路徑的幾個主要方法 os.path 模組路徑訪問函式 os.path.basename 去掉目錄路徑,返回檔名 os.path.dirname 去掉檔名,返回目錄路徑 os.path.split 將路徑分為 dirname,basename 元組os.path.join 將目錄路徑和檔案...