MCPcopy Index your code

hub / github.com/kenn-io/msgvault / functions

Functions5,225 in github.com/kenn-io/msgvault

↓ 36 callersMethodRunOnce
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 callersMethodUpsertMessageBody
UpsertMessageBody stores the body text and HTML for a message in the separate message_bodies table.
internal/store/messages.go:245
↓ 36 callersFunctionnewWorkerFixture
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 callersFunctionparticipantNameExpr
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 callersMethodEnsureParticipant
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 callersFunctionLoad
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 callersFunctiontestMIME
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 callersMethodAddFrom
AddFrom is shorthand for AddRecipient with type "from".
internal/query/testfixtures_test.go:255
↓ 34 callersMethodClaim
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 callersMethodError
()
internal/microsoft/oauth.go:103
↓ 34 callersFunctionnewBackendForTest
(t *testing.T)
internal/vector/sqlitevec/backend_test.go:18
↓ 34 callersFunctionpadRight
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 callersFunctionrunToolExpectError
runToolExpectError invokes a handler and asserts it returns an error result.
internal/mcp/server_test.go:103
↓ 33 callersMethodEnsureLabel
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 callersMethodCreate
Create inserts the message into the store and returns its internal ID.
internal/testutil/storetest/storetest.go:319
↓ 32 callersFunctionmakeDate
makeDate creates a time.Time for the given month, day in 2024, UTC, zero time.
internal/query/testfixtures_test.go:645
↓ 31 callersMethodEnsureConversationParticipant
EnsureConversationParticipant adds a participant to a conversation. Uses INSERT OR IGNORE to be idempotent.
internal/store/messages.go:1682
↓ 31 callersFunctionresultText
(t *testing.T, r *mcp.CallToolResult)
internal/mcp/server_test.go:84
↓ 30 callersMethodEnsureParticipantByPhone
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 callersMethodNewMessage
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 callersFunctionNewQueue
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 callersFunctionNewServer
NewServer creates a new API server.
internal/api/server.go:98
↓ 30 callersMethodSubAggregate
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 callersFunctionmakeRow
----------------------------------------------------------------------------- Data Factories - create test data with minimal boilerplate -------------
internal/tui/setup_test.go:558
↓ 30 callersFunctionnewMockScheduler
()
internal/api/server_test.go:34
↓ 30 callersFunctionnewRFC822Message
( t *testing.T, f *storetest.Fixture, sourceMessageID, rfc822ID string, )
internal/store/dedup_test.go:15
↓ 29 callersMethodWithLoading
(loading bool)
internal/tui/setup_test.go:177
↓ 29 callersFunctionaddMessage
( t *testing.T, st *store.Store, source *store.Source, srcMsgID, rfc822ID string, fromMe bool, )
internal/dedup/dedup_test.go:18
↓ 29 callersFunctionmsgIDs
msgIDs generates sequential message IDs like "msg0", "msg1", ..., "msg(n-1)".
internal/deletion/executor_test.go:217
↓ 29 callersFunctionsendKey
sendKey sends a key message to the model and returns the updated concrete Model.
internal/tui/setup_test.go:338
↓ 28 callersFunctionNew
New creates a new Scheduler with the given sync callback.
internal/scheduler/scheduler.go:82
↓ 28 callersMethodWithSubject
(s string)
internal/testutil/builders.go:127
↓ 27 callersMethodComplete
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 callersMethodFTS5Available
FTS5Available returns whether FTS5 full-text search is available.
internal/store/store.go:631
↓ 27 callersMethodTo
To sets the To header.
internal/testutil/email/builder.go:53
↓ 27 callersMethodView
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 callersMethodIsPostgreSQL
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 callersFunctionapplyMessageListKey
applyMessageListKey sends a key through handleMessageListKeys and returns the concrete Model.
internal/tui/setup_test.go:639
↓ 26 callersFunctionnewTestServerWithEngine
newTestServerWithEngine creates a test server with both mock store and mock engine.
internal/api/handlers_test.go:951
↓ 25 callersMethodMustListMessages
MustListMessages calls ListMessages and fails the test on error.
internal/query/sqlite_testhelpers_test.go:35
↓ 25 callersMethodTokensDir
TokensDir returns the path to the OAuth tokens directory.
internal/config/config.go:449
↓ 24 callersMethodAs
(target any)
internal/store/sqlite_error_test.go:99
↓ 24 callersMethodFailSync
FailSync marks a sync as failed with an error message.
internal/store/sync.go:378
↓ 24 callersFunctionNewEngine
NewEngine picks the appropriate engine for the given database. isPostgres selects between PostgreSQLQueryDialect (true) and SQLiteQueryDialect (false)
internal/query/postgres.go:51
↓ 24 callersFunctionNewTestDataBuilder
NewTestDataBuilder creates a new typed test data builder.
internal/query/testfixtures_test.go:116
↓ 24 callersMethodUpsertMessageRaw
UpsertMessageRaw stores the compressed raw MIME data for a message.
internal/store/messages.go:261
↓ 24 callersFunctioncountEmbeddingRows
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 callersFunctionimportFixture
(t *testing.T, st *store.Store, rootDir string)
internal/fbmessenger/importer_test.go:20
↓ 24 callersFunctionnewFusedBackendForTest
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 callersMethodBeginTx
(ctx context.Context, opts *sql.TxOptions)
internal/vector/pgvector/migrate.go:22
↓ 23 callersFunctionEnsureUTF8
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 callersMethodGetGmailIDsByFilter
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 callersMethodaddTable
addTable adds a table definition to be written as Parquet.
internal/query/testfixtures_test.go:501
↓ 22 callersMethodAddSource
AddSource adds a source and returns its ID.
internal/query/testfixtures_test.go:129
↓ 22 callersMethodAssertLabelCount
--- Assertion helpers --- AssertLabelCount asserts the number of labels attached to a message.
internal/testutil/storetest/storetest.go:162
↓ 22 callersFunctionConfigureSQLLogging
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 callersMethodUpdateSyncCheckpoint
UpdateSyncCheckpoint saves progress for resumption.
internal/store/sync.go:269
↓ 22 callersFunctionapplyModalKey
applyModalKey sends a key through handleModalKeys and returns the concrete Model and Cmd.
internal/tui/setup_test.go:653
↓ 22 callersFunctionnewIdentityCLITest
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 callersFunctionrunStartupMigrations
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 callersMethodGetMessage
(ctx context.Context, id int64)
internal/query/engine.go:27
↓ 21 callersFunctionSanitizeTerminal
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 callersMethodSearch
Search - full-text search using FTS5 (includes message body)
internal/query/engine.go:45
↓ 21 callersFunctioncloneBytes
(b []byte)
internal/testutil/encoding.go:105
↓ 21 callersFunctionwriteJSON
writeJSON writes a JSON response.
internal/api/handlers.go:213
↓ 20 callersMethodAddMessageLabel
AddMessageLabel associates a message with a label.
internal/query/testfixtures_test.go:270
↓ 20 callersMethodBuildEngine
BuildEngine generates Parquet files and returns a DuckDBEngine. Cleanup is registered via t.Cleanup.
internal/query/testfixtures_test.go:464
↓ 20 callersFunctionCopySubset
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 callersMethodFatal
(args ...any)
internal/testutil/tbmock/mock_tb.go:40
↓ 20 callersFunctionImportEmlxDir
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 callersFunctionNewClient
NewClient constructs a Client, applying defaults for Timeout and MaxRetries.
internal/vector/embed/client.go:54
↓ 19 callersMethodAddAccount
(email, schedule string)
internal/api/server.go:53
↓ 19 callersFunctionDecodeMojibake
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 callersFunctionImportDYI
ImportDYI imports a Facebook Messenger DYI export into the store.
internal/fbmessenger/importer.go:93
↓ 19 callersMethodLinkMessageLabel
LinkMessageLabel links a single label to a message. Uses INSERT OR IGNORE — safe to call multiple times.
internal/store/messages.go:753
↓ 19 callersFunctionNewDefaultConfig
NewDefaultConfig returns a configuration with default values.
internal/config/config.go:255
↓ 19 callersFunctionNewEngine
NewEngine creates a new dedup engine.
internal/dedup/dedup.go:156
↓ 19 callersFunctionNewEngine
NewEngine wires a backend, main DB handle, embedding client, and configuration into an Engine.
internal/vector/hybrid/engine.go:80
↓ 19 callersFunctionNewManager
NewManager creates a deletion manager.
internal/deletion/manifest.go:221
↓ 19 callersFunctionOpen
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 callersMethodRead
(p []byte)
internal/mbox/reader.go:40
↓ 19 callersMethodSetHistory
SetHistory configures mock history records and the target history ID for incremental sync tests.
internal/sync/testenv_test.go:83
↓ 19 callersMethodUpsertAttachment
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 callersMethodaddMessage
(gmailID string, sourceID, convID int64)
internal/store/attachment_e2e_test.go:51
↓ 19 callersFunctionemptyTargets
emptyTargets creates an EmptyValueTargets map for testing with the given ViewType(s).
internal/query/sqlite_crud_test.go:15
↓ 19 callersMethodsaveToken
(email string, token *oauth2.Token, scopes []string, tenantID string)
internal/microsoft/oauth.go:607
↓ 19 callersFunctionseedAndEmbed
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 callersMethodvisibleRows
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 callersMethodAddTo
AddTo is shorthand for AddRecipient with type "to".
internal/query/testfixtures_test.go:260
↓ 18 callersFunctionBuildFilter
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 callersFunctionChunkText
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 callersMethodEmbed
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 callersMethodGetSourceByIdentifier
GetSourceByIdentifier returns a source by its identifier (email address).
internal/store/sync.go:724
↓ 18 callersFunctionImportMbox
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 callersMethodMatchesEmpty
MatchesEmpty returns true if the given ViewType is in EmptyValueTargets.
internal/query/models.go:260
↓ 18 callersMethodRetireGeneration
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 callersMethodWithSourceMessageID
(id string)
internal/testutil/builders.go:180
↓ 18 callersMethodaddAttachment
(gmailID, filename, hash string)
internal/store/attachment_e2e_test.go:65
↓ 18 callersFunctionassertMessageCount
assertMessageCount checks the message count in the store.
internal/sync/testenv_test.go:180
↓ 18 callersMethoddirForStatus
dirForStatus returns the directory path for a given status. Uses explicit mapping to decouple Status values from directory names.
internal/deletion/manifest.go:235
← previousnext →101–200 of 5,225, ranked by callers