Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeEmbeddingVector(blob []byte) ([]float32, error)
- func DefaultEmbedLimit() int
- func EncodeEmbeddingVector(values []float32) ([]byte, error)
- func IsReadOnlySQL(query string) bool
- type AttachmentListOptions
- type AttachmentMediaUpdate
- type AttachmentRecord
- type AttachmentRow
- type ChannelRecord
- type ChannelRow
- type DirectMessageConversationOptions
- type DirectMessageConversationRow
- type EmbeddingDrainOptions
- type EmbeddingDrainStats
- type GuildRecord
- type MemberProfile
- type MemberRecord
- type MemberRow
- type MentionEventRecord
- type MentionListOptions
- type MentionRow
- type MessageListOptions
- type MessageMutation
- type MessageRecord
- type MessageRow
- type SearchOptions
- type SearchResult
- type SemanticSearchOptions
- type Status
- type Store
- func (s *Store) AppendMessageEvent(ctx context.Context, guildID, channelID, messageID, eventType string, ...) error
- func (s *Store) ChannelMessageBounds(ctx context.Context, channelID string) (string, string, error)
- func (s *Store) Channels(ctx context.Context, guildID string) ([]ChannelRow, error)
- func (s *Store) CheckMessageFTS(ctx context.Context) error
- func (s *Store) Close() error
- func (s *Store) DB() *sql.DB
- func (s *Store) DeleteGuildData(ctx context.Context, guildID string) error
- func (s *Store) DeleteMember(ctx context.Context, guildID, userID string) error
- func (s *Store) DeleteOrphanChannels(ctx context.Context, guildID string) error
- func (s *Store) DeleteSyncState(ctx context.Context, scope string) error
- func (s *Store) DirectMessageConversations(ctx context.Context, opts DirectMessageConversationOptions) ([]DirectMessageConversationRow, error)
- func (s *Store) DrainEmbeddingJobs(ctx context.Context, provider embed.Provider, opts EmbeddingDrainOptions) (EmbeddingDrainStats, error)
- func (s *Store) EmbeddingBacklog(ctx context.Context) (int, error)
- func (s *Store) Exec(ctx context.Context, query string) (int64, error)
- func (s *Store) ExpandAttachmentChannelIDs(ctx context.Context, channelIDs []string) ([]string, error)
- func (s *Store) GetSyncState(ctx context.Context, scope string) (string, error)
- func (s *Store) GuildChannelCount(ctx context.Context, guildID string) (int, error)
- func (s *Store) GuildMemberCount(ctx context.Context, guildID string) (int, error)
- func (s *Store) HasMessageEmbeddings(ctx context.Context, provider, model, inputVersion string) (bool, error)
- func (s *Store) IncompleteMessageChannelIDs(ctx context.Context, guildID string) ([]string, error)
- func (s *Store) ListAttachments(ctx context.Context, opts AttachmentListOptions) ([]AttachmentRow, error)
- func (s *Store) ListMentions(ctx context.Context, opts MentionListOptions) ([]MentionRow, error)
- func (s *Store) ListMessages(ctx context.Context, opts MessageListOptions) ([]MessageRow, error)
- func (s *Store) ListMessagesWithThreadContext(ctx context.Context, opts MessageListOptions) ([]MessageRow, error)
- func (s *Store) MarkMessageDeleted(ctx context.Context, guildID, channelID, messageID string, payload any) error
- func (s *Store) MemberByID(ctx context.Context, userID string) ([]MemberRow, error)
- func (s *Store) MemberProfile(ctx context.Context, guildID, userID string, recentLimit int) (MemberProfile, error)
- func (s *Store) Members(ctx context.Context, guildID, query string, limit int) ([]MemberRow, error)
- func (s *Store) Query(ctx context.Context, query string) ([]string, [][]string, error)
- func (s *Store) ReadOnlyQuery(ctx context.Context, query string) ([]string, [][]string, error)
- func (s *Store) RebuildMemberSearchIndex(ctx context.Context) error
- func (s *Store) RebuildMessageSearchIndex(ctx context.Context) error
- func (s *Store) RebuildSearchIndexes(ctx context.Context) error
- func (s *Store) ReplaceMembers(ctx context.Context, guildID string, members []MemberRecord) error
- func (s *Store) RequeueAllEmbeddingJobs(ctx context.Context, opts EmbeddingDrainOptions) (int, error)
- func (s *Store) SearchMessages(ctx context.Context, opts SearchOptions) ([]SearchResult, error)
- func (s *Store) SearchMessagesHybrid(ctx context.Context, opts SearchOptions, semanticOpts SemanticSearchOptions) ([]SearchResult, error)
- func (s *Store) SearchMessagesSemantic(ctx context.Context, opts SemanticSearchOptions) ([]SearchResult, error)
- func (s *Store) SetSyncState(ctx context.Context, scope, cursor string) error
- func (s *Store) Status(ctx context.Context, dbPath, defaultGuildID string) (Status, error)
- func (s *Store) UpdateAttachmentFetchStatus(ctx context.Context, attachmentID, fetchedAt, status, message string) error
- func (s *Store) UpdateAttachmentMedia(ctx context.Context, update AttachmentMediaUpdate) error
- func (s *Store) UpsertChannel(ctx context.Context, channel ChannelRecord) error
- func (s *Store) UpsertGuild(ctx context.Context, guild GuildRecord) error
- func (s *Store) UpsertMember(ctx context.Context, member MemberRecord) error
- func (s *Store) UpsertMessage(ctx context.Context, message MessageRecord) error
- func (s *Store) UpsertMessageWithOptions(ctx context.Context, message MessageRecord, opts WriteOptions) error
- func (s *Store) UpsertMessages(ctx context.Context, messages []MessageMutation) error
- type WriteOptions
Constants ¶
View Source
const DirectMessageGuildID = "@me"
View Source
const (
EmbeddingInputVersion = "message_normalized_v1"
)
Variables ¶
View Source
var ErrNoCompatibleEmbeddings = errors.New("no compatible message embeddings for provider/model/input version; run discrawl embed --rebuild")
View Source
var ErrSchemaVersionMismatch = errors.New("database schema version mismatch")
Functions ¶
func DecodeEmbeddingVector ¶
func DefaultEmbedLimit ¶
func DefaultEmbedLimit() int
func EncodeEmbeddingVector ¶
func IsReadOnlySQL ¶
Types ¶
type AttachmentListOptions ¶ added in v0.8.0
type AttachmentMediaUpdate ¶ added in v0.8.0
type AttachmentRecord ¶
type AttachmentRecord struct {
AttachmentID string
MessageID string
GuildID string
ChannelID string
AuthorID string
Filename string
ContentType string
Size int64
URL string
ProxyURL string
TextContent string
MediaPath string
ContentSHA256 string
ContentSize int64
FetchedAt string
FetchStatus string
FetchError string
}
type AttachmentRow ¶ added in v0.8.0
type AttachmentRow struct {
AttachmentID string `json:"attachment_id"`
MessageID string `json:"message_id"`
GuildID string `json:"guild_id"`
GuildName string `json:"guild_name,omitempty"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
AuthorID string `json:"author_id"`
AuthorName string `json:"author_name"`
Filename string `json:"filename"`
ContentType string `json:"content_type,omitempty"`
Size int64 `json:"size"`
URL string `json:"url,omitempty"`
ProxyURL string `json:"proxy_url,omitempty"`
TextContent string `json:"text_content,omitempty"`
MediaPath string `json:"media_path,omitempty"`
ContentSHA256 string `json:"content_sha256,omitempty"`
ContentSize int64 `json:"content_size,omitempty"`
FetchedAt time.Time `json:"fetched_at,omitzero"`
FetchStatus string `json:"fetch_status,omitempty"`
FetchError string `json:"fetch_error,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type ChannelRecord ¶
type ChannelRow ¶
type ChannelRow struct {
ID string `json:"id"`
GuildID string `json:"guild_id"`
ParentID string `json:"parent_id,omitempty"`
Kind string `json:"kind"`
Name string `json:"name"`
Topic string `json:"topic,omitempty"`
Position int `json:"position"`
IsNSFW bool `json:"is_nsfw"`
IsArchived bool `json:"is_archived"`
IsLocked bool `json:"is_locked"`
IsPrivateThread bool `json:"is_private_thread"`
ThreadParentID string `json:"thread_parent_id,omitempty"`
ArchiveTimestamp time.Time `json:"archive_timestamp,omitzero"`
}
type DirectMessageConversationRow ¶
type DirectMessageConversationRow struct {
ChannelID string `json:"channel_id"`
Name string `json:"name"`
MessageCount int `json:"message_count"`
AuthorCount int `json:"author_count"`
FirstMessageAt time.Time `json:"first_message_at,omitzero"`
LastMessageAt time.Time `json:"last_message_at,omitzero"`
}
type EmbeddingDrainOptions ¶
type EmbeddingDrainStats ¶
type EmbeddingDrainStats struct {
Processed int `json:"processed"`
Succeeded int `json:"succeeded"`
Failed int `json:"failed"`
Skipped int `json:"skipped"`
Requeued int `json:"requeued,omitempty"`
RemainingBacklog int `json:"remaining_backlog"`
Provider string `json:"provider"`
Model string `json:"model"`
InputVersion string `json:"input_version"`
RateLimited bool `json:"rate_limited,omitempty"`
}
type MemberProfile ¶
type MemberProfile struct {
Member MemberRow `json:"member"`
RawJSON string `json:"raw_json,omitempty"`
MessageCount int `json:"message_count"`
FirstMessageAt time.Time `json:"first_message_at,omitzero"`
LastMessageAt time.Time `json:"last_message_at,omitzero"`
RecentMessages []MessageRow `json:"recent_messages,omitempty"`
}
type MemberRecord ¶
type MemberRow ¶
type MemberRow struct {
GuildID string `json:"guild_id"`
UserID string `json:"user_id"`
Username string `json:"username"`
GlobalName string `json:"global_name,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Nick string `json:"nick,omitempty"`
Discriminator string `json:"discriminator,omitempty"`
Avatar string `json:"avatar,omitempty"`
RoleIDsJSON string `json:"role_ids_json"`
Bot bool `json:"bot"`
JoinedAt time.Time `json:"joined_at,omitzero"`
Bio string `json:"bio,omitempty"`
Pronouns string `json:"pronouns,omitempty"`
Location string `json:"location,omitempty"`
Website string `json:"website,omitempty"`
XHandle string `json:"x_handle,omitempty"`
GitHubLogin string `json:"github_login,omitempty"`
URLs []string `json:"urls,omitempty"`
RawJSON string `json:"-"`
}
type MentionEventRecord ¶
type MentionListOptions ¶
type MentionRow ¶
type MentionRow struct {
MessageID string `json:"message_id"`
GuildID string `json:"guild_id"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
AuthorID string `json:"author_id"`
AuthorName string `json:"author_name"`
TargetType string `json:"target_type"`
TargetID string `json:"target_id"`
TargetName string `json:"target_name"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
}
type MessageListOptions ¶
type MessageMutation ¶
type MessageMutation struct {
Record MessageRecord
EventType string
PayloadJSON string
Options WriteOptions
Attachments []AttachmentRecord
Mentions []MentionEventRecord
}
type MessageRecord ¶
type MessageRecord struct {
ID string
GuildID string
ChannelID string
ChannelName string
AuthorID string
AuthorName string
MessageType int
CreatedAt string
EditedAt string
DeletedAt string
Content string
NormalizedContent string
ReplyToMessageID string
Pinned bool
HasAttachments bool
RawJSON string
}
type MessageRow ¶
type MessageRow struct {
MessageID string `json:"message_id"`
GuildID string `json:"guild_id"`
GuildName string `json:"guild_name,omitempty"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
AuthorID string `json:"author_id"`
AuthorName string `json:"author_name"`
Content string `json:"content"`
DisplayContent string `json:"display_content,omitempty"`
CreatedAt time.Time `json:"created_at"`
ReplyToMessage string `json:"reply_to_message_id,omitempty"`
Source string `json:"source,omitempty"`
HasAttachments bool `json:"has_attachments"`
AttachmentNames string `json:"attachment_names,omitempty"`
AttachmentText string `json:"attachment_text,omitempty"`
Pinned bool `json:"pinned"`
}
type SearchOptions ¶
type SearchResult ¶
type SearchResult struct {
MessageID string `json:"message_id"`
GuildID string `json:"guild_id"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
AuthorID string `json:"author_id"`
AuthorName string `json:"author_name"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
}
type SemanticSearchOptions ¶
type Status ¶
type Status struct {
DBPath string `json:"db_path"`
GuildCount int `json:"guild_count"`
ChannelCount int `json:"channel_count"`
ThreadCount int `json:"thread_count"`
MessageCount int `json:"message_count"`
MemberCount int `json:"member_count"`
EmbeddingBacklog int `json:"embedding_backlog"`
LastSyncAt time.Time `json:"last_sync_at,omitzero"`
LastTailEventAt time.Time `json:"last_tail_event_at,omitzero"`
DefaultGuildID string `json:"default_guild_id,omitempty"`
DefaultGuildName string `json:"default_guild_name,omitempty"`
AccessibleGuildIDs []string `json:"accessible_guild_ids,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AppendMessageEvent ¶
func (*Store) ChannelMessageBounds ¶
func (*Store) DeleteGuildData ¶
func (*Store) DeleteMember ¶
func (*Store) DeleteOrphanChannels ¶
func (*Store) DeleteSyncState ¶
func (*Store) DirectMessageConversations ¶
func (s *Store) DirectMessageConversations(ctx context.Context, opts DirectMessageConversationOptions) ([]DirectMessageConversationRow, error)
func (*Store) DrainEmbeddingJobs ¶
func (s *Store) DrainEmbeddingJobs(ctx context.Context, provider embed.Provider, opts EmbeddingDrainOptions) (EmbeddingDrainStats, error)
func (*Store) ExpandAttachmentChannelIDs ¶ added in v0.8.0
func (*Store) GetSyncState ¶
func (*Store) GuildChannelCount ¶
func (*Store) GuildMemberCount ¶
func (*Store) HasMessageEmbeddings ¶
func (*Store) IncompleteMessageChannelIDs ¶
func (*Store) ListAttachments ¶ added in v0.8.0
func (s *Store) ListAttachments(ctx context.Context, opts AttachmentListOptions) ([]AttachmentRow, error)
func (*Store) ListMentions ¶
func (s *Store) ListMentions(ctx context.Context, opts MentionListOptions) ([]MentionRow, error)
func (*Store) ListMessages ¶
func (s *Store) ListMessages(ctx context.Context, opts MessageListOptions) ([]MessageRow, error)
func (*Store) ListMessagesWithThreadContext ¶
func (s *Store) ListMessagesWithThreadContext(ctx context.Context, opts MessageListOptions) ([]MessageRow, error)
func (*Store) MarkMessageDeleted ¶
func (*Store) MemberByID ¶
func (*Store) MemberProfile ¶
func (*Store) ReadOnlyQuery ¶
func (*Store) RebuildMemberSearchIndex ¶ added in v0.7.2
func (*Store) RebuildMessageSearchIndex ¶ added in v0.7.2
func (*Store) RebuildSearchIndexes ¶
func (*Store) ReplaceMembers ¶
func (*Store) RequeueAllEmbeddingJobs ¶
func (*Store) SearchMessages ¶
func (s *Store) SearchMessages(ctx context.Context, opts SearchOptions) ([]SearchResult, error)
func (*Store) SearchMessagesHybrid ¶
func (s *Store) SearchMessagesHybrid(ctx context.Context, opts SearchOptions, semanticOpts SemanticSearchOptions) ([]SearchResult, error)
func (*Store) SearchMessagesSemantic ¶
func (s *Store) SearchMessagesSemantic(ctx context.Context, opts SemanticSearchOptions) ([]SearchResult, error)
func (*Store) SetSyncState ¶
func (*Store) UpdateAttachmentFetchStatus ¶ added in v0.8.0
func (*Store) UpdateAttachmentMedia ¶ added in v0.8.0
func (s *Store) UpdateAttachmentMedia(ctx context.Context, update AttachmentMediaUpdate) error
func (*Store) UpsertChannel ¶
func (s *Store) UpsertChannel(ctx context.Context, channel ChannelRecord) error
func (*Store) UpsertGuild ¶
func (s *Store) UpsertGuild(ctx context.Context, guild GuildRecord) error
func (*Store) UpsertMember ¶
func (s *Store) UpsertMember(ctx context.Context, member MemberRecord) error
func (*Store) UpsertMessage ¶
func (s *Store) UpsertMessage(ctx context.Context, message MessageRecord) error
func (*Store) UpsertMessageWithOptions ¶
func (s *Store) UpsertMessageWithOptions(ctx context.Context, message MessageRecord, opts WriteOptions) error
func (*Store) UpsertMessages ¶
func (s *Store) UpsertMessages(ctx context.Context, messages []MessageMutation) error
type WriteOptions ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.