Added Fiber and layouts
This commit is contained in:
parent
f8e7ea482b
commit
63b19a249a
17 changed files with 331 additions and 37 deletions
|
|
@ -7,6 +7,7 @@ package dbq
|
|||
type Site struct {
|
||||
ID int64
|
||||
Name string
|
||||
Title string
|
||||
Url string
|
||||
Theme string
|
||||
Props []byte
|
||||
|
|
|
|||
|
|
@ -9,8 +9,26 @@ import (
|
|||
"context"
|
||||
)
|
||||
|
||||
const getSiteWithID = `-- name: GetSiteWithID :one
|
||||
SELECT id, name, title, url, theme, props FROM site WHERE id = $1 LIMIT 1
|
||||
`
|
||||
|
||||
func (q *Queries) GetSiteWithID(ctx context.Context, id int64) (Site, error) {
|
||||
row := q.db.QueryRow(ctx, getSiteWithID, id)
|
||||
var i Site
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.Title,
|
||||
&i.Url,
|
||||
&i.Theme,
|
||||
&i.Props,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const listSites = `-- name: ListSites :one
|
||||
SELECT id, name, url, theme, props FROM site
|
||||
SELECT id, name, title, url, theme, props FROM site
|
||||
`
|
||||
|
||||
func (q *Queries) ListSites(ctx context.Context) (Site, error) {
|
||||
|
|
@ -19,6 +37,7 @@ func (q *Queries) ListSites(ctx context.Context) (Site, error) {
|
|||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.Title,
|
||||
&i.Url,
|
||||
&i.Theme,
|
||||
&i.Props,
|
||||
|
|
@ -29,15 +48,17 @@ func (q *Queries) ListSites(ctx context.Context) (Site, error) {
|
|||
const newSite = `-- name: NewSite :one
|
||||
INSERT INTO site (
|
||||
name,
|
||||
title,
|
||||
url,
|
||||
theme,
|
||||
props
|
||||
) VALUES ($1, $2, $3, $4)
|
||||
) VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING id
|
||||
`
|
||||
|
||||
type NewSiteParams struct {
|
||||
Name string
|
||||
Title string
|
||||
Url string
|
||||
Theme string
|
||||
Props []byte
|
||||
|
|
@ -46,6 +67,7 @@ type NewSiteParams struct {
|
|||
func (q *Queries) NewSite(ctx context.Context, arg NewSiteParams) (int64, error) {
|
||||
row := q.db.QueryRow(ctx, newSite,
|
||||
arg.Name,
|
||||
arg.Title,
|
||||
arg.Url,
|
||||
arg.Theme,
|
||||
arg.Props,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue