17 lines
998 B
Go
17 lines
998 B
Go
|
|
package store
|
||
|
|
|
||
|
|
import "context"
|
||
|
|
|
||
|
|
func (s *Store) SiteContent(ctx context.Context) (SiteContent, error) {
|
||
|
|
var c SiteContent
|
||
|
|
err := s.db.QueryRowContext(ctx, `select hero_title, hero_subtitle, intro_title, intro_text, about_name, about_role, about_bio, email, phone, location, hero_image, about_image from site_content where id = 1`).
|
||
|
|
Scan(&c.HeroTitle, &c.HeroSubtitle, &c.IntroTitle, &c.IntroText, &c.AboutName, &c.AboutRole, &c.AboutBio, &c.Email, &c.Phone, &c.Location, &c.HeroImage, &c.AboutImage)
|
||
|
|
return c, err
|
||
|
|
}
|
||
|
|
|
||
|
|
func (s *Store) UpdateSiteContent(ctx context.Context, c SiteContent) error {
|
||
|
|
_, err := s.db.ExecContext(ctx, `update site_content set hero_title=?, hero_subtitle=?, intro_title=?, intro_text=?, about_name=?, about_role=?, about_bio=?, email=?, phone=?, location=?, hero_image=?, about_image=? where id=1`,
|
||
|
|
c.HeroTitle, c.HeroSubtitle, c.IntroTitle, c.IntroText, c.AboutName, c.AboutRole, c.AboutBio, c.Email, c.Phone, c.Location, c.HeroImage, c.AboutImage)
|
||
|
|
return err
|
||
|
|
}
|