Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/kenn-io/msgvault
/ functions
Functions
5,225 in github.com/kenn-io/msgvault
⨍
Functions
5,225
◇
Types & classes
632
↓ 36 callers
Method
RunOnce
RunOnce drains the queue for the given generation until empty, releasing claimed rows on embed or upsert error so another worker can retry them. Retur
internal/vector/embed/worker.go:251
↓ 36 callers
Method
UpsertMessageBody
UpsertMessageBody stores the body text and HTML for a message in the separate message_bodies table.
internal/store/messages.go:245
↓ 36 callers
Function
newWorkerFixture
newWorkerFixture creates a main DB with n messages (subject="msg N", body="body N"), opens a real sqlitevec backend, creates a building generation (se
internal/vector/embed/testsupport_test.go:70
↓ 36 callers
Function
participantNameExpr
participantNameExpr returns the SQL expression for a participant's display label, falling back through display_name → phone_number → email_address. Us
internal/query/shared.go:40
↓ 35 callers
Method
EnsureParticipant
EnsureParticipant gets or creates a participant by email. Atomic via INSERT … ON CONFLICT … RETURNING id so two goroutines (or two processes against P
internal/store/messages.go:362
↓ 35 callers
Function
Load
Load reads the configuration from the specified file. If path is empty, uses the default location (~/.msgvault/config.toml), which is optional (missin
internal/config/config.go:288
↓ 35 callers
Function
testMIME
testMIME returns a simple plain-text MIME message for testing. Returns a fresh byte slice on each call to prevent cross-test mutation.
internal/sync/fixtures_test.go:7
↓ 34 callers
Method
AddFrom
AddFrom is shorthand for AddRecipient with type "from".
internal/query/testfixtures_test.go:255
↓ 34 callers
Method
Claim
Claim marks up to batch pending rows for gen as claimed by a fresh token, returning the message IDs in ascending order alongside the token to present
internal/vector/embed/queue.go:53
↓ 34 callers
Method
Error
()
internal/microsoft/oauth.go:103
↓ 34 callers
Function
newBackendForTest
(t *testing.T)
internal/vector/sqlitevec/backend_test.go:18
↓ 34 callers
Function
padRight
padRight pads a string with spaces to fill width terminal cells. Uses lipgloss.Width to correctly handle ANSI codes and full-width characters.
internal/tui/format.go:145
↓ 34 callers
Function
runToolExpectError
runToolExpectError invokes a handler and asserts it returns an error result.
internal/mcp/server_test.go:103
↓ 33 callers
Method
EnsureLabel
EnsureLabel gets or creates a label, handling renames and ID changes. For batch operations prefer EnsureLabelsBatch which runs in a single transaction
internal/store/messages.go:487
↓ 32 callers
Method
Create
Create inserts the message into the store and returns its internal ID.
internal/testutil/storetest/storetest.go:319
↓ 32 callers
Function
makeDate
makeDate creates a time.Time for the given month, day in 2024, UTC, zero time.
internal/query/testfixtures_test.go:645
↓ 31 callers
Method
EnsureConversationParticipant
EnsureConversationParticipant adds a participant to a conversation. Uses INSERT OR IGNORE to be idempotent.
internal/store/messages.go:1682
↓ 31 callers
Function
resultText
(t *testing.T, r *mcp.CallToolResult)
internal/mcp/server_test.go:84
↓ 30 callers
Method
EnsureParticipantByPhone
EnsureParticipantByPhone gets or creates a participant by phone number. Phone must start with "+" (E.164 format). Returns an error for empty or invali
internal/store/messages.go:1254
↓ 30 callers
Method
NewMessage
NewMessage creates a builder using the fixture's per-test counter for deterministic SourceMessageID values (fixture-msg-1, fixture-msg-2, ...). Uses a
internal/testutil/storetest/storetest.go:253
↓ 30 callers
Function
NewQueue
NewQueue returns a Queue bound to db. The caller retains ownership of db; Queue does not close it. rebind translates ?-placeholders to the driver's na
internal/vector/embed/queue.go:39
↓ 30 callers
Function
NewServer
NewServer creates a new API server.
internal/api/server.go:98
↓ 30 callers
Method
SubAggregate
SubAggregate performs aggregation on a filtered subset of messages. This is used for sub-grouping after drill-down, e.g., drilling into "Sender: foo@e
internal/query/engine.go:23
↓ 30 callers
Function
makeRow
----------------------------------------------------------------------------- Data Factories - create test data with minimal boilerplate -------------
internal/tui/setup_test.go:558
↓ 30 callers
Function
newMockScheduler
()
internal/api/server_test.go:34
↓ 30 callers
Function
newRFC822Message
( t *testing.T, f *storetest.Fixture, sourceMessageID, rfc822ID string, )
internal/store/dedup_test.go:15
↓ 29 callers
Method
WithLoading
(loading bool)
internal/tui/setup_test.go:177
↓ 29 callers
Function
addMessage
( t *testing.T, st *store.Store, source *store.Source, srcMsgID, rfc822ID string, fromMe bool, )
internal/dedup/dedup_test.go:18
↓ 29 callers
Function
msgIDs
msgIDs generates sequential message IDs like "msg0", "msg1", ..., "msg(n-1)".
internal/deletion/executor_test.go:217
↓ 29 callers
Function
sendKey
sendKey sends a key message to the model and returns the updated concrete Model.
internal/tui/setup_test.go:338
↓ 28 callers
Function
New
New creates a new Scheduler with the given sync callback.
internal/scheduler/scheduler.go:82
↓ 28 callers
Method
WithSubject
(s string)
internal/testutil/builders.go:127
↓ 27 callers
Method
Complete
Complete deletes the claimed rows from the queue. Only rows whose claim_token matches token are removed; any row that was reclaimed or re-claimed unde
internal/vector/embed/queue.go:159
↓ 27 callers
Method
FTS5Available
FTS5Available returns whether FTS5 full-text search is available.
internal/store/store.go:631
↓ 27 callers
Method
To
To sets the To header.
internal/testutil/email/builder.go:53
↓ 27 callers
Method
View
ensureCursorVisible adjusts scroll offset to keep cursor in view. pushBreadcrumb saves the current view state to the navigation history. navigateList
internal/tui/model.go:1501
↓ 26 callers
Method
IsPostgreSQL
IsPostgreSQL reports whether this store is backed by PostgreSQL. Engine factories use this to choose between the SQLite and PostgreSQL query paths.
internal/store/store.go:380
↓ 26 callers
Function
applyMessageListKey
applyMessageListKey sends a key through handleMessageListKeys and returns the concrete Model.
internal/tui/setup_test.go:639
↓ 26 callers
Function
newTestServerWithEngine
newTestServerWithEngine creates a test server with both mock store and mock engine.
internal/api/handlers_test.go:951
↓ 25 callers
Method
MustListMessages
MustListMessages calls ListMessages and fails the test on error.
internal/query/sqlite_testhelpers_test.go:35
↓ 25 callers
Method
TokensDir
TokensDir returns the path to the OAuth tokens directory.
internal/config/config.go:449
↓ 24 callers
Method
As
(target any)
internal/store/sqlite_error_test.go:99
↓ 24 callers
Method
FailSync
FailSync marks a sync as failed with an error message.
internal/store/sync.go:378
↓ 24 callers
Function
NewEngine
NewEngine picks the appropriate engine for the given database. isPostgres selects between PostgreSQLQueryDialect (true) and SQLiteQueryDialect (false)
internal/query/postgres.go:51
↓ 24 callers
Function
NewTestDataBuilder
NewTestDataBuilder creates a new typed test data builder.
internal/query/testfixtures_test.go:116
↓ 24 callers
Method
UpsertMessageRaw
UpsertMessageRaw stores the compressed raw MIME data for a message.
internal/store/messages.go:261
↓ 24 callers
Function
countEmbeddingRows
countEmbeddingRows returns the number of embedding rows belonging to a generation. Used by the delete-on-retire tests to assert that a retired generat
internal/vector/pgvector/backend_retire_test.go:17
↓ 24 callers
Function
importFixture
(t *testing.T, st *store.Store, rootDir string)
internal/fbmessenger/importer_test.go:20
↓ 24 callers
Function
newFusedBackendForTest
newFusedBackendForTest opens a backend pointing at a main DB seeded with FTS content and the minimum schema FusedSearch needs.
internal/vector/sqlitevec/backend_testhelpers_test.go:137
↓ 23 callers
Method
BeginTx
(ctx context.Context, opts *sql.TxOptions)
internal/vector/pgvector/migrate.go:22
↓ 23 callers
Function
EnsureUTF8
EnsureUTF8 ensures a string is valid UTF-8. If already valid UTF-8, returns as-is. Otherwise attempts charset detection and conversion. Falls back to
internal/textutil/encoding.go:21
↓ 23 callers
Method
GetGmailIDsByFilter
GetGmailIDsByFilter returns Gmail message IDs (source_message_id) matching a filter. This is useful for batch operations like staging messages for del
internal/query/engine.go:70
↓ 23 callers
Method
addTable
addTable adds a table definition to be written as Parquet.
internal/query/testfixtures_test.go:501
↓ 22 callers
Method
AddSource
AddSource adds a source and returns its ID.
internal/query/testfixtures_test.go:129
↓ 22 callers
Method
AssertLabelCount
--- Assertion helpers --- AssertLabelCount asserts the number of labels attached to a message.
internal/testutil/storetest/storetest.go:162
↓ 22 callers
Function
ConfigureSQLLogging
ConfigureSQLLogging sets the process-wide SQL logging behaviour. Call this after slog.SetDefault but before opening a Store.
internal/store/db_logger.go:51
↓ 22 callers
Method
UpdateSyncCheckpoint
UpdateSyncCheckpoint saves progress for resumption.
internal/store/sync.go:269
↓ 22 callers
Function
applyModalKey
applyModalKey sends a key through handleModalKeys and returns the concrete Model and Cmd.
internal/tui/setup_test.go:653
↓ 22 callers
Function
newIdentityCLITest
newIdentityCLITest creates an isolated store and test root command for identity subcommand tests. Returns (store, root, stdout buffer, stderr buffer)
cmd/msgvault/cmd/identity_test.go:19
↓ 22 callers
Function
runStartupMigrations
runStartupMigrations pulls legacy identity addresses from the global config and runs the one-time migration. If migration was performed, the notice is
cmd/msgvault/cmd/store_resolver.go:22
↓ 21 callers
Method
GetMessage
(ctx context.Context, id int64)
internal/query/engine.go:27
↓ 21 callers
Function
SanitizeTerminal
SanitizeTerminal strips ANSI escape sequences and C0/C1 control characters from a string, preventing terminal injection via untrusted data (e.g., What
internal/textutil/encoding.go:160
↓ 21 callers
Method
Search
Search - full-text search using FTS5 (includes message body)
internal/query/engine.go:45
↓ 21 callers
Function
cloneBytes
(b []byte)
internal/testutil/encoding.go:105
↓ 21 callers
Function
writeJSON
writeJSON writes a JSON response.
internal/api/handlers.go:213
↓ 20 callers
Method
AddMessageLabel
AddMessageLabel associates a message with a label.
internal/query/testfixtures_test.go:270
↓ 20 callers
Method
BuildEngine
BuildEngine generates Parquet files and returns a DuckDBEngine. Cleanup is registered via t.Cleanup.
internal/query/testfixtures_test.go:464
↓ 20 callers
Function
CopySubset
CopySubset copies rowCount most recent messages (and all referenced data) from srcDBPath into a new database in dstDir. The destination schema is init
internal/store/subset.go:31
↓ 20 callers
Method
Fatal
(args ...any)
internal/testutil/tbmock/mock_tb.go:40
↓ 20 callers
Function
ImportEmlxDir
128 MiB ImportEmlxDir imports .emlx files from an Apple Mail directory tree. Messages are deduplicated by content hash (sha256 of raw MIME). When the
internal/importer/emlx_import.go:88
↓ 20 callers
Function
NewClient
NewClient constructs a Client, applying defaults for Timeout and MaxRetries.
internal/vector/embed/client.go:54
↓ 19 callers
Method
AddAccount
(email, schedule string)
internal/api/server.go:53
↓ 19 callers
Function
DecodeMojibake
DecodeMojibake reverses Facebook DYI JSON's well-known Latin-1-over-UTF-8 encoding. Facebook's JSON exporter writes UTF-8 bytes as if they were Latin-
internal/fbmessenger/slug.go:74
↓ 19 callers
Function
ImportDYI
ImportDYI imports a Facebook Messenger DYI export into the store.
internal/fbmessenger/importer.go:93
↓ 19 callers
Method
LinkMessageLabel
LinkMessageLabel links a single label to a message. Uses INSERT OR IGNORE — safe to call multiple times.
internal/store/messages.go:753
↓ 19 callers
Function
NewDefaultConfig
NewDefaultConfig returns a configuration with default values.
internal/config/config.go:255
↓ 19 callers
Function
NewEngine
NewEngine creates a new dedup engine.
internal/dedup/dedup.go:156
↓ 19 callers
Function
NewEngine
NewEngine wires a backend, main DB handle, embedding client, and configuration into an Engine.
internal/vector/hybrid/engine.go:80
↓ 19 callers
Function
NewManager
NewManager creates a deletion manager.
internal/deletion/manifest.go:221
↓ 19 callers
Function
Open
Open opens vectors.db, runs migrations, and retains the main database handle for seed queries. Caller must call Close.
internal/vector/sqlitevec/backend.go:49
↓ 19 callers
Method
Read
(p []byte)
internal/mbox/reader.go:40
↓ 19 callers
Method
SetHistory
SetHistory configures mock history records and the target history ID for incremental sync tests.
internal/sync/testenv_test.go:83
↓ 19 callers
Method
UpsertAttachment
UpsertAttachment stores an attachment record. Idempotency for the common case is enforced by the partial unique index idx_attachments_msg_content_hash
internal/store/messages.go:1792
↓ 19 callers
Method
addMessage
(gmailID string, sourceID, convID int64)
internal/store/attachment_e2e_test.go:51
↓ 19 callers
Function
emptyTargets
emptyTargets creates an EmptyValueTargets map for testing with the given ViewType(s).
internal/query/sqlite_crud_test.go:15
↓ 19 callers
Method
saveToken
(email string, token *oauth2.Token, scopes []string, tenantID string)
internal/microsoft/oauth.go:607
↓ 19 callers
Function
seedAndEmbed
seedAndEmbed inserts any missing message rows into the main DB, creates a fresh generation sized to the first vector, and upserts all supplied vectors
internal/vector/sqlitevec/backend_testhelpers_test.go:156
↓ 19 callers
Method
visibleRows
visibleRows returns the number of data rows visible in the viewport. Views reserve one row for the info/notification line, so this is pageSize-1.
internal/tui/navigation.go:89
↓ 18 callers
Method
AddTo
AddTo is shorthand for AddRecipient with type "to".
internal/query/testfixtures_test.go:260
↓ 18 callers
Function
BuildFilter
BuildFilter translates a parsed Gmail-syntax query into a vector.Filter by resolving address/label tokens to IDs against the main DB. Matches the sema
internal/vector/hybrid/filter.go:37
↓ 18 callers
Function
ChunkText
ChunkText splits text into windows of at most maxRunes runes each, overlapping by overlapRunes runes between consecutive windows. The goal is twofold:
internal/vector/embed/chunk.go:61
↓ 18 callers
Method
Embed
Embed returns one vector per input, in input order. Empty input is a no-op and returns (nil, nil) without making an HTTP call. Every returned vector i
internal/vector/embed/client.go:86
↓ 18 callers
Method
GetSourceByIdentifier
GetSourceByIdentifier returns a source by its identifier (email address).
internal/store/sync.go:724
↓ 18 callers
Function
ImportMbox
ImportMbox imports a single MBOX file into the msgvault database. This is intended for services like HEY.com that provide an export in MBOX format bu
internal/importer/mbox_import.go:88
↓ 18 callers
Method
MatchesEmpty
MatchesEmpty returns true if the given ViewType is in EmptyValueTargets.
internal/query/models.go:260
↓ 18 callers
Method
RetireGeneration
RetireGeneration marks gen as retired, deleting its embeddings on backends that share an index graph (pgvector) and reaping its pending queue rows. Un
internal/vector/backend.go:161
↓ 18 callers
Method
WithSourceMessageID
(id string)
internal/testutil/builders.go:180
↓ 18 callers
Method
addAttachment
(gmailID, filename, hash string)
internal/store/attachment_e2e_test.go:65
↓ 18 callers
Function
assertMessageCount
assertMessageCount checks the message count in the store.
internal/sync/testenv_test.go:180
↓ 18 callers
Method
dirForStatus
dirForStatus returns the directory path for a given status. Uses explicit mapping to decouple Status values from directory names.
internal/deletion/manifest.go:235
← previous
next →
101–200 of 5,225, ranked by callers