1package model23import (4 "net/netip"5 "time"6)78type SiteLastFetched struct {9 Time time.Time10 Num int11}1213func (s *SiteLastFetched) Clone() *SiteLastFetched {14 if s == nil {15 return nil16 } else {17 return &SiteLastFetched{18 Time: s.Time,19 Num: s.Num,20 }21 }22}2324type Site struct {25 ID int26 Name string27 DisplayName string28 LastFetched *SiteLastFetched29}3031func (s *Site) Clone() *Site {32 if s == nil {33 return nil34 } else {35 return &Site{36 ID: s.ID,37 Name: s.Name,38 DisplayName: s.DisplayName,39 LastFetched: s.LastFetched.Clone(),40 }41 }42}4344type RedditSettings struct {45 ClientID string46 ClientSecret string47}4849func (r *RedditSettings) Clone() *RedditSettings {50 if r == nil {51 return nil52 } else {53 return &RedditSettings{54 ClientID: r.ClientID,55 ClientSecret: r.ClientSecret,56 }57 }58}5960type Settings struct {61 Reddit *RedditSettings62 DefaultNumPosts int63 MaxNumPosts int64 SiteFetchWait time.Duration65}6667func (s *Settings) Clone() *Settings {68 if s == nil {69 return nil70 } else {71 return &Settings{72 Reddit: s.Reddit.Clone(),73 DefaultNumPosts: s.DefaultNumPosts,74 MaxNumPosts: s.MaxNumPosts,75 SiteFetchWait: s.SiteFetchWait,76 }77 }78}7980type Request struct {81 ID int6482 Host netip.AddrPort83 SiteId int84 NumPosts int85 DefaultNumPosts bool86 Timestamp time.Time87}8889func (r *Request) Clone() *Request {90 if r == nil {91 return nil92 } else {93 out := *r94 return &out95 }96}9798type Post struct {99 SiteUniqueID string100 Title string101 Score int102 Created time.Time103 URL *string104}105106func (p *Post) Clone() *Post {107 if p == nil {108 return nil109 } else {110 out := *p111 if p.URL != nil {112 url := *p.URL113 p.URL = &url114 }115 return &out116 }117}