boilerplate code and documentation

This commit is contained in:
yequari 2023-07-10 00:19:23 -07:00
parent 4be2d23538
commit 2f3a4aee36
1 changed files with 27 additions and 19 deletions

View File

@ -5,7 +5,6 @@ import (
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
"modernc.org/sqlite"
) )
type SiteId string type SiteId string
@ -55,49 +54,58 @@ type Webring struct {
length int length int
} }
func NewWebring(db *sql.DB) *Webring { // Retrieve the first website added to the webring
webring := Webring{Db: db} func (webring *Webring) retrieveFirstSite() (*SiteEntry, error) {
return nil, nil
return &webring
} }
func (webring *Webring) retrieveFirstSite() (SiteEntry, error) { // Retrieve the latest website added to the webring
func (webring *Webring) retrieveLastSite() (*SiteEntry, error) {
} return nil, nil
func (webring *Webring) retrieveLastSite() (SiteEntry, error) {
} }
// Commit a SiteEntry to the database
func (webring *Webring) CreateSiteEntry(entry *SiteEntry) error { func (webring *Webring) CreateSiteEntry(entry *SiteEntry) error {
// commit to database return nil
} }
// Retrieve a SiteEntry from the database by id
func (webring *Webring) RetrieveSiteEntry(id SiteId) (*SiteEntry, error) { func (webring *Webring) RetrieveSiteEntry(id SiteId) (*SiteEntry, error) {
return nil, nil
} }
// Retrieve a SiteEntry from the database by url
func (webring *Webring) RetriveSiteEntryByUrl(url string) (*SiteEntry, error) {
return nil, nil
}
// Update existing SiteEntry with the values of passed entry
func (webring *Webring) UpdateSiteEntry(entry *SiteEntry) error { func (webring *Webring) UpdateSiteEntry(entry *SiteEntry) error {
// update existing SiteEntry return nil
} }
// Delete SiteEntry from database
func (webring *Webring) DeleteSiteEntry(entry *SiteEntry) error { func (webring *Webring) DeleteSiteEntry(entry *SiteEntry) error {
// delete SiteEntry return nil
} }
// Commit a SiteWebmaster to the database
func (webring *Webring) CreateSiteWebmaster(webmaster *SiteWebmaster) error { func (webring *Webring) CreateSiteWebmaster(webmaster *SiteWebmaster) error {
return nil
} }
// Retrieve a SiteWebmaster from the database by id
func (webring *Webring) RetrieveSiteWebmaster(id WebmasterId) (*SiteWebmaster, error) { func (webring *Webring) RetrieveSiteWebmaster(id WebmasterId) (*SiteWebmaster, error) {
return nil, nil
} }
// Update a SiteWebmaster in the database with the values of the passed webmaster
func (webring *Webring) UpdateSiteWebmaster(webmaster *SiteWebmaster) error { func (webring *Webring) UpdateSiteWebmaster(webmaster *SiteWebmaster) error {
return nil
} }
// Delete a SiteWebmaster from the database
func (webring *Webring) DeleteSiteWebmaster(webmaster *SiteWebmaster) error { func (webring *Webring) DeleteSiteWebmaster(webmaster *SiteWebmaster) error {
return nil
} }