-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
55 lines (41 loc) · 1.04 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const dotenv = require('dotenv');
dotenv.config();
const { sequelize } = require('./models');
const {Op} = require('sequelize');
const Account = require('./models/account');
const create = async () =>{
// 생성 하는 코드
const { Account } = require('./models');
await Account.create({
id: '20191546',
password: 'qwe123',
})
}
const select = async () => {
// select * from accounts;
const accounts = await Account.findAll({});
console.log(accounts);
// select id, p assword from accounts where id = 20191546;
const account = await Account.findOne({
attributes: ['id', 'password'],
where: {
id: '20191546'
}
});
console.log(account.dataValues.password);
}
// main
// sequelize.sync({ force: false })
// .then(() => {
// console.log('데이터베이스 연결 됨');
// create();
// select();
// })
// .catch((error) => {
// console.log(error);
// });
const a = {
a:2,
}
a.a = 5;
console.log(a);