mirror of
https://github.com/fluencelabs/fluid
synced 2025-06-17 15:21:20 +00:00
msg => message
This commit is contained in:
@ -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)`
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user