hashtags

package
v0.0.0-...-6dfde0d Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(r Hashtagger, tag string, db *gorm.DB) error

CreateHashtag checks for uniqueness of a tag, creates it if it does not exist, and links a Hashtagger via Taxonomy (regardless of uniquenss of tag) it does, however, check for uniqueness of the taxonomy

func ExtractTags

func ExtractTags(text string) []string

ExtractTags finds hashtags in a string

func FindAndCreate

func FindAndCreate(r Hashtagger, db *gorm.DB)

FindAndCreate searches the content of the Hashtagger for hashtags and saves them

func ListPostsByHashtags

func ListPostsByHashtags(tags []string, userID string, offset int, db *gorm.DB) (ps posts.Posts, err error)

Types

type Hashtag

type Hashtag struct {
	ID        string    `json:"id" gorm:"primary_key" sql:"type:uuid;default:uuid_generate_v4()"`
	Tag       string    `json:"tag" sql:"unique_index"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Hashtag is attached to posts and comments via Taxonomy

type Hashtagger

type Hashtagger interface {
	GetID() string
	GetType() string
	GetContent() string
}

Hashtagger is an interface for records that can be hashtagged

type Taxonomy

type Taxonomy struct {
	ID         string `json:"id" gorm:"primary_key" sql:"type:uuid;default:uuid_generate_v4()"`
	RecordID   string `json:"record_id" sql:"type:uuid"`
	RecordType string `json:"record_type"`
	HashtagID  string `json:"hashtag_id"`
}

Taxonomy links a record to a hashtag

Jump to

Keyboard shortcuts

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