models

package
v0.0.0-...-a55da9f Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KafkaConfig

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

type Message

type Message struct {
	ID      int64  // Unique identifier
	Content string // Content
	Done    bool   // Is this Message done?
}

func NewMessage

func NewMessage(title string) (*Message, error)

NewMessage creates a new message given a title, that can't be empty.

type MessageManager

type MessageManager struct {
	KafkaConfig
	// contains filtered or unexported fields
}

MessageManager manages a list of messages in memory.

var (
	DefaultMessageList *MessageManager
)

func NewMessageManager

func NewMessageManager(kafkaConfig KafkaConfig) *MessageManager

NewMessageManager returns an empty MessageManager.

func (*MessageManager) All

func (mm *MessageManager) All() []*Message

All returns the list of all the Messages in the MessageManager.

func (*MessageManager) Find

func (mm *MessageManager) Find(ID int64) (*Message, bool)

Find returns the Message with the given id in the MessageManager and a boolean indicating if the id was found.

func (*MessageManager) Save

func (mm *MessageManager) Save(message *Message) error

Save saves the given Message in the MessageManager.

func (*MessageManager) Send

func (mm *MessageManager) Send(msg *Message) error

Send a message to a Kafka queue. Can return an error.

Jump to

Keyboard shortcuts

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