tags

package
v0.0.0-...-8fa4d24 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2013 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package tags contains structures, methods, and functions for manipulting tags within the goblog application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TagEntries

type TagEntries map[string]*TagEntry

TagEntries is a map of TagEntry structures with some methods for easily adding blog entries. It also has the ability to export the entries as a list for further processing.

func ParseBlogs

func ParseBlogs(entries []*blogs.BlogEntry) TagEntries

ParseBlogs builds a TagEntries from the given list of blogs.

func (TagEntries) Add

func (te TagEntries) Add(e *blogs.BlogEntry)

Add links the given BlogEntry to all of it's tags.

func (TagEntries) Slice

func (te TagEntries) Slice() TagEntriesSlice

Slice returns the TagEntry structures with this TagEntries as a slice. The list is in sorted order.

type TagEntriesSlice

type TagEntriesSlice []*TagEntry

TagEntriesSlice is a slice of TagEntry structures this is returns by the Slice() function for TagEntries. It implements the sorting interface for golangs sort package.

func (TagEntriesSlice) Len

func (tes TagEntriesSlice) Len() int

Len returns the length of the TagEntriesSlice.

func (TagEntriesSlice) Less

func (tes TagEntriesSlice) Less(i, j int) bool

Less returns true if the value at i is less than the value at j.

func (TagEntriesSlice) Swap

func (tes TagEntriesSlice) Swap(i, j int)

Swap switches the elemens at i and j.

type TagEntry

type TagEntry struct {
	// The name of the Tag.
	Name string

	// The list of Entries associated with this tag.
	Entries []*blogs.BlogEntry
}

TagEntry is a Tag and it's associated entries. It is used as a storage mechanism for the tags page.

func (*TagEntry) Add

func (te *TagEntry) Add(e *blogs.BlogEntry)

Add links the given BlogEntry to this TagEntry.

Jump to

Keyboard shortcuts

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