msg => message

This commit is contained in:
folex
2019-08-16 19:47:38 +03:00
parent 0fafa8661b
commit 8ca166aaf8
16 changed files with 64 additions and 68 deletions

View File

@ -4,7 +4,7 @@ import {query} from "../node_modules/db-connector/assembly/sqlite"
// main handler for an application
export function handler(username: string): string {
// Create table for messages storage
query(`CREATE TABLE messages(msg text, username text)`);
query(`CREATE TABLE messages(message text, username text)`);
// Insert message 'Hello, username!' using `username` as author's username
query(`INSERT INTO messages VALUES("Hello, username!","` + username + `")`);
@ -16,7 +16,7 @@ export function handler(username: string): string {
// Get all messages as JSON via SQLite's JSON extension
return query(
`SELECT json_group_array(
json_object('msg', msg, 'username', username)
json_object('message', message, 'username', username)
) AS json_result FROM (SELECT * FROM messages)`
)
}