Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( MetaBucket = Bucket{0, 0, 0, 109} LinksBucket = Bucket{240, 159, 148, 151} APIKeysBucket = Bucket{240, 159, 148, 145} CampaignBucket = Bucket{240, 159, 142, 186} )
Buckets in use by the models in rtnl.link (appropriate emojis in unicode)
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey struct { ClientID string `msgpack:"client_id"` DerivedKey string `msgpack:"derived_key"` Created time.Time `msgpack:"created"` Modified time.Time `msgpack:"modified"` }
func (*APIKey) MarshalValue ¶
func (*APIKey) UnmarshalValue ¶
type Bucket ¶
type Bucket [4]byte
A bucket is a 4 byte prefix that allows us to determine the object type by the key.
type Counts ¶ added in v1.2.0
type ShortURL ¶
type ShortURL struct { ID uint64 `msgpack:"id"` URL string `msgpack:"url"` Title string `msgpack:"title"` Description string `msgpack:"description"` Expires time.Time `msgpack:"expires"` Visits uint64 `msgpack:"visits"` Created time.Time `msgpack:"created"` Modified time.Time `msgpack:"modified"` CreatedBy string `msgpack:"created_by"` CampaignID uint64 `msgpack:"campaign_id"` Campaigns []uint64 `msgpack:"campaigns"` }
ShortURL represents a shortened link and the location to redirect the user to. The ShortURL also contains a basic visit counter and other metadata like title and description to make things easier to read on the front-end.
A Campaign is a relationship between shortened URLs that have different marketing purposes. For example, we might shorten a webinar link then create campaign links for sendgrid, twitter, linkedin, etc. The purpose of the campaign is to identify what channels are performing best. In terms of the data structure, a short URL can either have a campaign id -- meaning it is a campaign link for another URL or it can have a list of campaigns, it's sublinks. Technically a tree-structure is possible, but in practice, short urls should have either campaign id or campaigns.
func (*ShortURL) MarshalValue ¶
func (*ShortURL) ToAPI ¶
func (m *ShortURL) ToAPI() *api.ShortURL
Creates an api.ShortURL object and populates it with the fields from the model that can be populated directly. Note that URL and AltURL cannot be directly populated without a configuration object.