diff options
author | Michael McVady <femtonaut@gmail.com> | 2023-10-29 16:45:51 -0500 |
---|---|---|
committer | Michael McVady <femtonaut@gmail.com> | 2023-10-29 17:55:59 -0500 |
commit | 2e3ceb247fa63db0bbf9ba71f06be50eeda74445 (patch) | |
tree | f4df7ea41ba427b76ad173c032347877fd9beb90 /src/queries.h | |
parent | 350ed67cc50c562459aaa34f7b6eefc389bec370 (diff) |
Refactor: `post` -> `entry`
Diffstat (limited to 'src/queries.h')
-rw-r--r-- | src/queries.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/queries.h b/src/queries.h index ffc9c7b..986f180 100644 --- a/src/queries.h +++ b/src/queries.h @@ -1,36 +1,35 @@ -const char *q_select_post = +const char *q_select_entry = "SELECT id, title, created_at::DATE, body " -"FROM posts " +"FROM entries " "WHERE id = $1;"; -const char *q_select_posts = +const char *q_select_entries = "SELECT id, title, created_at::DATE, body " -"FROM posts " +"FROM entries " "ORDER BY updated_at DESC;"; - -const char *q_insert_posts = -"INSERT INTO posts " +const char *q_insert_entry = +"INSERT INTO entries " "(title, body) " "VALUES " "($1, $2) " "RETURNING id;"; -const char *q_insert_posts_with_id = -"INSERT INTO posts " +const char *q_insert_entry_with_id = +"INSERT INTO entries " "(id, title, body) " "VALUES " "($1, $2, $3) " "RETURNING id;"; -const char *q_update_posts = -"UPDATE posts " +const char *q_update_entry = +"UPDATE entries " "SET title = $1, body = $2, updated_at = NOW() " "WHERE id = $3 " "RETURNING id;"; -const char *q_delete_posts = +const char *q_delete_entry = "DELETE " -"FROM posts " +"FROM entries " "WHERE id = $1 " "RETURNING id;"; |