Documentation ¶
Overview ¶
Package guestbook implements a simple Guest Book with in-memory data storage. This is mainly used to demonstrate how to convert a standard service type in a webservice.
Index ¶
- type GuestBook
- func (g *GuestBook) AddEntry(email, title, content string) int
- func (g *GuestBook) GetAllEntries() []*GuestBookEntry
- func (g *GuestBook) GetEntry(id int) (*GuestBookEntry, error)
- func (g *GuestBook) GetPath() string
- func (g *GuestBook) RemoveAllEntries()
- func (g *GuestBook) RemoveEntry(id int) error
- func (g *GuestBook) WebDelete(params martini.Params) (int, string)
- func (g *GuestBook) WebGet(params martini.Params) (int, string)
- func (g *GuestBook) WebPost(params martini.Params, req *http.Request) (int, string)
- type GuestBookEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GuestBook ¶
type GuestBook struct {
// contains filtered or unexported fields
}
GuestBook represents a Guest Book instance. It holds the associated GuestBookEntries.
func NewGuestBook ¶
func NewGuestBook() *GuestBook
NewGuestBook returns a new empty GuestBook instance.
func (*GuestBook) GetAllEntries ¶
func (g *GuestBook) GetAllEntries() []*GuestBookEntry
GetAllEntries returns all non-nil entries in the Guest Book.
func (*GuestBook) GetEntry ¶
func (g *GuestBook) GetEntry(id int) (*GuestBookEntry, error)
GetEntry returns the entry identified by the given id or an error if it can not find it.
func (*GuestBook) RemoveAllEntries ¶
func (g *GuestBook) RemoveAllEntries()
RemoveAllEntries removes all entries from the Guest Book.
func (*GuestBook) RemoveEntry ¶
RemoveEntry removes the entry with the given id. Return nil in case of success or a specific error in case of failure.