messagestore

package
v1.0.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 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"`
	// Seq is the append sequence within the stream. It orders messages that
	// share AddedAt; store.AppendMessages assigns it, callers leave it zero.
	Seq int64 `json:"seq"`
}

type SessionInfo

type SessionInfo struct {
	ID           string
	Identity     string
	Name         string
	MessageCount int
	UpdatedAt    time.Time
}

type Store

type Store interface {
	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

	AppendMessages(ctx context.Context, messages ...*Message) error
	DeleteMessages(ctx context.Context, stream string) error
	DeleteMessage(ctx context.Context, stream string, id 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)
}

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