chat

package
v0.3.10 Latest Latest
Warning

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

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

Documentation

Overview

Package chat provides a high-level store of chat messages

Index

Constants

View Source
const DefaultMessagesLimit = 50

Variables

View Source
var MigrationFiles []string = []string{
	"1-initialize-schema-v0.1.7",
	"2-rename-user-to-identity-v0.1.11",
}

Functions

func NewDomainEmbeds added in v0.1.7

func NewDomainEmbeds() database.DomainEmbeds

Types

type Message

type Message struct {
	ID       MessageID
	Topic    Topic
	SendTime time.Time
	SenderID SenderID
	Body     string
}

type MessageID added in v0.3.4

type MessageID int64

type SenderID added in v0.3.4

type SenderID string

type Store

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

func NewStore

func NewStore(db *database.DB) *Store

func (*Store) AddMessage added in v0.1.7

func (s *Store) AddMessage(ctx context.Context, m Message) (messageID MessageID, err error)

func (*Store) GetMessagesByTopic added in v0.1.7

func (s *Store) GetMessagesByTopic(
	ctx context.Context, topic Topic, messagesLimit int64,
) (messages []Message, err error)

type Topic added in v0.3.4

type Topic string

Jump to

Keyboard shortcuts

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