Documentation ¶
Overview ¶
Package faststore is a collection of stores that are optimzed and not neccesarly of the same interface as a url.Store
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FastStorer ¶
type FastStorer interface { AddURL(URLModel) GetURL(id string) (URLModel, error) AllURLs() ([]URLModel, error) }
A FastStorer is an interface that allows URL models to be quickly stored.
type URLModel ¶
type URLModel struct { ID bson.ObjectId `bson:"_id"` Slug string `bson:"slug"` URL string `bson:"url"` }
A URLModel abstracts the fields.
type URLMongoStore ¶
type URLMongoStore struct {
// contains filtered or unexported fields
}
A URLMongoStore represents a persistent connection to a mongo backend.
func NewURLMongoStore ¶
func NewURLMongoStore(uri string) (s *URLMongoStore, err error)
NewURLMongoStore is a factory function to return a valid URLMongoStore.
func (*URLMongoStore) AddURL ¶
func (s *URLMongoStore) AddURL(model URLModel)
AddURL adds the given URLModel to the mongodb
func (*URLMongoStore) AllURLs ¶
func (s *URLMongoStore) AllURLs() (models []URLModel, err error)
AllURLs aggregates all model records.
Click to show internal directories.
Click to hide internal directories.