Modified models to support a DB
This commit is contained in:
parent
3591e0c723
commit
ebaec3d296
33 changed files with 675 additions and 64 deletions
14
sql/queries/posts.sql
Normal file
14
sql/queries/posts.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
-- name: SelectPostsOfSite :many
|
||||
SELECT * FROM posts WHERE site_id = ? ORDER BY created_at DESC LIMIT 10;
|
||||
|
||||
-- name: InsertPost :one
|
||||
INSERT INTO posts (
|
||||
site_id,
|
||||
guid,
|
||||
title,
|
||||
body,
|
||||
slug,
|
||||
created_at,
|
||||
published_at
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
RETURNING id;
|
||||
12
sql/queries/pubtargets.sql
Normal file
12
sql/queries/pubtargets.sql
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
-- name: SelectPublishTargetsOfSite :many
|
||||
SELECT * FROM publish_targets WHERE site_id = ?;
|
||||
|
||||
-- name: InsertPublishTarget :one
|
||||
INSERT INTO publish_targets (
|
||||
site_id,
|
||||
publish_target_type,
|
||||
base_url,
|
||||
target_site_id,
|
||||
target_publish_key
|
||||
) VALUES (?, ?, ?, ?, ?)
|
||||
RETURNING id;
|
||||
10
sql/queries/sites.sql
Normal file
10
sql/queries/sites.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
-- name: SelectSitesOwnedByUser :many
|
||||
SELECT * FROM sites WHERE owner_id = ?;
|
||||
|
||||
-- name: InsertSite :one
|
||||
INSERT INTO sites (
|
||||
owner_id,
|
||||
title,
|
||||
tagline
|
||||
) VALUES (?, ?, ?)
|
||||
RETURNING id;
|
||||
5
sql/queries/users.sql
Normal file
5
sql/queries/users.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
-- name: SelectUserByUsername :one
|
||||
SELECT * FROM users WHERE username = ?;
|
||||
|
||||
-- name: InsertUserByUsername :one
|
||||
INSERT INTO users (username, password) VALUES (?, ?) RETURNING id;
|
||||
Loading…
Add table
Add a link
Reference in a new issue