shared

package
v0.0.0-...-00f2895 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2012 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CAPSLOCK_DAY_TRANSFORM_COMMENT

func CAPSLOCK_DAY_TRANSFORM_COMMENT(comment *PostComment)

func CAPSLOCK_DAY_TRANSFORM_POST

func CAPSLOCK_DAY_TRANSFORM_POST(post *BlogPost)

we must honor the capslock day

func DBConnect

func DBConnect()

func DBDisconnect

func DBDisconnect()

func Htmlstrip

func Htmlstrip(s string) string

I hope I got the slices right and am not copying strings aroung :]

func Telstrip

func Telstrip(s string) string

strip evil console command codes out ...

Types

type BlogDB

type BlogDB interface {
	Connect()
	Disconnect()

	StorePost(post *BlogPost) (int64, error)
	GetPost(post_id int64) (BlogPost, error)
	GetPostsForTimespan(start_timestamp, end_timestamp, order int64) (posts []BlogPost, err error)
	GetLastNPosts(num_to_get int32) (posts []BlogPost, err error)

	StoreComment(comment *PostComment) (int64, error)
	GetComments(post_id int64) (comments []PostComment, err error)
}

type BlogPost

type BlogPost struct {
	Content string
	//Timestamp int64
	Timestamp time.Time
	Id        int64
	Comments  []PostComment
}

func (BlogPost) Excerpt

func (self BlogPost) Excerpt() string

type MongoDB

type MongoDB struct {
	// contains filtered or unexported fields
}

func DBGet

func DBGet() *MongoDB

func (*MongoDB) Close

func (self *MongoDB) Close()

func (*MongoDB) GetComments

func (md *MongoDB) GetComments(post_id int64) (comments []PostComment, err error)

get comments belonging to a post

func (*MongoDB) GetLastNPosts

func (md *MongoDB) GetLastNPosts(num_to_get int32) (posts []BlogPost, err error)

func (*MongoDB) GetPost

func (md *MongoDB) GetPost(post_id int64) (post BlogPost, err error)

func (*MongoDB) GetPostsForDate

func (md *MongoDB) GetPostsForDate(date time.Time) (posts []BlogPost, err error)

returns posts for a certain date

func (*MongoDB) GetPostsForLastNDays

func (md *MongoDB) GetPostsForLastNDays(num_of_days int64) (posts []BlogPost, err error)

func (*MongoDB) GetPostsForMonth

func (md *MongoDB) GetPostsForMonth(date time.Time) (posts []BlogPost, err error)

returns posts for a certain month

func (*MongoDB) GetPostsForTimespan

func (md *MongoDB) GetPostsForTimespan(start_timestamp, end_timestamp, order int64) (posts []BlogPost, err error)

func (*MongoDB) StoreComment

func (md *MongoDB) StoreComment(comment *PostComment) (id int64, err error)

func (*MongoDB) StorePost

func (md *MongoDB) StorePost(post *BlogPost) (id int64, err error)

warning: it will marhsall the comments list - so we need to change this if we enable updating/editing posts

type PostComment

type PostComment struct {
	Content string
	Author  string
	//Timestamp int64
	Timestamp time.Time
	Id        int64
	PostId    int64
}

Jump to

Keyboard shortcuts

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