messagestore

package
v0.28.9 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

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