model

package
v0.0.0-...-acd8c0a Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MemberJSON

func MemberJSON(item RoshiStreamItem) ([]byte, error)

MemberJSON Returns the byte array of the json for a given stream item in roshi member form

Types

type RoshiQuery

type RoshiQuery StreamQuery

RoshiQuery shadows a StreamItem to allow us to export the json Roshi expects

func (RoshiQuery) MarshalJSON

func (q RoshiQuery) MarshalJSON() ([]byte, error)

MarshalJSON takes a roshiquery and creates a list of base64 encoded bytes, hashing the StreamID with xxhash

type RoshiResponse

type RoshiResponse struct {
	Duration string            `json:"duration"`
	Items    []RoshiStreamItem `json:"records"`
}

RoshiResponse represents the response from a Query

type RoshiStreamItem

type RoshiStreamItem StreamItem

RoshiStreamItem shadows StreamItem to allow us to export the json Roshi expects

func ToRoshiStreamItem

func ToRoshiStreamItem(items []StreamItem) ([]RoshiStreamItem, error)

ToRoshiStreamItem converts a slice of StreamItems into a slice of RoshiStreamItems

func (RoshiStreamItem) MarshalJSON

func (item RoshiStreamItem) MarshalJSON() ([]byte, error)

MarshalJSON converts from a RoshiStreamItem to the expected json for Roshi, hashing the StreamID with xxhash

func (*RoshiStreamItem) UnmarshalJSON

func (item *RoshiStreamItem) UnmarshalJSON(data []byte) error

UnmarshalJSON correct converts a roshi json blob back to RoshiStreamItem

type StreamItem

type StreamItem struct {
	ID        string         `json:"id"`
	Timestamp time.Time      `json:"ts"`
	Type      StreamItemType `json:"type"`
	StreamID  string         `json:"stream_id"`
}

StreamItem represents a single item on a stream

func ToStreamItem

func ToStreamItem(rItems []RoshiStreamItem) ([]StreamItem, error)

ToStreamItem converts a slice of RoshiStreamItems to a slice of StreamItems

type StreamItemType

type StreamItemType int

StreamItemType represents the type of stream an item is in

const (
	//TypePost is a type of stream item which is a direct post
	TypePost StreamItemType = iota
	//TypeRepost is a type of stream item which represents a repost
	TypeRepost
)

type StreamQuery

type StreamQuery struct {
	Streams []string `json:"streams"`
}

StreamQuery represents a query for multiple streams

type StreamQueryResponse

type StreamQueryResponse struct {
	Items  []StreamItem
	Cursor string
}

StreamQueryResponse represents the data returned for a stream query

Jump to

Keyboard shortcuts

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