Documentation
¶
Index ¶
- Constants
- type Database
- func (d Database) Close()
- func (d Database) DeleteShortURLandStats(ID int) error
- func (d Database) GetAll() ([]ShortURL, error)
- func (d Database) GetAllMapped() (map[string]ShortURL, error)
- func (d Database) GetAllStatisticsGroupedByURLs() (map[string]OneURLSummaryStatistics, error)
- func (d Database) GetStatisticForOneURLOneDay(shortUrlID int, dayDate time.Time) (*ShortURL, []OneViewStatistic, error)
- func (d Database) GetStatisticsForOneURL(shortUrlID int) (*ShortURL, map[string]OneDaySummaryStatistics, error)
- func (d Database) GetUrl(suffix string) (*ShortURL, error)
- func (d Database) GetUrlByID(ID int) (*ShortURL, error)
- func (d Database) GetViewByID(ID int) (*OneViewStatistic, error)
- func (d Database) IsEmpty() bool
- func (d Database) SaveShortUrl(shortSuffix, fullTargetAddress, description string, isPublic bool) error
- func (d Database) SaveShortUrlObject(shortUrl *ShortURL) error
- func (d Database) SaveStatisticForOneView(ipAddress, requestedUrl, countryCode, countryName, city, userAgent string) error
- func (d Database) UpdateShortUrl(id, fieldName string, value interface{}) error
- type OneDaySummaryStatistics
- type OneURLSummaryStatistics
- type OneViewStatistic
- type ShortURL
Constants ¶
View Source
const (
DayFormat = "2006-01-02"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (Database) DeleteShortURLandStats ¶
func (Database) GetAllStatisticsGroupedByURLs ¶
func (d Database) GetAllStatisticsGroupedByURLs() (map[string]OneURLSummaryStatistics, error)
func (Database) GetStatisticForOneURLOneDay ¶
func (Database) GetStatisticsForOneURL ¶
func (Database) GetViewByID ¶
func (d Database) GetViewByID(ID int) (*OneViewStatistic, error)
func (Database) SaveShortUrl ¶
func (Database) SaveShortUrlObject ¶
func (Database) SaveStatisticForOneView ¶
func (Database) UpdateShortUrl ¶
type OneDaySummaryStatistics ¶
type OneURLSummaryStatistics ¶
type OneURLSummaryStatistics struct {
ID int
ShortUrlID int
ShortUrl string
PublishDate string // format is 2006-01-02
TotalDaysActive int
TotalViews int
TotalUniqueUsers int
}
representation only
type OneViewStatistic ¶
type OneViewStatistic struct {
ID int `storm:"id,increment"`
UserIpAddress string `storm:"index"`
ShortUrl string `storm:"index"` // shortened URL suffix
Day string `storm:"index"` // just a date sortable in format of 2020-01-02, to be able to select all the views for a day
CountryCode string
CountryName string
City string
UserAgent string
ViewTimes []time.Time // one view is one time record, UTC
}
Click to show internal directories.
Click to hide internal directories.