messagestore

package
v0.28.6 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Message

type Message struct {
	ID      string    `json:"id"`
	IDX     string    `json:"idx_id"`
	Payload []byte    `json:"payload"`
	AddedAt time.Time `json:"added_at"`
}

Message represents a stored message.

type SessionInfo

type SessionInfo struct {
	ID       string
	Identity string
	Name     string // empty if unnamed
}

SessionInfo represents a chat session index row.

type Store

type Store interface {
	// Index operations
	CreateMessageIndex(ctx context.Context, id string, identity string) error
	CreateNamedMessageIndex(ctx context.Context, id string, identity string, name string) error
	DeleteMessageIndex(ctx context.Context, id string, identity string) error
	ListMessageStreams(ctx context.Context, identity string) ([]string, error)
	ListMessageIndices(ctx context.Context, identity string) ([]string, error)
	ListAllSessions(ctx context.Context, identity string) ([]SessionInfo, error)
	GetSessionByName(ctx context.Context, identity string, name string) (*SessionInfo, error)
	RenameSession(ctx context.Context, id string, name string) error

	// Message operations
	AppendMessages(ctx context.Context, messages ...*Message) error
	DeleteMessages(ctx context.Context, stream string) error
	ListMessages(ctx context.Context, stream string) ([]*Message, error)
	LastMessage(ctx context.Context, stream string) (*Message, error)
	CountMessages(ctx context.Context, stream string) (int, error)
}

Store defines the data access interface for messages.

func New

func New(exec libdbexec.Exec, workspaceID string) Store

Jump to

Keyboard shortcuts

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