Documentation ¶
Index ¶
- Constants
- Variables
- func ClearFreshness()
- func DbCheck() (err error)
- func DbClear() (err error)
- func DbConfigGet(obj interface{}) (err error)
- func DbConfigPut(obj interface{}) (err error)
- func DbInit() (err error)
- func DbInitObjects()
- func DbTidy()
- func DoAuth(setKey, setSecret, authUser string) (justSetup bool, err error)
- func Epoch() string
- func GetUserInfo() (nsid, name string)
- func LoadConfig() (err error)
- func MarshalConfig() (b []byte, err error)
- func Open(driver, connect string) (err error)
- func SaveConfig() (err error)
- func SetTesting(t bool)
- func SetVerbose(v bool)
- func Stack(e *error)
- func UnmarshalConfig(b []byte) (err error)
- func Wrap(err error) (wrapped error)
- type ContentDate
- type ContentInt
- type ContentString
- type ContentWoeId
- type DomainRow
- type FavsRow
- type FlexDate
- type FlexFloat
- type FlexInt
- type FlickrError
- type FlickrQuery
- type FreshRow
- type GroupRow
- type GroupsPerPhotoRow
- type NoteInfoRow
- type PhotoGroupRow
- type PhotoInfoRow
- type PhotoViewsRow
- type PhotosPerGroupRow
- type PhotosRow
- type ReferrerRow
- type Rows
- type StackError
- type StatsSummaryRow
- type Table
- func (tbl *Table) Count(where string, objs ...interface{}) (count int64, err error)
- func (tbl *Table) InsertArray(tx *sql.Tx, objs interface{}) (err error)
- func (tbl *Table) IsFresh() bool
- func (tbl *Table) NewInserter(tx *sql.Tx) (ins *TableInserter, err error)
- func (tbl *Table) Select(where string, objs ...interface{}) (r *Rows, err error)
- func (tbl *Table) UpdateFreshness(tx *sql.Tx) (err error)
- type TableInserter
- type TagInfoRow
- type TotalViewsRow
- type UrlInfoRow
- type UserGroupRow
- type UsersRow
Constants ¶
View Source
const FlexDateFormatForDb = "2006-01-02"
View Source
const FlexDateFormatForJSON = "2006-01-02"
View Source
const FlexDateFormatForQuery = "2006-01-02"
View Source
const SchemaVersion = 1
Variables ¶
View Source
var ( PhotoInfoTable = &Table{Name: "photo_info", protoType: &PhotoInfoRow{}, freshness: 1 * time.Hour} TagInfoTable = &Table{Name: "tag_info", protoType: &TagInfoRow{}} UrlInfoTable = &Table{Name: "url_info", protoType: &UrlInfoRow{}} NoteInfoTable = &Table{Name: "note_info", protoType: &NoteInfoRow{}} )
View Source
var DB *sql.DB
View Source
var DomainTable = &Table{ Name: "domain", protoType: &DomainRow{}, freshness: 24 * time.Hour, }
View Source
var FavsTable = &Table{ Name: "favs", protoType: &FavsRow{}, freshness: 1 * time.Hour, }
View Source
var FreshView = &Table{ Name: "fresh", protoType: &FreshRow{}, }
View Source
var GroupTable = &Table{ Name: "groups", protoType: &GroupRow{}, }
View Source
var GroupsPerPhotoView = &Table{ Name: "groups_per_photo", protoType: &GroupsPerPhotoRow{}, }
View Source
var PhotoGroupTable = &Table{ Name: "photo_group", protoType: &PhotoGroupRow{}, freshness: 1 * time.Hour, }
View Source
var PhotoViewsTable = &Table{ Name: "photo_views", protoType: &PhotoViewsRow{}, freshness: 1 * time.Hour, }
View Source
var PhotosPerGroupView = &Table{ Name: "photos_per_group", protoType: &PhotosPerGroupRow{}, }
View Source
var PhotosTable = &Table{ Name: "photos", protoType: &PhotosRow{}, freshness: 0, }
View Source
var ReferrerTable = &Table{ Name: "referrer", protoType: &ReferrerRow{}, freshness: 24 * time.Hour, }
View Source
var StatsSummaryView = &Table{ Name: "stats_summary", protoType: &StatsSummaryRow{}, }
View Source
var TotalViewsTable = &Table{ Name: "total_views", protoType: &TotalViewsRow{}, }
View Source
var UserGroupTable = &Table{ Name: "user_group", protoType: &UserGroupRow{}, freshness: 24 * time.Hour, }
View Source
var UsersTable = &Table{ Name: "users", protoType: &UsersRow{}, freshness: 24 * time.Hour, }
Functions ¶
func ClearFreshness ¶
func ClearFreshness()
func DbConfigGet ¶
func DbConfigGet(obj interface{}) (err error)
func DbConfigPut ¶
func DbConfigPut(obj interface{}) (err error)
func DbInitObjects ¶
func DbInitObjects()
func GetUserInfo ¶
func GetUserInfo() (nsid, name string)
func LoadConfig ¶
func LoadConfig() (err error)
func MarshalConfig ¶
func SaveConfig ¶
func SaveConfig() (err error)
func SetTesting ¶
func SetTesting(t bool)
func SetVerbose ¶
func SetVerbose(v bool)
func UnmarshalConfig ¶
Types ¶
type ContentDate ¶
type ContentDate struct {
Value FlexDate `json:"_content"`
}
type ContentInt ¶
type ContentInt struct {
Value FlexInt `json:"_content"`
}
type ContentString ¶
type ContentString struct {
Value string `json:"_content"`
}
type ContentWoeId ¶
type FlexDate ¶
type FlexDate string
func FlexDateFromInt ¶
func FlexDateFromString ¶
func NewFlexDate ¶
func (*FlexDate) UnmarshalJSON ¶
type FlexFloat ¶
type FlexFloat float64
func (FlexFloat) MarshalJSON ¶
func (*FlexFloat) UnmarshalJSON ¶
type FlickrError ¶
type FlickrError struct { Stat string `json:"stat"` Code FlexInt `json:"code"` Message string `json:"message"` }
func (FlickrError) Error ¶
func (e FlickrError) Error() string
func (FlickrError) String ¶
func (e FlickrError) String() string
type FlickrQuery ¶
func (*FlickrQuery) Execute ¶
func (fq *FlickrQuery) Execute(method string, result interface{}) (err error)
type GroupRow ¶
type GroupRow struct { NsId string `json:"nsid" db:"key"` Id string `json:"id"` PathAlias string `json:"path_alias"` Name ContentString `json:"name"` IconFarm FlexInt `json:"iconfarm"` IconServer FlexInt `json:"iconserver"` Description ContentString `json:"description"` Rules ContentString `json:"rules"` Members ContentInt `json:"members"` PoolCount ContentInt `json:"pool_count"` TopicCount ContentInt `json:"topic_count"` Privacy ContentInt `json:"privacy"` Lang string `json:"lang"` IsPoolModerated FlexInt `json:"ispoolmoderated"` Roles struct { Member string `json:"member"` Moderator string `json:"moderator"` Admin string `json:"admin"` } `json:"roles"` PhotoLimitOptOut FlexInt `json:"photo_limit_opt_out"` IsMember FlexInt `json:"is_member" test:"optional"` IsModerator FlexInt `json:"is_moderator" test:"optional"` IsAdmin FlexInt `json:"is_admin" test:"optional"` IsFounder FlexInt `json:"is_founder" test:"optional"` UserGroupPrefs []interface{} `json:"user_group_prefs"` // Content unknown Blast struct { Value string `json:"_content"` DateBlastAdded FlexDate `json:"date_blast_added"` UserId string `json:"user_id"` } `json:"blast" test:"optional"` Throttle struct { Count FlexInt `json:"count" test:"optional"` Mode string `json:"mode"` Remaining FlexInt `json:"remaining" test:"optional"` } `json:"throttle"` Restrictions struct { PhotosOk FlexInt `json:"photos_ok"` VideosOk FlexInt `json:"videos_ok"` ImagesOK FlexInt `json:"images_ok"` ScreensOk FlexInt `json:"screens_ok"` ArtOk FlexInt `json:"art_ok"` SafeOk FlexInt `json:"safe_ok"` ModerateOk FlexInt `json:"moderate_ok"` RestrictedOk FlexInt `json:"restricted_ok"` HasGeo FlexInt `json:"has_geo"` } `json:"restrictions"` }
type GroupsPerPhotoRow ¶
type NoteInfoRow ¶
type NoteInfoRow struct { PhotoId string `json:"photo_id" db:"key,index" fill:"Photo.Id" test:"optional"` Id string `json:"id" db:"key"` Author string `json:"author"` AuthorName string `json:"authorname"` X FlexInt `json:"x"` Y FlexInt `json:"y"` W FlexInt `json:"w"` H FlexInt `json:"h"` Note string `json:"_content"` }
type PhotoGroupRow ¶
type PhotoInfoRow ¶
type PhotoInfoRow struct { Id string `json:"id" db:"key"` Owner struct { NsId string `json:"nsid" db:"index"` IconFarm FlexInt `json:"iconfarm" db:"ignore"` IconServer FlexInt `json:"iconserver" db:"ignore"` Location string `json:"location" db:"ignore"` PathAlias string `json:"path_alias" db:"ignore"` RealName string `json:"realname" db:"ignore"` UserName string `json:"username" db:"ignore"` } `json:"owner"` DateUploaded FlexDate `json:"dateuploaded"` IsFavorite FlexInt `json:"isfavorite"` License FlexInt `json:"license"` SafetyLevel FlexInt `json:"safety_level"` Rotation FlexInt `json:"rotation"` OriginalSecret string `json:"originalsecret" test:"optional"` OriginalFormat string `json:"originalformat" test:"optional"` Description ContentString `json:"description"` Visibility struct { IsPublic FlexInt `json:"ispublic"` IsFriend FlexInt `json:"isfriend"` IsFamily FlexInt `json:"isfamily"` } `json:"visibility"` Dates struct { Posted FlexDate `json:"posted"` Taken string `json:"taken"` TakenGranularity FlexInt `json:"takengranularity"` TakenUnknown FlexInt `json:"takenunknown"` LastUpdate FlexDate `json:"lastupdate"` } `json:"dates"` Permissions struct { PermComment FlexInt `json:"permcomment"` PermAddMeta FlexInt `json:"permaddmeta"` } `json:"permissions" test:"optional"` Views FlexInt `json:"views"` Editability struct { CanComment FlexInt `json:"cancomment"` CanAddMeta FlexInt `json:"canaddmeta"` } `json:"editability"` PublicEditability struct { CanComment FlexInt `json:"cancomment"` CanAddMeta FlexInt `json:"canaddmeta"` } `json:"publiceditability"` Usage struct { CanDownload FlexInt `json:"candownload"` CanBlog FlexInt `json:"canblog"` CanPrint FlexInt `json:"canprint"` CanShare FlexInt `json:"canshare"` } `json:"usage"` Comments ContentInt `json:"comments"` Notes struct { Note []*NoteInfoRow `json:"note"` } `json:"notes"` People struct { HasPeople FlexInt `json:"haspeople"` } `json:"people"` Tags struct { Tag []*TagInfoRow `json:"tag"` } `json:"tags"` Urls struct { Url []*UrlInfoRow `json:"url"` } `json:"urls"` Media string `json:"media"` GeoPerms struct { IsPublic FlexInt `json:"ispublic"` IsContact FlexInt `json:"iscontact"` IsFriend FlexInt `json:"isfriend"` IsFamily FlexInt `json:"isfamily"` } `json:"geoperms" test:"optional"` Location struct { Latitude FlexFloat `json:"latitude"` Longitude FlexFloat `json:"longitude"` Accuracy FlexInt `json:"accuracy"` Context FlexInt `json:"context"` Locality ContentWoeId `json:"locality"` County ContentWoeId `json:"county"` Region ContentWoeId `json:"region"` Country ContentWoeId `json:"country"` Neighbourhood ContentWoeId `json:"neighbourhood"` } `json:"location" test:"optional"` Farm FlexInt `json:"farm" db:"ignore"` Secret string `json:"secret" db:"ignore"` Server FlexInt `json:"server" db:"ignore"` Title ContentString `json:"title" db:"ignore"` }
type PhotoViewsRow ¶
type PhotosPerGroupRow ¶
type PhotosRow ¶
type PhotosRow struct { Id string `json:"id" db:"key"` Owner string `json:"owner"` Secret string `json:"secret"` Server string `json:"server"` Farm FlexInt `json:"farm"` Title string `json:"title"` IsPublic FlexInt `json:"ispublic"` IsFriend FlexInt `json:"isfriend"` IsFamily FlexInt `json:"isfamily"` }
type ReferrerRow ¶
type ReferrerRow struct { PhotoId string `json:"photo_id" db:"key,index" test:"optional" fill:"query:photo_id"` Domain string `json:"domain" db:"key,index" test:"optional" fill:"query:domain"` Date FlexDate `json:"date" db:"key,index" test:"optional" fill:"query:date"` Url string `json:"url" db:"key,index"` Views FlexInt `json:"views"` SearchTerm string `json:"searchterm" test:"optional" db:"index"` }
type StackError ¶
type StackError struct {
// contains filtered or unexported fields
}
func (*StackError) Error ¶
func (s *StackError) Error() string
func (*StackError) Unwrap ¶
func (s *StackError) Unwrap() error
type StatsSummaryRow ¶
type StatsSummaryRow struct { PhotoId string `json:"photo_id"` FavCount FlexInt `json:"fav_count"` ViewCount FlexInt `json:"view_count"` PostedDate FlexDate `json:"posted_date"` PageUrl string `json:"page_url"` Title string `json:"title"` Farm FlexInt `json:"farm"` Server string `json:"server"` Secret string `json:"secret"` }
type Table ¶
type Table struct { Name string // contains filtered or unexported fields }
func (*Table) NewInserter ¶
func (tbl *Table) NewInserter(tx *sql.Tx) (ins *TableInserter, err error)
type TableInserter ¶
func (*TableInserter) Insert ¶
func (ins *TableInserter) Insert(obj interface{}) (err error)
func (*TableInserter) InsertArray ¶
func (ins *TableInserter) InsertArray(objs interface{}) (err error)
type TagInfoRow ¶
type TagInfoRow struct { PhotoId string `json:"photo_id" db:"key,index" fill:"Photo.Id" test:"optional"` Id string `json:"id" db:"key"` Author string `json:"author"` AuthorName string `json:"authorname"` Raw string `json:"raw"` Tag string `json:"_content" db:"index"` MachineTag FlexInt `json:"machine_tag"` }
type TotalViewsRow ¶
type TotalViewsRow struct { NsId string `json:"id" db:"key" test:"optional"` Date FlexDate `json:"date" db:"key" test:"optional"` Total viewsInt `json:"total"` Photos viewsInt `json:"photos"` PhotoStream viewsInt `json:"photostream"` Sets viewsInt `json:"sets"` Collections viewsInt `json:"collections"` Galleries viewsInt `json:"galleries"` }
type UrlInfoRow ¶
type UserGroupRow ¶
type UsersRow ¶
type UsersRow struct { NsId string `json:"nsid" db:"key"` Id string `json:"id"` IsPro FlexInt `json:"ispro"` CanBuyPro FlexInt `json:"can_buy_pro"` IconServer string `json:"iconserver"` IconFarm FlexInt `json:"iconfarm"` PathAlias string `json:"path_alias"` HasStats string `json:"has_stats"` ProBadge string `json:"pro_badge" test:"optional"` Expire string `json:"expire" test:"optional"` UserName ContentString `json:"username"` RealName ContentString `json:"realname" test:"optional"` MboxSha1Sum ContentString `json:"mbox_sha1sum" test:"optional"` Location ContentString `json:"location" test:"optional"` TimeZone struct { Label string `json:"label"` Offset string `json:"offset"` Id string `json:"timezone_id"` } `json:"timezone" test:"optional"` Description ContentString `json:"description"` PhotosUrl ContentString `json:"photosurl"` ProfileUrl ContentString `json:"profileurl"` MobileUrl ContentString `json:"mobileurl"` Photos struct { FirstDateTaken ContentDate `json:"firstdatetaken"` FirstDate ContentDate `json:"firstdate"` Count ContentInt `json:"count"` Views ContentInt `json:"views" test:"optional"` } `json:"photos"` UploadCount FlexInt `json:"upload_count" test:"optional"` UploadLimit FlexInt `json:"upload_limit" test:"optional"` UploadLimitStatus string `json:"upload_limit_status" test:"optional"` IsCognitoUser FlexInt `json:"is_cognito_user" test:"optional"` AllRightsReservedPhotoCount FlexInt `json:"all_rights_reserved_photos_count" test:"optional"` Ignored FlexInt `json:"ignored" test:"optional"` Gender string `json:"gender" test:"optional"` Contact FlexInt `json:"contact" test:"optional"` Friend FlexInt `json:"friend" test:"optional"` Family FlexInt `json:"family" test:"optional"` RevContact FlexInt `json:"revcontact" test:"optional"` RevFriend FlexInt `json:"revfriend" test:"optional"` RevFamily FlexInt `json:"revfamily" test:"optional"` }
Click to show internal directories.
Click to hide internal directories.