links

package
v0.0.0-...-4144d9e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

func Restore

func Restore(filepath string) bool

Restore links from json file

Types

type Link struct {
	ID            string     `json:"id"`
	URL           string     `json:"url"`
	Title         string     `json:"title"`
	Author        string     `json:"author"`
	Excerpt       string     `json:"excerpt"`
	DatePublished *time.Time `json:"published_at,omitempty"`
	ImageURL      string     `json:"image_url"`
	Content       string     `json:"content"`
	SharedAt      *time.Time `json:"shared_at"`
	SharedBy      struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"shared_by"`
	SharedOn struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"shared_on"`
}

func Get

func Get(id string) (*Link, bool)

Get allows to get a link from Elastic Search based on its id

func NewLink(url string) *Link

func (*Link) Delete

func (l *Link) Delete() bool

func (*Link) FindDuplicates

func (l *Link) FindDuplicates() *SearchResult

FindDuplicates checks if this link is already posted?

func (*Link) GetID

func (l *Link) GetID() string

GetID returns current ID or generate new one

func (*Link) Save

func (l *Link) Save() bool

Save this link to Elastic Search

func (*Link) SetExcerpt

func (l *Link) SetExcerpt(excerpt string)

func (*Link) SetImageURL

func (l *Link) SetImageURL(imageURL string)

func (*Link) SetSharedAt

func (l *Link) SetSharedAt(date *time.Time)

func (*Link) SetSharedBy

func (l *Link) SetSharedBy(userID, userName string)

func (*Link) SetSharedOn

func (l *Link) SetSharedOn(channelID, channelName string)

func (*Link) SetTitle

func (l *Link) SetTitle(title string)

type SearchResult

type SearchResult struct {
	// contains filtered or unexported fields
}
func Search(params url.Values) (*SearchResult, error)

Search allows to get multiple links from Elastic Search, that match the query

func (*SearchResult) GetCursor

func (r *SearchResult) GetCursor() map[string]interface{}
func (r *SearchResult) GetLinks() []*Link

func (*SearchResult) GetTotal

func (r *SearchResult) GetTotal() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL