Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNewPost ¶
func GetPosts ¶
func GetPosts(ps IPostStorage) func(c *gin.Context)
func PostNewPost ¶
func PostNewPost(ps IPostStorage) func(c *gin.Context)
Types ¶
type IPostStorage ¶
IPostStorage is a generic poster interface
type MongoStorage ¶
type MongoStorage struct {
Coll *mongo.Collection
}
func (MongoStorage) GetPosts ¶
func (ps MongoStorage) GetPosts() []Post
func (MongoStorage) SavePost ¶
func (ps MongoStorage) SavePost(p Post)
type Post ¶
type Post struct { ID string Created time.Time Name string `form:"name" json:"name"` Message string `form:"message" json:"message"` Terms string `form:"terms" json:"terms"` }
Post is a representation of a Guestbook entry
func FromMap ¶
FromMap creates a new Post instance from a map of strings. This is typically what is returned from external stores like Redis and is used by the PostStorage struct.
func (Post) GetTimeSince ¶
type RedisStorage ¶
type RedisStorage struct {
Rdb *redis.Client
}
func (RedisStorage) GetPosts ¶
func (ps RedisStorage) GetPosts() []Post
func (RedisStorage) SavePost ¶
func (ps RedisStorage) SavePost(p Post)
Click to show internal directories.
Click to hide internal directories.