Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrURLID cannnot create URLID ErrURLID = errors.New("cannot create URLID") )
Functions ¶
This section is empty.
Types ¶
type CreateURLRequestBody ¶
type CreateURLRequestBody struct {
URL string `dynamo:"url"`
}
CreateURLRequestBody CreateURL request body
type DDBMappingStore ¶
type DDBMappingStore struct {
Cache *(map[string]*URLMapping)
Table *dynamo.Table
}
DDBMappingStore mapping store with DynamoDB
func (DDBMappingStore) GetURLMapping ¶
func (m DDBMappingStore) GetURLMapping(urlID string) (mapping *URLMapping, e error)
GetURLMapping get url mapping
func (DDBMappingStore) PutURLMapping ¶
func (m DDBMappingStore) PutURLMapping(mapping *URLMapping) error
PutURLMapping put url mapping
type URLMapper ¶
type URLMapper struct {
HostName string
MappingStore URLMappingStore
}
URLMapper create alias URL for given URL
func (*URLMapper) CreateMapping ¶
func (m *URLMapper) CreateMapping(u *url.URL, now time.Time, ttl *int) (result *URLMappingResult, e error)
CreateMapping create alias URL for given URL
type URLMapping ¶
type URLMapping struct {
URLId string `dynamo:"url_id"`
URL string `dynamo:"url"`
ExpiredAt *int64 `dynamo:"expired_at"`
}
URLMapping represent id:url mapping table record
type URLMappingResult ¶
type URLMappingResult struct {
URLString string `json:"url"`
MappedURLString string `json:"mapped_url"`
ExpiredAt *string `json:"expired_at"`
}
URLMappingResult result of URLMapper.CreateMapping
type URLMappingStore ¶
type URLMappingStore interface {
GetURLMapping(urlID string) (mapping *URLMapping, e error)
PutURLMapping(mapping *URLMapping) error
}
URLMappingStore url mapping store
Click to show internal directories.
Click to hide internal directories.