Documentation ¶
Index ¶
- func CacheJSON(con *Context, namespace string, value []byte) error
- func CacheRSS(con *Context, namespace string, value string) error
- func ClearNamespace(con *Context, namespace string) error
- func DeleteAllItems(con *Context) error
- func NamespaceIsEmpty(con *Context, namespace string) (bool, error)
- func ReadJSONCache(con *Context, namespace string) ([]byte, error)
- func ReadRSSCache(con *Context, namespace string) (string, error)
- type Callback
- type Context
- type ImageUpload
- type Item
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearNamespace ¶
ClearNamespace deletes every entry in a namespace
func DeleteAllItems ¶
DeleteAllItems deletes all items from datastore
func NamespaceIsEmpty ¶
NamespaceIsEmpty checks if there is already an item in a namespace
func ReadJSONCache ¶
ReadJSONCache checks if there is an entry for the JOSN of namespace and returns it
Types ¶
type Callback ¶
type Callback struct { URL string `datastore:"URL,index"` Namespace string `datastore:"Namespace,index"` DSKey string `datastore:"-"` }
A Callback is something that should be executed after sharing an url
func GetCallbacksByNamespace ¶
GetCallbacksByNamespace returns all callbacks for a specific namespace
type ImageUpload ¶
type ImageUpload struct { URL string `datastore:"URL,index"` DeleteHash string `datastore:"DeleteHash"` }
An ImageUpload is all the data we store from an uploaded image
func (*ImageUpload) Store ¶
func (i *ImageUpload) Store(con *Context) error
Store stores an ImageUpload in the datastore
type Item ¶
type Item struct { Caption string `json:"caption" datastore:"Caption,noindex"` URL string `json:"url" datastore:"URL,index"` Via string `json:"via" datastore:"Via,noindex"` // Required for DS backward compatibility ImageURL string `json:"imageURL" datastore:"ImageURL,noindex"` Description string `json:"description" datastore:"Description,noindex"` CreatedAt time.Time `json:"createdat" datastore:"CreatedAt,index"` Namespace string `json:"-" datastore:"Namespace,index"` HTMLforSearch string `json:"-" datastore:"-"` // Required for DS backward compatibility DSKey string `json:"-" datastore:"-"` }
An Item is all the data we store from a website TODO check if URL must be indexed .Namespace?
func GetNewestItems ¶
func GetNewestItems(con *Context, namespace string, limit int, cursor string) ([]Item, string, error)
GetNewestItems returns the latest number elements for a specific namespace
func GetNewestItemsByTime ¶
func GetNewestItemsByTime(con *Context, namespace string, limit int, t time.Time, cursor string) ([]Item, string, error)
GetNewestItemsByTime returns up to limit numbers of items stored >= the give time
func ItemFromWebpageInfo ¶
ItemFromWebpageInfo converts the results returned from go-URLextract into our own Item struct