fix struct variable scopes

This commit is contained in:
yequari 2023-07-10 00:20:53 -07:00
parent 2f3a4aee36
commit 5cd3eeb765
1 changed files with 18 additions and 18 deletions

View File

@ -10,13 +10,13 @@ import (
type SiteId string type SiteId string
type SiteEntry struct { type SiteEntry struct {
id SiteId Id SiteId
name string Name string
webmaster *SiteWebmaster Webmaster *SiteWebmaster
url string Url string
dateAdded time.Time DateAdded time.Time
next SiteId Next SiteId
prev SiteId Prev SiteId
} }
@ -25,33 +25,33 @@ func NewSiteEntry(siteName, webmasterEmail, siteUrl string) SiteEntry {
// previous site is the last one inserted // previous site is the last one inserted
// retrieve webmaster from database or create if it doesn't exist // retrieve webmaster from database or create if it doesn't exist
return SiteEntry{ return SiteEntry{
id: SiteId(uuid.NewString()), Id: SiteId(uuid.NewString()),
name: siteName, Name: siteName,
url: siteUrl, Url: siteUrl,
dateAdded: time.Now(), DateAdded: time.Now(),
} }
} }
type WebmasterId string type WebmasterId string
type SiteWebmaster struct { type SiteWebmaster struct {
id WebmasterId Id WebmasterId
name string Name string
email string Email string
} }
func NewSiteWebmaster(name, email string) SiteWebmaster { func NewSiteWebmaster(name, email string) SiteWebmaster {
return SiteWebmaster{ id: WebmasterId(uuid.NewString()), return SiteWebmaster{ Id: WebmasterId(uuid.NewString()),
name: name, Name: name,
email: email, Email: email,
} }
} }
type Webring struct { type Webring struct {
Db *sql.DB Db *sql.DB
Length int
first SiteId first SiteId
last SiteId last SiteId
length int
} }
// Retrieve the first website added to the webring // Retrieve the first website added to the webring