archives

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: 3 Imported by: 0

Documentation

Overview

Packages archive contains structures, methods, and functions used by the goblog application when manipulation archival information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMostRecent

func GetMostRecent(y []*YearEntries, max int) []*blogs.BlogEntry

GetMost Recent returns up to the max most recent entries from the given (and hopefully sorted) list of YearEntries.

Types

type DateEntries

type DateEntries map[string]*YearEntries

DateEntries is a map that stores blog entries by year and month.

func ParseBlogs

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

ParseBlogs creates a DateEntries from the given list of blogs.

func (DateEntries) Add

func (de DateEntries) Add(year, month string, e *blogs.BlogEntry)

Add stores the given BlogEntry under the given year and month.

func (DateEntries) Slice

func (de DateEntries) Slice() YearEntriesSlice

Slice returns the Year, Month, and BlogEntries as a slice which is suitable for transformation in the templates. The year and months are sorted.

type MonthEntries

type MonthEntries struct {
	// The name of the month.
	Month string

	// A list of blog entries for this month.
	Entries []*blogs.BlogEntry
}

MonthEntries is a list of entries and their associated month. It implements the sort interface for sorting the entries by date descending.

func (*MonthEntries) Add

func (me *MonthEntries) Add(e *blogs.BlogEntry)

Add appends the given BlogEntry to the Entries list. It doesn't check to see if the given entry was actually in this month.

func (*MonthEntries) Len

func (me *MonthEntries) Len() int

Len returns the length of the MonthEntries.

func (*MonthEntries) Less

func (me *MonthEntries) Less(i, j int) bool

Less returns true if the entry at j is newer than the entry at i.

func (*MonthEntries) Swap

func (me *MonthEntries) Swap(i, j int)

Swap switches the elements at i and j.

type YearEntries

type YearEntries struct {
	// The name of the year.
	Year string

	// A list of MonthEntries for this year.
	Months []*MonthEntries
}

YearEntries is a list of entries and their associated year. It implements the sort interface for sorting the MonthEntries by date descending.

func (*YearEntries) Add

func (ye *YearEntries) Add(month string, e *blogs.BlogEntry)

Add appends the given BlogEntry to the Months list for the given month. It doesn't check to see if the given entry was actually in this year/month.

func (YearEntries) Len

func (ye YearEntries) Len() int

Len returns the length of the YearEntries.

func (YearEntries) Less

func (ye YearEntries) Less(i, j int) bool

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

func (YearEntries) Swap

func (ye YearEntries) Swap(i, j int)

Swap switches the elements at i and j.

type YearEntriesSlice

type YearEntriesSlice []*YearEntries

func (YearEntriesSlice) Len

func (ye YearEntriesSlice) Len() int

Len returns the length of the YearEntriesSlice.

func (YearEntriesSlice) Less

func (ye YearEntriesSlice) Less(i, j int) bool

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

func (YearEntriesSlice) Swap

func (ye YearEntriesSlice) Swap(i, j int)

Swap switches the elements at i and j.

Jump to

Keyboard shortcuts

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