domain

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	C = newStore()
)

Functions

func CreateChannel

func CreateChannel(name, description string)

func ListChannels

func ListChannels() map[string]*Stream

func SendMessage

func SendMessage(channel, message string) error

func Setup

func Setup()

TODO: streams per user

Types

type Message

type Message struct {
	Id       string
	Text     string
	Created  int64 `json:",string"`
	Stream   string
	Metadata *Metadata
}

func ListMessages

func ListMessages(channel string, limit int64) []*Message

type Metadata

type Metadata struct {
	Created     int64
	Title       string
	Description string
	Type        string
	Image       string
	Url         string
	Site        string
}

type Store

type Store struct {
	Created int64
	Updates chan *Message

	Streams *lru.Cache
	// contains filtered or unexported fields
}

func (*Store) CreateStream

func (c *Store) CreateStream(name, description string)

func (*Store) ListStreams

func (c *Store) ListStreams() map[string]*Stream

func (*Store) Metadata

func (c *Store) Metadata(t *Message)

func (*Store) Retrieve

func (c *Store) Retrieve(message string, streem string, direction, last, limit int64) []*Message

func (*Store) Run

func (c *Store) Run()

func (*Store) Save

func (c *Store) Save(message *Message)

type Stream

type Stream struct {
	Id          string
	Description string
	Messages    []*Message
	Updated     int64
}

Jump to

Keyboard shortcuts

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