db

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDirPath  string
	DatabaseName string
}

type Message

type Message struct {
	ID        string `db:"id"`
	Role      string `db:"m_role"`
	Content   string `db:"content"`
	CreatedAt string `db:"created_at"`
	ThreadID  string `db:"thread_id"`
}

Message represents a chat message which is part of a thread

type Store

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

func New

func New(config Config, schemaInit, migrations *string) (*Store, error)

func (*Store) Begin

func (s *Store) Begin() (*sqlx.Tx, error)

func (*Store) CreateMessage

func (s *Store) CreateMessage(message *Message) error

func (*Store) CreateMessageTx

func (s *Store) CreateMessageTx(tx *sqlx.Tx, message *Message) error

func (*Store) CreateThreadTx

func (s *Store) CreateThreadTx(tx *sqlx.Tx, thread *Thread) error

func (*Store) DeleteAllThreads

func (s *Store) DeleteAllThreads() error

func (*Store) DeleteAllThreadsTx

func (s *Store) DeleteAllThreadsTx(tx *sqlx.Tx) error

func (*Store) DeleteThread

func (s *Store) DeleteThread(id string) error

func (*Store) DeleteThreadTx

func (s *Store) DeleteThreadTx(tx *sqlx.Tx, threadID string) error

func (*Store) ListLatestThreadsPaginated

func (s *Store) ListLatestThreadsPaginated(offset, limit int) ([]*Thread, error)

func (*Store) ListMessagesByThreadIDPaginated

func (s *Store) ListMessagesByThreadIDPaginated(threadID string, offset, limit int) ([]*Message, error)

func (*Store) SearchMessageContentPaginated

func (s *Store) SearchMessageContentPaginated(term string, offset, limit int) ([]*Message, error)

func (*Store) SearchThreadNamesPaginated

func (s *Store) SearchThreadNamesPaginated(term string, offset, limit int) ([]*Thread, error)

func (*Store) UpdateThreadNameTx

func (s *Store) UpdateThreadNameTx(tx *sqlx.Tx, threadID, name string) error

func (*Store) UpsertThread

func (s *Store) UpsertThread(thread *Thread) error

func (*Store) UpsertThreadTx

func (s *Store) UpsertThreadTx(tx *sqlx.Tx, thread *Thread) error

type Thread

type Thread struct {
	ID                   string `db:"id"`
	Name                 string `db:"t_name"`
	CreatedAt            string `db:"created_at"`
	UpdatedAt            string `db:"updated_at"`
	ExternalMessageStore bool   `db:"external_message_store"`
}

Thread represents a chat thread that contains messages

Jump to

Keyboard shortcuts

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