news

package
v0.0.0-...-9af3b72 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteByUUID

func DeleteByUUID(uuid uuid.UUID) bool

Types

type Comment

type Comment struct {
	UUID    uuid.UUID `json:"uuid"`
	Created time.Time `json:"created"`
	Player  uuid.UUID `json:"player"`
	Content string    `json:"content"`
}

type NewsItem

type NewsItem struct {
	UUID     uuid.UUID `json:"uuid"`
	Author   uuid.UUID `json:"author"`
	Created  time.Time `json:"created"`
	Tag      Tag       `json:"tag"`
	Title    string    `json:"title"`
	Leadin   string    `json:"leadin"`
	Body     string    `json:"body"`
	Picture  []byte    `json:"picture"`
	Comments []Comment `json:"comments"`
}

func AllNewsItems

func AllNewsItems() ([]*NewsItem, error)

func NewNewsItem

func NewNewsItem(itemdata NewsItem, author uuid.UUID) (*NewsItem, error)

Create a NewsItem

func NewsItemByUUID

func NewsItemByUUID(uuid uuid.UUID) (*NewsItem, error)

func (*NewsItem) AddComment

func (c *NewsItem) AddComment(player uuid.UUID, content string) error

func (*NewsItem) RemoveComment

func (c *NewsItem) RemoveComment(uuid uuid.UUID) error

func (*NewsItem) RemoveCommentsByPlayer

func (c *NewsItem) RemoveCommentsByPlayer(player uuid.UUID) error

func (*NewsItem) UpdateNewsItem

func (c *NewsItem) UpdateNewsItem(ci NewsItem) error

type NewsItemStorage

type NewsItemStorage interface {
	Store(*NewsItem) error
	Delete(uuid.UUID) error
	Load(uuid.UUID) (*NewsItem, error)
	LoadAll() ([]*NewsItem, error)
	LoadByAuthor(uuid.UUID) ([]*NewsItem, error)
}

A storage interface for News

type RedisNewsItemStorage

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

func NewRedisNewsItemStorage

func NewRedisNewsItemStorage() *RedisNewsItemStorage

func (*RedisNewsItemStorage) Delete

func (rnis *RedisNewsItemStorage) Delete(uuid uuid.UUID) error

func (*RedisNewsItemStorage) Load

func (rnis *RedisNewsItemStorage) Load(uuid uuid.UUID) (*NewsItem, error)

func (*RedisNewsItemStorage) LoadAll

func (rnis *RedisNewsItemStorage) LoadAll() ([]*NewsItem, error)

func (*RedisNewsItemStorage) LoadByAuthor

func (rnis *RedisNewsItemStorage) LoadByAuthor(author uuid.UUID) ([]*NewsItem, error)

func (*RedisNewsItemStorage) Store

func (rnis *RedisNewsItemStorage) Store(c *NewsItem) error

type Tag

type Tag int
const (
	Article Tag = iota
	Analysis
	Strategy
	Recepie
	GoldenHand
)

Jump to

Keyboard shortcuts

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