Documentation
¶
Index ¶
- type DB
- func (db *DB) AcceptFollowByURI(uri string) error
- func (db *DB) BanAccount(accountId uuid.UUID) error
- func (db *DB) CleanupExpiredIPBans() (int64, error)
- func (db *DB) CleanupExpiredUploadTokens() error
- func (db *DB) CleanupOrphanedFollows() error
- func (db *DB) CountAccounts() (int, error)
- func (db *DB) CountActiveUsersHalfYear() (int, error)
- func (db *DB) CountActiveUsersMonth() (int, error)
- func (db *DB) CountActivitiesByInReplyTo(parentURI string) (int, error)
- func (db *DB) CountGlobalTimelinePosts() (int, error)
- func (db *DB) CountLikesByNoteId(noteId uuid.UUID) (int, error)
- func (db *DB) CountLocalPosts() (int, error)
- func (db *DB) CountNotesByHashtag(tag string) (int, error)
- func (db *DB) CountRepliesByNoteId(noteId uuid.UUID) (int, error)
- func (db *DB) CountRepliesByURI(objectURI string) (int, error)
- func (db *DB) CountTotalRepliesByNoteId(noteId uuid.UUID) (int, error)
- func (db *DB) CountTotalRepliesByURI(objectURI string) (int, error)
- func (db *DB) CreateAccByUsername(s ssh.Session, username string, webKeyPair *util.RsaKeyPair) error
- func (db *DB) CreateAccount(s ssh.Session, username string) (error, bool)
- func (db *DB) CreateActivity(activity *domain.Activity) error
- func (db *DB) CreateBan(id, username, ipAddress, publicKeyHash, reason string) error
- func (db *DB) CreateBoost(boost *domain.Boost) error
- func (db *DB) CreateBoostByObjectURI(boost *domain.Boost, objectURI string) error
- func (db *DB) CreateBoostFromRemote(boost *domain.Boost) error
- func (db *DB) CreateDB() error
- func (db *DB) CreateFollow(follow *domain.Follow) error
- func (db *DB) CreateInfoBox(box *domain.InfoBox) error
- func (db *DB) CreateLike(like *domain.Like) error
- func (db *DB) CreateLikeByObjectURI(like *domain.Like, objectURI string) error
- func (db *DB) CreateLocalFollow(followerAccountId, targetAccountId uuid.UUID) error
- func (db *DB) CreateNote(userId uuid.UUID, message string) (uuid.UUID, error)
- func (db *DB) CreateNoteMention(mention *domain.NoteMention) error
- func (db *DB) CreateNoteWithReply(userId uuid.UUID, message string, inReplyToURI string) (uuid.UUID, error)
- func (db *DB) CreateNotification(notification *domain.Notification) error
- func (db *DB) CreateOrUpdateHashtag(name string) (int64, error)
- func (db *DB) CreateRelay(relay *domain.Relay) error
- func (db *DB) CreateRemoteAccount(acc *domain.RemoteAccount) error
- func (db *DB) CreateUploadToken(accountId uuid.UUID, token string, tokenType string, expiresIn time.Duration) error
- func (db *DB) DecrementBoostCountByNoteId(noteId uuid.UUID) error
- func (db *DB) DecrementBoostCountByObjectURI(objectURI string) error
- func (db *DB) DecrementLikeCountByNoteId(noteId uuid.UUID) error
- func (db *DB) DecrementLikeCountByObjectURI(objectURI string) error
- func (db *DB) DeleteAccount(accountId uuid.UUID) error
- func (db *DB) DeleteActivity(id uuid.UUID) error
- func (db *DB) DeleteAllNotifications(accountId uuid.UUID) error
- func (db *DB) DeleteBan(id string) error
- func (db *DB) DeleteBoostByAccountAndNote(accountId, noteId uuid.UUID) error
- func (db *DB) DeleteBoostByAccountAndObjectURI(accountId uuid.UUID, objectURI string) error
- func (db *DB) DeleteBoostByRemoteAccountAndObjectURI(remoteAccountId uuid.UUID, objectURI string) error
- func (db *DB) DeleteDelivery(id uuid.UUID) error
- func (db *DB) DeleteFollowByAccountIds(accountId, targetAccountId uuid.UUID) error
- func (db *DB) DeleteFollowByURI(uri string) error
- func (db *DB) DeleteFollowsByRemoteAccountId(remoteAccountId uuid.UUID) error
- func (db *DB) DeleteFromFTS(sourceID string)
- func (db *DB) DeleteInfoBox(id uuid.UUID) error
- func (db *DB) DeleteLikeByAccountAndNote(accountId, noteId uuid.UUID) error
- func (db *DB) DeleteLikeByAccountAndObjectURI(accountId uuid.UUID, objectURI string) error
- func (db *DB) DeleteLikeByURI(uri string) error
- func (db *DB) DeleteLocalFollow(followerAccountId, targetAccountId uuid.UUID) error
- func (db *DB) DeleteMentionsByNoteId(noteId uuid.UUID) error
- func (db *DB) DeleteNoteById(noteId uuid.UUID) error
- func (db *DB) DeleteNotification(notificationId uuid.UUID) error
- func (db *DB) DeleteRelay(id uuid.UUID) error
- func (db *DB) DeleteRelayActivities() (int64, error)
- func (db *DB) DeleteRelayActivitiesFTS()
- func (db *DB) DeleteRemoteAccount(id uuid.UUID) error
- func (db *DB) DeleteUploadToken(token string) error
- func (db *DB) EnqueueDelivery(item *domain.DeliveryQueueItem) error
- func (db *DB) GetCurrentTermsAndConditions() (error, *domain.TermsAndConditions)
- func (db *DB) GetExistingUploadToken(accountId uuid.UUID, tokenType string) (string, time.Time, error)
- func (db *DB) GetUserTermsAcceptance(userId uuid.UUID) (error, *domain.UserTermsAcceptance)
- func (db *DB) HasBoost(accountId, noteId uuid.UUID) (bool, error)
- func (db *DB) HasBoostByObjectURI(accountId uuid.UUID, objectURI string) (bool, error)
- func (db *DB) HasBoostFromRemote(remoteAccountId uuid.UUID, objectURI string) (bool, error)
- func (db *DB) HasLike(accountId, noteId uuid.UUID) (bool, error)
- func (db *DB) HasLikeByObjectURI(accountId uuid.UUID, objectURI string) (bool, error)
- func (db *DB) HasLikeByURI(uri string) (bool, error)
- func (db *DB) IncrementBoostCountByNoteId(noteId uuid.UUID) error
- func (db *DB) IncrementBoostCountByObjectURI(objectURI string) error
- func (db *DB) IncrementLikeCountByNoteId(noteId uuid.UUID) error
- func (db *DB) IncrementLikeCountByObjectURI(objectURI string) error
- func (db *DB) IncrementReplyCountByURI(parentURI string) error
- func (db *DB) InsertActivityFTS(activityId uuid.UUID, ...)
- func (db *DB) InsertNoteFTS(noteId uuid.UUID, author, message, createdAt, objectURI string)
- func (db *DB) IsFollowingLocal(followerAccountId, targetAccountId uuid.UUID) (bool, error)
- func (db *DB) IsIPBanned(ipAddress string) bool
- func (db *DB) IsPublicKeyBanned(publicKeyHash string) bool
- func (db *DB) IsRemoteAccountFollowed(remoteAccountId uuid.UUID) (bool, error)
- func (db *DB) LinkNoteHashtags(noteId uuid.UUID, hashtagIds []int64) error
- func (db *DB) LinkNoteMentions(noteId uuid.UUID, mentions []domain.NoteMention) error
- func (db *DB) MarkAllNotificationsRead(accountId uuid.UUID) error
- func (db *DB) MarkNotificationRead(notificationId uuid.UUID) error
- func (db *DB) MigrateDuplicateFollows() error
- func (db *DB) MigrateFTS5Search() error
- func (db *DB) MigrateKeysToPKCS8() error
- func (db *DB) MigrateLocalReplyCounts() error
- func (db *DB) MigrateOrphanActivities() error
- func (db *DB) MigratePerformanceIndexes() error
- func (db *DB) MuteUser(accountId uuid.UUID) error
- func (db *DB) ReadAccById(id uuid.UUID) (error, *domain.Account)
- func (db *DB) ReadAccByPkHash(pkHash string) (error, *domain.Account)
- func (db *DB) ReadAccBySession(s ssh.Session) (error, *domain.Account)
- func (db *DB) ReadAccByUsername(username string) (error, *domain.Account)
- func (db *DB) ReadActiveRelays() (error, *[]domain.Relay)
- func (db *DB) ReadActiveUnpausedRelays() (error, *[]domain.Relay)
- func (db *DB) ReadActivitiesByActorURI(actorURI string, limit int) (error, *[]domain.Activity)
- func (db *DB) ReadActivitiesByInReplyTo(parentURI string) (error, *[]domain.Activity)
- func (db *DB) ReadActivityById(id uuid.UUID) (error, *domain.Activity)
- func (db *DB) ReadActivityByObjectURI(objectURI string) (error, *domain.Activity)
- func (db *DB) ReadActivityByURI(uri string) (error, *domain.Activity)
- func (db *DB) ReadAllAccounts() (error, *[]domain.Account)
- func (db *DB) ReadAllAccountsAdmin() (error, *[]domain.Account)
- func (db *DB) ReadAllBans() (error, *[]domain.Ban)
- func (db *DB) ReadAllInfoBoxes() (error, *[]domain.InfoBox)
- func (db *DB) ReadAllNotes() (error, *[]domain.Note)
- func (db *DB) ReadAllRelays() (error, *[]domain.Relay)
- func (db *DB) ReadAllRemoteAccounts() (error, []domain.RemoteAccount)
- func (db *DB) ReadBoostByAccountAndNote(accountId, noteId uuid.UUID) (error, *domain.Boost)
- func (db *DB) ReadBoostByAccountAndObjectURI(accountId uuid.UUID, objectURI string) (error, *domain.Boost)
- func (db *DB) ReadBoostersInfoByNoteId(noteId uuid.UUID) ([]string, error)
- func (db *DB) ReadBoostersInfoByObjectURI(objectURI string) ([]string, error)
- func (db *DB) ReadEnabledInfoBoxes() (error, *[]domain.InfoBox)
- func (db *DB) ReadFederatedActivities(accountId uuid.UUID, limit int) (error, *[]domain.Activity)
- func (db *DB) ReadFollowByAccountIds(accountId, targetAccountId uuid.UUID) (error, *domain.Follow)
- func (db *DB) ReadFollowByURI(uri string) (error, *domain.Follow)
- func (db *DB) ReadFollowersByAccountId(accountId uuid.UUID) (error, *[]domain.Follow)
- func (db *DB) ReadFollowingByAccountId(accountId uuid.UUID) (error, *[]domain.Follow)
- func (db *DB) ReadGlobalTimelinePosts(limit, offset int) (error, *[]domain.GlobalTimelinePost)
- func (db *DB) ReadHashtagsByNoteId(noteId uuid.UUID) (error, []string)
- func (db *DB) ReadHomeTimelinePosts(accountId uuid.UUID, limit int) (error, *[]domain.HomePost)
- func (db *DB) ReadInfoBoxById(id uuid.UUID) (error, *domain.InfoBox)
- func (db *DB) ReadLikeByAccountAndNote(accountId, noteId uuid.UUID) (error, *domain.Like)
- func (db *DB) ReadLikeByAccountAndObjectURI(accountId uuid.UUID, objectURI string) (error, *domain.Like)
- func (db *DB) ReadLikersInfoByNoteId(noteId uuid.UUID) ([]string, error)
- func (db *DB) ReadLikersInfoByObjectURI(objectURI string) ([]string, error)
- func (db *DB) ReadLikesByNoteId(noteId uuid.UUID) (error, []domain.Like)
- func (db *DB) ReadLocalFollowsByAccountId(accountId uuid.UUID) (error, *[]domain.Follow)
- func (db *DB) ReadLocalTimelineNotes(accountId uuid.UUID, limit int) (error, *[]domain.Note)
- func (db *DB) ReadMentionsByNoteId(noteId uuid.UUID) (error, []domain.NoteMention)
- func (db *DB) ReadNoteByURI(objectURI string) (error, *domain.Note)
- func (db *DB) ReadNoteId(id uuid.UUID) (error, *domain.Note)
- func (db *DB) ReadNoteIdWithReplyInfo(id uuid.UUID) (error, *domain.Note)
- func (db *DB) ReadNotesByHashtag(tag string, limit, offset int) (error, *[]domain.Note)
- func (db *DB) ReadNotesByUserId(userId uuid.UUID) (error, *[]domain.Note)
- func (db *DB) ReadNotesByUsername(username string) (error, *[]domain.Note)
- func (db *DB) ReadNotificationsByAccountId(accountId uuid.UUID, limit int) (error, *[]domain.Notification)
- func (db *DB) ReadPendingDeliveries(limit int) (error, *[]domain.DeliveryQueueItem)
- func (db *DB) ReadPublicNotesByUsername(username string, limit, offset int) (error, *[]domain.Note)
- func (db *DB) ReadRelayByActorURI(actorURI string) (error, *domain.Relay)
- func (db *DB) ReadRelayById(id uuid.UUID) (error, *domain.Relay)
- func (db *DB) ReadRemoteAccountByActorURI(actorURI string) (error, *domain.RemoteAccount)
- func (db *DB) ReadRemoteAccountById(id uuid.UUID) (error, *domain.RemoteAccount)
- func (db *DB) ReadRemoteAccountByURI(uri string) (error, *domain.RemoteAccount)
- func (db *DB) ReadRepliesByNoteId(noteId uuid.UUID) (error, *[]domain.Note)
- func (db *DB) ReadRepliesByURI(objectURI string) (error, *[]domain.Note)
- func (db *DB) ReadServerMessage() (error, *domain.ServerMessage)
- func (db *DB) ReadUnreadNotificationCount(accountId uuid.UUID) (int, error)
- func (db *DB) RecordUserTermsAcceptance(userId uuid.UUID) error
- func (db *DB) RunActivityPubMigrations() error
- func (db *DB) RunMigrations() error
- func (db *DB) SearchPosts(query string, maxResults int) (error, []domain.SearchResult)
- func (db *DB) ToggleInfoBoxEnabled(id uuid.UUID) error
- func (db *DB) UnbanAccount(accountId uuid.UUID) error
- func (db *DB) UnmuteUser(accountId uuid.UUID) error
- func (db *DB) UpdateAccountAvatar(accountId uuid.UUID, avatarURL string) error
- func (db *DB) UpdateAccountDisplayName(accountId uuid.UUID, displayName string) error
- func (db *DB) UpdateAccountLastIP(accountId uuid.UUID, ipAddress string) error
- func (db *DB) UpdateAccountLastIPByPkHash(pkHash string, ipAddress string) error
- func (db *DB) UpdateAccountSummary(accountId uuid.UUID, summary string) error
- func (db *DB) UpdateActivity(activity *domain.Activity) error
- func (db *DB) UpdateDeliveryAttempt(id uuid.UUID, attempts int, nextRetry time.Time) error
- func (db *DB) UpdateInfoBox(box *domain.InfoBox) error
- func (db *DB) UpdateLoginById(username string, displayName string, summary string, id uuid.UUID) error
- func (db *DB) UpdateLoginByPkHash(username string, displayName string, summary string, pkHash string) error
- func (db *DB) UpdateNote(noteId uuid.UUID, message string) error
- func (db *DB) UpdateNoteFTS(noteId uuid.UUID, author, message, createdAt, objectURI string)
- func (db *DB) UpdateNoteLikeCount(noteId uuid.UUID, count int) error
- func (db *DB) UpdateRelayPaused(id uuid.UUID, paused bool) error
- func (db *DB) UpdateRelayStatus(id uuid.UUID, status string, acceptedAt *time.Time) error
- func (db *DB) UpdateRemoteAccount(acc *domain.RemoteAccount) error
- func (db *DB) UpdateServerMessage(message string, enabled bool, webEnabled bool) error
- func (db *DB) UpdateTermsAndConditions(content string) error
- func (db *DB) UserNeedsToAcceptTerms(userId uuid.UUID) (bool, error)
- func (db *DB) ValidateUploadToken(token string) (uuid.UUID, string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is the database struct.
func (*DB) AcceptFollowByURI ¶
func (*DB) BanAccount ¶ added in v1.6.0
BanAccount sets the banned flag on an account and creates a ban record
func (*DB) CleanupExpiredIPBans ¶ added in v1.6.0
CleanupExpiredIPBans clears IP addresses from bans older than 60 days The ban record is kept (for public key blocking) but the IP is cleared
func (*DB) CleanupExpiredUploadTokens ¶ added in v1.5.0
CleanupExpiredUploadTokens removes all expired tokens
func (*DB) CleanupOrphanedFollows ¶ added in v1.2.4
CleanupOrphanedFollows removes follow records that point to deleted remote accounts
func (*DB) CountAccounts ¶ added in v1.1.0
CountAccounts returns the total number of accounts in the database
func (*DB) CountActiveUsersHalfYear ¶ added in v1.2.2
CountActiveUsersHalfYear returns the number of users who posted in the last 180 days
func (*DB) CountActiveUsersMonth ¶ added in v1.2.2
CountActiveUsersMonth returns the number of users who posted in the last 30 days
func (*DB) CountActivitiesByInReplyTo ¶ added in v1.4.0
CountActivitiesByInReplyTo counts Create activities that are replies to the given URI
func (*DB) CountGlobalTimelinePosts ¶ added in v1.6.0
CountGlobalTimelinePosts returns the total count of posts in the global timeline
func (*DB) CountLikesByNoteId ¶ added in v1.4.1
CountLikesByNoteId returns the number of likes for a given note
func (*DB) CountLocalPosts ¶ added in v1.2.2
CountLocalPosts returns the total number of local posts (notes) in the database
func (*DB) CountNotesByHashtag ¶ added in v1.4.0
CountNotesByHashtag returns the total count of notes with a specific hashtag
func (*DB) CountRepliesByNoteId ¶ added in v1.4.0
CountRepliesByNoteId counts the number of direct replies to a local note
func (*DB) CountRepliesByURI ¶ added in v1.4.0
CountRepliesByURI counts the number of direct replies to a note by URI
func (*DB) CountTotalRepliesByNoteId ¶ added in v1.4.0
CountTotalRepliesByNoteId counts all replies (recursively) to a local note This includes direct replies and all nested replies in the thread
func (*DB) CountTotalRepliesByURI ¶ added in v1.4.0
CountTotalRepliesByURI counts all replies (recursively) to a note by URI This includes direct replies, remote replies, and all nested replies
func (*DB) CreateAccByUsername ¶
func (*DB) CreateAccount ¶
func (*DB) CreateBan ¶ added in v1.6.0
CreateBan adds a new ban record with IP address and public key hash
func (*DB) CreateBoost ¶ added in v1.4.1
CreateBoost creates a new boost record
func (*DB) CreateBoostByObjectURI ¶ added in v1.6.0
CreateBoostByObjectURI creates a boost for a remote post using object URI
func (*DB) CreateBoostFromRemote ¶ added in v1.6.0
CreateBoostFromRemote creates a boost record with remote_account_id set (for boosts from followed remote users)
func (*DB) CreateInfoBox ¶ added in v1.5.0
CreateInfoBox creates a new info box
func (*DB) CreateLike ¶ added in v1.4.1
CreateLike creates a new like record
func (*DB) CreateLikeByObjectURI ¶ added in v1.4.1
CreateLikeByObjectURI creates a like for a remote post using object URI
func (*DB) CreateLocalFollow ¶
CreateLocalFollow creates a local-only follow relationship
func (*DB) CreateNote ¶
func (*DB) CreateNoteMention ¶ added in v1.4.0
func (db *DB) CreateNoteMention(mention *domain.NoteMention) error
CreateNoteMention creates a new mention record for a note
func (*DB) CreateNoteWithReply ¶ added in v1.4.0
func (db *DB) CreateNoteWithReply(userId uuid.UUID, message string, inReplyToURI string) (uuid.UUID, error)
CreateNoteWithReply creates a note with an optional inReplyToURI for replies
func (*DB) CreateNotification ¶ added in v1.4.3
func (db *DB) CreateNotification(notification *domain.Notification) error
CreateNotification creates a new notification
func (*DB) CreateOrUpdateHashtag ¶ added in v1.4.0
CreateOrUpdateHashtag creates a new hashtag or increments usage count if it exists Returns the hashtag ID
func (*DB) CreateRelay ¶ added in v1.4.2
CreateRelay creates a new relay subscription
func (*DB) CreateRemoteAccount ¶
func (db *DB) CreateRemoteAccount(acc *domain.RemoteAccount) error
func (*DB) CreateUploadToken ¶ added in v1.5.0
func (db *DB) CreateUploadToken(accountId uuid.UUID, token string, tokenType string, expiresIn time.Duration) error
CreateUploadToken creates a new one-time upload token
func (*DB) DecrementBoostCountByNoteId ¶ added in v1.4.1
DecrementBoostCountByNoteId decrements the boost_count for a note
func (*DB) DecrementBoostCountByObjectURI ¶ added in v1.6.0
DecrementBoostCountByObjectURI decrements the boost_count for an activity by object URI
func (*DB) DecrementLikeCountByNoteId ¶ added in v1.4.1
DecrementLikeCountByNoteId decrements the like_count for a note
func (*DB) DecrementLikeCountByObjectURI ¶ added in v1.4.1
DecrementLikeCountByObjectURI decrements the like_count for an activity by object URI
func (*DB) DeleteAccount ¶ added in v1.1.0
DeleteAccount deletes a local account and all associated data (notes, follows, activities)
func (*DB) DeleteActivity ¶
DeleteActivity deletes an activity by ID
func (*DB) DeleteAllNotifications ¶ added in v1.4.3
DeleteAllNotifications deletes all notifications for an account
func (*DB) DeleteBoostByAccountAndNote ¶ added in v1.4.1
DeleteBoostByAccountAndNote removes a boost by the account and note IDs
func (*DB) DeleteBoostByAccountAndObjectURI ¶ added in v1.6.0
DeleteBoostByAccountAndObjectURI removes a boost by account ID and object URI
func (*DB) DeleteBoostByRemoteAccountAndObjectURI ¶ added in v1.6.0
func (db *DB) DeleteBoostByRemoteAccountAndObjectURI(remoteAccountId uuid.UUID, objectURI string) error
DeleteBoostByRemoteAccountAndObjectURI removes a boost by remote account ID and object URI
func (*DB) DeleteFollowByAccountIds ¶ added in v1.1.0
func (*DB) DeleteFollowByURI ¶
func (*DB) DeleteFollowsByRemoteAccountId ¶
DeleteFollowsByRemoteAccountId deletes all follows to/from a remote account
func (*DB) DeleteFromFTS ¶ added in v1.7.1
DeleteFromFTS removes a post from the FTS index by source_id. Uses the lookup table to find the FTS rowid, then deletes by rowid.
func (*DB) DeleteInfoBox ¶ added in v1.5.0
DeleteInfoBox deletes an info box
func (*DB) DeleteLikeByAccountAndNote ¶ added in v1.4.1
DeleteLikeByAccountAndNote removes a like by the account and note IDs
func (*DB) DeleteLikeByAccountAndObjectURI ¶ added in v1.4.1
DeleteLikeByAccountAndObjectURI removes a like by account ID and object URI
func (*DB) DeleteLikeByURI ¶ added in v1.4.1
DeleteLikeByURI removes a like by its activity URI
func (*DB) DeleteLocalFollow ¶
DeleteLocalFollow removes a local follow relationship
func (*DB) DeleteMentionsByNoteId ¶ added in v1.4.0
DeleteMentionsByNoteId removes all mentions for a specific note
func (*DB) DeleteNotification ¶ added in v1.4.3
DeleteNotification deletes a notification
func (*DB) DeleteRelay ¶ added in v1.4.2
DeleteRelay deletes a relay subscription
func (*DB) DeleteRelayActivities ¶ added in v1.4.2
DeleteRelayActivities deletes all activities that were forwarded by relays (from_relay=1)
func (*DB) DeleteRelayActivitiesFTS ¶ added in v1.7.1
func (db *DB) DeleteRelayActivitiesFTS()
DeleteRelayActivitiesFTS removes all relay-forwarded activities from the FTS index
func (*DB) DeleteRemoteAccount ¶
DeleteRemoteAccount deletes a remote account by ID
func (*DB) DeleteUploadToken ¶ added in v1.5.0
DeleteUploadToken removes a used or expired token
func (*DB) EnqueueDelivery ¶
func (db *DB) EnqueueDelivery(item *domain.DeliveryQueueItem) error
func (*DB) GetCurrentTermsAndConditions ¶ added in v1.6.3
func (db *DB) GetCurrentTermsAndConditions() (error, *domain.TermsAndConditions)
GetCurrentTermsAndConditions returns the current terms and conditions
func (*DB) GetExistingUploadToken ¶ added in v1.5.0
func (db *DB) GetExistingUploadToken(accountId uuid.UUID, tokenType string) (string, time.Time, error)
GetExistingUploadToken returns an existing valid token for an account, or empty string if none exists
func (*DB) GetUserTermsAcceptance ¶ added in v1.6.3
GetUserTermsAcceptance returns the terms acceptance record for a user
func (*DB) HasBoost ¶ added in v1.4.1
HasBoost checks if a boost already exists for this account and note
func (*DB) HasBoostByObjectURI ¶ added in v1.6.0
HasBoostByObjectURI checks if an account has boosted a post by its object URI
func (*DB) HasBoostFromRemote ¶ added in v1.6.0
HasBoostFromRemote checks if a boost already exists from a remote account for a given object URI
func (*DB) HasLike ¶ added in v1.4.1
HasLike checks if a like already exists for this account and note
func (*DB) HasLikeByObjectURI ¶ added in v1.4.1
HasLikeByObjectURI checks if an account has liked a post by its object URI
func (*DB) HasLikeByURI ¶ added in v1.4.1
HasLikeByURI checks if a like already exists by its activity URI
func (*DB) IncrementBoostCountByNoteId ¶ added in v1.4.1
IncrementBoostCountByNoteId increments the boost_count for a note
func (*DB) IncrementBoostCountByObjectURI ¶ added in v1.6.0
IncrementBoostCountByObjectURI increments the boost_count for an activity by object URI
func (*DB) IncrementLikeCountByNoteId ¶ added in v1.4.1
IncrementLikeCountByNoteId increments the like_count for a note and returns new count
func (*DB) IncrementLikeCountByObjectURI ¶ added in v1.4.1
IncrementLikeCountByObjectURI increments the like_count for an activity by object URI
func (*DB) IncrementReplyCountByURI ¶ added in v1.4.0
IncrementReplyCountByURI increments the reply_count on a note or activity by URI This is used when receiving remote replies via ActivityPub inbox
func (*DB) InsertActivityFTS ¶ added in v1.7.1
func (db *DB) InsertActivityFTS(activityId uuid.UUID, actorURI, rawJSON, createdAt, objectURI, objectURL string)
InsertActivityFTS adds a remote activity to the FTS index
func (*DB) InsertNoteFTS ¶ added in v1.7.1
InsertNoteFTS adds a local note to the FTS index
func (*DB) IsFollowingLocal ¶
IsFollowingLocal checks if a user is following another local user
func (*DB) IsIPBanned ¶ added in v1.6.0
IsIPBanned checks if an IP address is banned
func (*DB) IsPublicKeyBanned ¶ added in v1.6.0
IsPublicKeyBanned checks if a public key hash is banned
func (*DB) IsRemoteAccountFollowed ¶ added in v1.6.0
IsRemoteAccountFollowed checks if any local user follows the given remote account
func (*DB) LinkNoteHashtags ¶ added in v1.4.0
LinkNoteHashtags creates links between a note and multiple hashtags
func (*DB) LinkNoteMentions ¶ added in v1.4.0
LinkNoteMentions creates mention records for all mentions in a note
func (*DB) MarkAllNotificationsRead ¶ added in v1.4.3
MarkAllNotificationsRead marks all notifications for an account as read
func (*DB) MarkNotificationRead ¶ added in v1.4.3
MarkNotificationRead marks a notification as read
func (*DB) MigrateDuplicateFollows ¶ added in v1.2.2
MigrateDuplicateFollows removes duplicate follow relationships and adds UNIQUE constraint This is a one-time migration to fix the issue where multiple Follow activities from the same actor could create duplicate entries
func (*DB) MigrateFTS5Search ¶ added in v1.7.1
MigrateFTS5Search creates the FTS5 virtual table for full-text search and backfills existing data. The FTS5 table only stores content and author (the searchable columns). Metadata (source_type, created_at) lives in the lookup table. object_uri/object_url are loaded from notes/activities at query time.
func (*DB) MigrateKeysToPKCS8 ¶ added in v1.2.2
MigrateKeysToPKCS8 converts all existing PKCS#1 keys to PKCS#8 format This is a one-time migration that preserves the cryptographic key material
func (*DB) MigrateLocalReplyCounts ¶ added in v1.4.2
MigrateLocalReplyCounts recalculates reply_count for notes with local replies This fixes the issue where local-only replies (with "local:" prefix URIs) weren't being counted, causing threads not to open in the TUI
func (*DB) MigrateOrphanActivities ¶ added in v1.6.0
MigrateOrphanActivities removes Create activities that were incorrectly stored because the inbox handler stored them before checking if the user follows the actor. This is a one-time cleanup migration for the bug fix in handleCreateActivityWithDeps.
func (*DB) MigratePerformanceIndexes ¶ added in v1.4.2
MigratePerformanceIndexes adds performance-critical indexes that were missing These indexes speed up threading queries and relay content filtering
func (*DB) ReadAccBySession ¶
func (*DB) ReadAccByUsername ¶
func (*DB) ReadActiveRelays ¶ added in v1.4.2
ReadActiveRelays returns all relay subscriptions with status='active'
func (*DB) ReadActiveUnpausedRelays ¶ added in v1.4.2
ReadActiveUnpausedRelays returns all relay subscriptions with status='active' and paused=0
func (*DB) ReadActivitiesByActorURI ¶ added in v1.7.0
ReadActivitiesByActorURI returns top-level posts (Create activities) from a specific remote actor Used to display posts on a remote user's profile
func (*DB) ReadActivitiesByInReplyTo ¶ added in v1.4.0
ReadActivitiesByInReplyTo finds all Create activities that are replies to the given URI This searches the raw_json field for "inReplyTo":"<uri>" patterns It supports both exact URI matches and partial matches (for notes without stored object_uri)
func (*DB) ReadActivityById ¶ added in v1.7.0
ReadActivityById reads an activity by its UUID
func (*DB) ReadActivityByObjectURI ¶
ReadActivityByObjectURI reads an activity by the object URI First tries exact match on object_uri column, falls back to searching raw_json for older activities
func (*DB) ReadActivityByURI ¶
func (*DB) ReadAllAccounts ¶
ReadAllAccounts returns all local user accounts (excluding first-time login users)
func (*DB) ReadAllAccountsAdmin ¶ added in v1.1.0
ReadAllAccountsAdmin returns all local user accounts including first-time login users (for admin panel)
func (*DB) ReadAllBans ¶ added in v1.6.0
ReadAllBans returns all ban records
func (*DB) ReadAllInfoBoxes ¶ added in v1.5.0
ReadAllInfoBoxes returns all info boxes ordered by order_num
func (*DB) ReadAllRelays ¶ added in v1.4.2
ReadAllRelays returns all relay subscriptions
func (*DB) ReadAllRemoteAccounts ¶ added in v1.4.0
func (db *DB) ReadAllRemoteAccounts() (error, []domain.RemoteAccount)
ReadAllRemoteAccounts returns all cached remote accounts for autocomplete
func (*DB) ReadBoostByAccountAndNote ¶ added in v1.6.0
ReadBoostByAccountAndNote finds a boost by account ID and note ID
func (*DB) ReadBoostByAccountAndObjectURI ¶ added in v1.6.0
func (db *DB) ReadBoostByAccountAndObjectURI(accountId uuid.UUID, objectURI string) (error, *domain.Boost)
ReadBoostByAccountAndObjectURI finds a boost by account ID and object URI
func (*DB) ReadBoostersInfoByNoteId ¶ added in v1.5.0
ReadBoostersInfoByNoteId returns a list of usernames who boosted a local note (local and remote users)
func (*DB) ReadBoostersInfoByObjectURI ¶ added in v1.5.0
ReadBoostersInfoByObjectURI returns a list of usernames who boosted a remote post (local and remote users)
func (*DB) ReadEnabledInfoBoxes ¶ added in v1.5.0
ReadEnabledInfoBoxes returns only enabled info boxes ordered by order_num
func (*DB) ReadFederatedActivities ¶
func (*DB) ReadFollowByAccountIds ¶ added in v1.1.0
func (*DB) ReadFollowersByAccountId ¶
func (*DB) ReadFollowingByAccountId ¶
ReadFollowingByAccountId returns all accounts that the given account is following (remote accounts)
func (*DB) ReadGlobalTimelinePosts ¶ added in v1.6.0
func (db *DB) ReadGlobalTimelinePosts(limit, offset int) (error, *[]domain.GlobalTimelinePost)
ReadGlobalTimelinePosts returns posts for the global timeline (local notes + remote activities) excluding replies. Uses UNION ALL for efficient SQL-level sorting and pagination.
func (*DB) ReadHashtagsByNoteId ¶ added in v1.4.0
ReadHashtagsByNoteId returns all hashtag names for a given note
func (*DB) ReadHomeTimelinePosts ¶ added in v1.4.0
ReadHomeTimelinePosts returns a unified home timeline combining local and remote posts. Uses 2 UNION ALL queries (non-boost + boost) for efficient SQL-level sorting.
func (*DB) ReadInfoBoxById ¶ added in v1.5.0
ReadInfoBoxById returns a single info box by ID
func (*DB) ReadLikeByAccountAndNote ¶ added in v1.4.1
ReadLikeByAccountAndNote finds a like by the account that created it and the note it's on
func (*DB) ReadLikeByAccountAndObjectURI ¶ added in v1.4.1
func (db *DB) ReadLikeByAccountAndObjectURI(accountId uuid.UUID, objectURI string) (error, *domain.Like)
ReadLikeByAccountAndObjectURI finds a like by account ID and object URI
func (*DB) ReadLikersInfoByNoteId ¶ added in v1.5.0
ReadLikersInfoByNoteId returns a list of usernames who liked a local note (local and remote users)
func (*DB) ReadLikersInfoByObjectURI ¶ added in v1.5.0
ReadLikersInfoByObjectURI returns a list of usernames who liked a remote post (local and remote users)
func (*DB) ReadLikesByNoteId ¶ added in v1.4.1
ReadLikesByNoteId returns all likes for a given note
func (*DB) ReadLocalFollowsByAccountId ¶
ReadLocalFollowsByAccountId returns all local users that an account is following
func (*DB) ReadLocalTimelineNotes ¶
ReadLocalTimelineNotes returns recent notes from local users that the given account follows (plus their own posts)
func (*DB) ReadMentionsByNoteId ¶ added in v1.4.0
ReadMentionsByNoteId returns all mentions for a given note
func (*DB) ReadNoteByURI ¶ added in v1.4.0
ReadNoteByURI finds a local note by its ActivityPub object_uri It first tries an exact match on the object_uri column, then falls back to extracting the UUID from the URI pattern /notes/{uuid}
func (*DB) ReadNoteIdWithReplyInfo ¶ added in v1.4.0
ReadNoteIdWithReplyInfo returns a note with full reply information
func (*DB) ReadNotesByHashtag ¶ added in v1.4.0
ReadNotesByHashtag returns notes that contain a specific hashtag with pagination
func (*DB) ReadNotesByUserId ¶
func (*DB) ReadNotesByUsername ¶
func (*DB) ReadNotificationsByAccountId ¶ added in v1.4.3
func (db *DB) ReadNotificationsByAccountId(accountId uuid.UUID, limit int) (error, *[]domain.Notification)
ReadNotificationsByAccountId retrieves notifications for an account
func (*DB) ReadPendingDeliveries ¶
func (db *DB) ReadPendingDeliveries(limit int) (error, *[]domain.DeliveryQueueItem)
func (*DB) ReadPublicNotesByUsername ¶ added in v1.1.0
ReadPublicNotesByUsername returns public notes for a user's ActivityPub outbox with pagination Returns notes with full metadata including object_uri for ActivityPub compatibility
func (*DB) ReadRelayByActorURI ¶ added in v1.4.2
ReadRelayByActorURI returns a relay by its actor URI
func (*DB) ReadRelayById ¶ added in v1.4.2
ReadRelayById returns a relay by its ID
func (*DB) ReadRemoteAccountByActorURI ¶
func (db *DB) ReadRemoteAccountByActorURI(actorURI string) (error, *domain.RemoteAccount)
ReadRemoteAccountByActorURI reads a remote account by its ActivityPub actor URI
func (*DB) ReadRemoteAccountById ¶
func (*DB) ReadRemoteAccountByURI ¶
func (db *DB) ReadRemoteAccountByURI(uri string) (error, *domain.RemoteAccount)
func (*DB) ReadRepliesByNoteId ¶ added in v1.4.0
ReadRepliesByNoteId returns all direct replies to a local note by its UUID
func (*DB) ReadRepliesByURI ¶ added in v1.4.0
ReadRepliesByURI returns all direct replies to a note by its ActivityPub URI
func (*DB) ReadServerMessage ¶ added in v1.5.2
func (db *DB) ReadServerMessage() (error, *domain.ServerMessage)
ReadServerMessage returns the current server message (single row)
func (*DB) ReadUnreadNotificationCount ¶ added in v1.4.3
ReadUnreadNotificationCount returns the count of unread notifications for an account
func (*DB) RecordUserTermsAcceptance ¶ added in v1.6.3
RecordUserTermsAcceptance records that a user has accepted the terms and conditions
func (*DB) RunActivityPubMigrations ¶
RunActivityPubMigrations runs ActivityPub-specific migrations
func (*DB) RunMigrations ¶
RunMigrations executes all database migrations
func (*DB) SearchPosts ¶ added in v1.7.1
SearchPosts searches the FTS5 index for posts matching the query. The FTS5 table only stores content+author. Metadata comes from the lookup table, and object_uri/object_url are loaded from the source tables (notes/activities).
func (*DB) ToggleInfoBoxEnabled ¶ added in v1.5.0
ToggleInfoBoxEnabled toggles the enabled status of an info box
func (*DB) UnbanAccount ¶ added in v1.6.0
UnbanAccount clears the banned flag on an account
func (*DB) UnmuteUser ¶ added in v1.1.0
UnmuteUser unmutes a user
func (*DB) UpdateAccountAvatar ¶ added in v1.5.0
UpdateAccountAvatar updates only the avatar URL for an account
func (*DB) UpdateAccountDisplayName ¶ added in v1.5.0
UpdateAccountDisplayName updates only the display name for an account
func (*DB) UpdateAccountLastIP ¶ added in v1.6.0
UpdateAccountLastIP updates the last_ip field for an account
func (*DB) UpdateAccountLastIPByPkHash ¶ added in v1.6.0
UpdateAccountLastIPByPkHash updates the last_ip field for an account by public key hash
func (*DB) UpdateAccountSummary ¶ added in v1.5.0
UpdateAccountSummary updates only the bio/summary for an account
func (*DB) UpdateDeliveryAttempt ¶
func (*DB) UpdateInfoBox ¶ added in v1.5.0
UpdateInfoBox updates an existing info box
func (*DB) UpdateLoginById ¶
func (*DB) UpdateLoginByPkHash ¶
func (*DB) UpdateNoteFTS ¶ added in v1.7.1
UpdateNoteFTS updates a note in the FTS index (delete + re-insert)
func (*DB) UpdateNoteLikeCount ¶ added in v1.4.1
UpdateNoteLikeCount updates the like_count for a specific note
func (*DB) UpdateRelayPaused ¶ added in v1.4.2
UpdateRelayPaused updates a relay's paused status
func (*DB) UpdateRelayStatus ¶ added in v1.4.2
UpdateRelayStatus updates a relay's status and optionally sets accepted_at
func (*DB) UpdateRemoteAccount ¶
func (db *DB) UpdateRemoteAccount(acc *domain.RemoteAccount) error
func (*DB) UpdateServerMessage ¶ added in v1.5.2
UpdateServerMessage updates the server message (creates if doesn't exist)
func (*DB) UpdateTermsAndConditions ¶ added in v1.6.3
UpdateTermsAndConditions updates the terms and conditions
func (*DB) UserNeedsToAcceptTerms ¶ added in v1.6.3
UserNeedsToAcceptTerms checks if a user needs to accept terms and conditions. Returns true if: - Terms exist and user has never accepted them - Terms were updated after user's last acceptance