Added a suite GUID
This commit is contained in:
parent
30d99eeb9e
commit
329de2f953
11 changed files with 44 additions and 41 deletions
|
|
@ -31,6 +31,7 @@ type PublishTarget struct {
|
|||
type Site struct {
|
||||
ID int64
|
||||
OwnerID int64
|
||||
Guid string
|
||||
Title string
|
||||
Tagline string
|
||||
CreatedAt int64
|
||||
|
|
|
|||
|
|
@ -24,15 +24,17 @@ func (q *Queries) HasUsersAndSites(ctx context.Context) (sql.NullBool, error) {
|
|||
const insertSite = `-- name: InsertSite :one
|
||||
INSERT INTO sites (
|
||||
owner_id,
|
||||
guid,
|
||||
title,
|
||||
tagline,
|
||||
created_at
|
||||
) VALUES (?, ?, ?, ?)
|
||||
) VALUES (?, ?, ?, ?, ?)
|
||||
RETURNING id
|
||||
`
|
||||
|
||||
type InsertSiteParams struct {
|
||||
OwnerID int64
|
||||
Guid string
|
||||
Title string
|
||||
Tagline string
|
||||
CreatedAt int64
|
||||
|
|
@ -41,6 +43,7 @@ type InsertSiteParams struct {
|
|||
func (q *Queries) InsertSite(ctx context.Context, arg InsertSiteParams) (int64, error) {
|
||||
row := q.db.QueryRowContext(ctx, insertSite,
|
||||
arg.OwnerID,
|
||||
arg.Guid,
|
||||
arg.Title,
|
||||
arg.Tagline,
|
||||
arg.CreatedAt,
|
||||
|
|
@ -51,7 +54,7 @@ func (q *Queries) InsertSite(ctx context.Context, arg InsertSiteParams) (int64,
|
|||
}
|
||||
|
||||
const selectSiteByID = `-- name: SelectSiteByID :one
|
||||
SELECT id, owner_id, title, tagline, created_at FROM sites WHERE id = ?
|
||||
SELECT id, owner_id, guid, title, tagline, created_at FROM sites WHERE id = ?
|
||||
`
|
||||
|
||||
func (q *Queries) SelectSiteByID(ctx context.Context, id int64) (Site, error) {
|
||||
|
|
@ -60,6 +63,7 @@ func (q *Queries) SelectSiteByID(ctx context.Context, id int64) (Site, error) {
|
|||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OwnerID,
|
||||
&i.Guid,
|
||||
&i.Title,
|
||||
&i.Tagline,
|
||||
&i.CreatedAt,
|
||||
|
|
@ -68,7 +72,7 @@ func (q *Queries) SelectSiteByID(ctx context.Context, id int64) (Site, error) {
|
|||
}
|
||||
|
||||
const selectSitesOwnedByUser = `-- name: SelectSitesOwnedByUser :many
|
||||
SELECT id, owner_id, title, tagline, created_at FROM sites WHERE owner_id = ? ORDER BY title ASC
|
||||
SELECT id, owner_id, guid, title, tagline, created_at FROM sites WHERE owner_id = ? ORDER BY title ASC
|
||||
`
|
||||
|
||||
func (q *Queries) SelectSitesOwnedByUser(ctx context.Context, ownerID int64) ([]Site, error) {
|
||||
|
|
@ -83,6 +87,7 @@ func (q *Queries) SelectSitesOwnedByUser(ctx context.Context, ownerID int64) ([]
|
|||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.OwnerID,
|
||||
&i.Guid,
|
||||
&i.Title,
|
||||
&i.Tagline,
|
||||
&i.CreatedAt,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue