Documentation
¶
Overview ¶
Package db is the only place in pwikit that issues SQL.
Index ¶
- Constants
- Variables
- func AppliedMigrations(ctx context.Context, conn *pgx.Conn) ([]string, error)
- func BackupTables(ctx context.Context, conn *pgx.Conn) ([]string, error)
- func BuiltinPermissions(slug string) []string
- func CopyIn(ctx context.Context, tx pgx.Tx, r io.Reader, table string) (int64, error)
- func CopyOut(ctx context.Context, tx pgx.Tx, w io.Writer, table, query string) (int64, error)
- func CreatingTagsAllowed(siteMode, categoryMode string) bool
- func DeletedWikidotName(wikidotID int64) string
- func EnsureDatabase(ctx context.Context, conn *pgx.Conn, name string) error
- func MediaName() (string, error)
- func MissingTagGroups(groups [][]string, tags []string) [][]string
- func NonEmptyTables(ctx context.Context, conn *pgx.Conn, tables []string) ([]string, error)
- func OtherConnections(ctx context.Context, conn *pgx.Conn) (int, error)
- func ParseTagGroups(raw string) [][]string
- func QuoteLiteral(ctx context.Context, tx pgx.Tx, value string) (string, error)
- func QuoteName(name string) string
- func ResetIdentities(ctx context.Context, tx pgx.Tx, tables map[string]bool) error
- func ResetSchema(ctx context.Context, tx pgx.Tx) error
- func RestoreForeignKeys(ctx context.Context, tx pgx.Tx, keys []ForeignKey) error
- func ServerVersion(ctx context.Context, conn *pgx.Conn) (int, error)
- func SiteExportQuery(ctx context.Context, conn *pgx.Conn, table string, keepPasswords bool) (string, error)
- func SiteScopeRuled() []string
- func SiteSlugExists(ctx context.Context, conn *pgx.Conn, slug string) (bool, error)
- func TagFullName(raw string) string
- func TruncateAll(ctx context.Context, tx pgx.Tx, tables []string) error
- type AccountEmail
- type ActivityDay
- type AdminNote
- type AdminNoteRow
- type AdminPageRow
- type AdminUserRow
- type Announcement
- type Article
- type ArticleFile
- type ArticleFileEntry
- type ArticleHead
- type ArticleLink
- type ArticleTag
- type ArticleVote
- type AuthorRankFilter
- type AuthorRankRow
- type AuthorStats
- type AuthoredPage
- type CategoryLook
- type CategoryOverride
- type CategoryRow
- type ClaimOutcome
- type CloudTag
- type CommentInfo
- type Conversation
- type DB
- func (d *DB) AccessCandidates(ctx context.Context, siteID int64, now time.Time, limit int) ([]int64, error)
- func (d *DB) AccountEmail(ctx context.Context, id int64) (AccountEmail, error)
- func (d *DB) ActivateInviteLink(ctx context.Context, token, username string, at time.Time) error
- func (d *DB) ActivateUser(ctx context.Context, id int64, username string, displayName *string, ...) error
- func (d *DB) ActiveSanctions(ctx context.Context, siteID, userID int64, now time.Time) ([]string, error)
- func (d *DB) ActiveSites(ctx context.Context, userID int64) (map[int64]bool, error)
- func (d *DB) ActiveUsersByNames(ctx context.Context, names []string) ([]User, error)
- func (d *DB) ActivityDays(ctx context.Context, userID int64, siteID *int64, since time.Time, ...) ([]ActivityDay, error)
- func (d *DB) AddArticleFile(ctx context.Context, w FileWrite) (int64, error)
- func (d *DB) AddArticleLogEntry(ctx context.Context, articleID int64, userID *int64, ...) (Revision, error)
- func (d *DB) AddArticleVersion(ctx context.Context, articleID int64, source string, at time.Time) (int64, error)
- func (d *DB) AddFavourite(ctx context.Context, articleID, userID int64, at time.Time) error
- func (d *DB) AddImportedVote(ctx context.Context, articleID, userID int64, rate float64) (int64, error)
- func (d *DB) AddQuizAttempt(ctx context.Context, siteID, userID int64, at time.Time, passed bool) error
- func (d *DB) AddressCount(ctx context.Context) (int, error)
- func (d *DB) AdminCategories(ctx context.Context, siteID int64) ([]CategoryRow, error)
- func (d *DB) AdminCategory(ctx context.Context, siteID, id int64) (CategoryRow, error)
- func (d *DB) AdminForumCategories(ctx context.Context, siteID int64) ([]ForumCategoryRow, error)
- func (d *DB) AdminForumCategory(ctx context.Context, siteID, id int64) (ForumCategoryRow, error)
- func (d *DB) AdminForumSection(ctx context.Context, siteID, id int64) (ForumSectionRow, error)
- func (d *DB) AdminForumSections(ctx context.Context, siteID int64) ([]ForumSectionRow, error)
- func (d *DB) AdminInvites(ctx context.Context, siteID int64, limit, offset int) ([]InviteRow, int, error)
- func (d *DB) AdminNoteScreens(ctx context.Context, siteID int64) ([]string, error)
- func (d *DB) AdminNotes(ctx context.Context, siteID int64, screen string, limit, offset int) ([]AdminNoteRow, error)
- func (d *DB) AdminPageCategories(ctx context.Context, siteID int64) ([]PageCategoryCount, error)
- func (d *DB) AdminPages(ctx context.Context, siteID int64, query, category string, tagID int64, ...) ([]AdminPageRow, int, error)
- func (d *DB) AdminReport(ctx context.Context, siteID, id int64) (ReportRow, error)
- func (d *DB) AdminReports(ctx context.Context, siteID int64, status string, limit, offset int) ([]ReportRow, int, error)
- func (d *DB) AdminRole(ctx context.Context, siteID, id int64) (RoleRow, error)
- func (d *DB) AdminRoles(ctx context.Context, siteID int64) ([]RoleRow, error)
- func (d *DB) AdminTag(ctx context.Context, siteID, id int64) (TagRow, error)
- func (d *DB) AdminTagCategories(ctx context.Context, siteID int64) ([]TagCategoryRow, error)
- func (d *DB) AdminTagCategory(ctx context.Context, siteID, id int64) (TagCategoryRow, error)
- func (d *DB) AdminTags(ctx context.Context, siteID int64, query string, categoryID int64, ...) ([]TagRow, int, error)
- func (d *DB) AdminTicket(ctx context.Context, siteID, id int64) (TicketRow, error)
- func (d *DB) AdminTickets(ctx context.Context, siteID int64, kind, status string, limit, offset int) ([]TicketRow, int, error)
- func (d *DB) AdminUser(ctx context.Context, siteID, id int64) (AdminUserRow, error)
- func (d *DB) AdminUsers(ctx context.Context, siteID int64, query, kind string, roleID int64, ...) ([]AdminUserRow, int, error)
- func (d *DB) AllRoles(ctx context.Context, siteID int64) ([]RoleChoice, error)
- func (d *DB) AllTags(ctx context.Context, siteID int64) ([]NamedTag, error)
- func (d *DB) AllUsers(ctx context.Context) ([]User, error)
- func (d *DB) Announcement(ctx context.Context, siteID, id int64) (Announcement, string, error)
- func (d *DB) AnnouncementAudience(ctx context.Context, siteID *int64) ([]int64, error)
- func (d *DB) Announcements(ctx context.Context, siteID int64) ([]Announcement, error)
- func (d *DB) AppendImportedPost(ctx context.Context, threadID int64, post ImportPost, replyTo *int64) (int64, *Renumbered, error)
- func (d *DB) ApplyPendingEmail(ctx context.Context, id int64, pending string, at time.Time) (bool, error)
- func (d *DB) ArticleAuthorIDs(ctx context.Context, articleID int64) ([]int64, error)
- func (d *DB) ArticleAuthors(ctx context.Context, articleID int64) ([]User, error)
- func (d *DB) ArticleByID(ctx context.Context, siteID, id int64) (*Article, error)
- func (d *DB) ArticleByName(ctx context.Context, siteID int64, ref string) (*Article, error)
- func (d *DB) ArticleCategories(ctx context.Context, siteID int64, hidden []string) ([]string, error)
- func (d *DB) ArticleChildren(ctx context.Context, articleID int64) ([]Article, error)
- func (d *DB) ArticleFavouriteCount(ctx context.Context, articleID int64) (int, error)
- func (d *DB) ArticleFile(ctx context.Context, siteID int64, articleRef, fileName string) (*ArticleFile, error)
- func (d *DB) ArticleFileList(ctx context.Context, articleID int64) ([]FileRecord, error)
- func (d *DB) ArticleFileNames(ctx context.Context, articleID int64) (map[string]bool, error)
- func (d *DB) ArticleFiles(ctx context.Context, articleID int64) ([]ArticleFileEntry, error)
- func (d *DB) ArticleHasAuthor(ctx context.Context, articleID, userID int64) (bool, error)
- func (d *DB) ArticleHead(ctx context.Context, articleID int64) (ArticleHead, error)
- func (d *DB) ArticleLastComment(ctx context.Context, articleID int64) (*ForumLastPost, error)
- func (d *DB) ArticleLog(ctx context.Context, articleID int64, offset int, limit *int) ([]LogEntry, error)
- func (d *DB) ArticleLogAbove(ctx context.Context, articleID int64, revNumber int) ([]LogEntry, error)
- func (d *DB) ArticleLogCount(ctx context.Context, articleID int64) (int, error)
- func (d *DB) ArticleSources(ctx context.Context, siteID int64, refs []string) (map[string]string, error)
- func (d *DB) ArticleSubscribers(ctx context.Context, articleID int64) ([]int64, error)
- func (d *DB) ArticleTagCategories(ctx context.Context, articleID int64) ([]TagCategory, error)
- func (d *DB) ArticleTagIDs(ctx context.Context, articleID int64) ([]int64, error)
- func (d *DB) ArticleTagNames(ctx context.Context, articleID int64) ([]string, error)
- func (d *DB) ArticleTags(ctx context.Context, articleID int64) ([]string, error)
- func (d *DB) ArticleTitles(ctx context.Context, siteID int64, refs []string) (map[string]string, error)
- func (d *DB) ArticleVotes(ctx context.Context, articleID int64) ([]ArticleVote, error)
- func (d *DB) ArticlesByTag(ctx context.Context, siteID int64, categorySlug, name string, hidden []string) ([]Article, error)
- func (d *DB) AuthorRank(ctx context.Context, siteID int64, f AuthorRankFilter, offset, limit int) ([]AuthorRankRow, error)
- func (d *DB) AuthorRankOf(ctx context.Context, siteID int64, f AuthorRankFilter, userID int64) (*AuthorRankRow, error)
- func (d *DB) AuthorScoreTrend(ctx context.Context, userID int64, siteID *int64, hidden []string) ([]TrendPoint, error)
- func (d *DB) AuthorStats(ctx context.Context, userID int64, siteID *int64, hidden []string) (AuthorStats, error)
- func (d *DB) AuthoredPages(ctx context.Context, userID int64, pinnedOnly bool, from, before *time.Time, ...) ([]AuthoredPage, error)
- func (d *DB) AuthorsOfArticles(ctx context.Context, ids []int64) (map[int64][]User, error)
- func (d *DB) BlockUser(ctx context.Context, blockerID, blockedID int64, at time.Time) (bool, error)
- func (d *DB) BotByAPIKey(ctx context.Context, key string) (*User, error)
- func (d *DB) Breadcrumbs(ctx context.Context, articleID int64) ([]Article, error)
- func (d *DB) BumpForumSequences(ctx context.Context) error
- func (d *DB) CategoryCanCreateTags(ctx context.Context, siteID int64, category string) (string, error)
- func (d *DB) CategoryExists(ctx context.Context, siteID int64, name string) (bool, error)
- func (d *DB) CategoryIndexed(ctx context.Context, siteID int64, name string) (bool, error)
- func (d *DB) CategoryLook(ctx context.Context, siteID int64, name string) (CategoryLook, error)
- func (d *DB) CategoryNames(ctx context.Context, siteID int64) ([]string, error)
- func (d *DB) CategoryOverrides(ctx context.Context, siteID int64, category string) ([]perms.Override, error)
- func (d *DB) CategoryRatingMode(ctx context.Context, siteID int64, category string) (string, error)
- func (d *DB) CategoryRatingModes(ctx context.Context, siteID int64) (map[string]string, error)
- func (d *DB) ChildCount(ctx context.Context, articleID int64) (int, error)
- func (d *DB) ClearAddresses(ctx context.Context, userID *int64) (int64, error)
- func (d *DB) ClearConversations(ctx context.Context, userID int64, partnerIDs []int64) ([]int64, error)
- func (d *DB) ClearSanction(ctx context.Context, siteID, userID int64, kind string) error
- func (d *DB) Close()
- func (d *DB) CommentCount(ctx context.Context, articleID int64) (int, error)
- func (d *DB) CommentCountsOfArticles(ctx context.Context, ids []int64) (map[int64]int, error)
- func (d *DB) CommentInfo(ctx context.Context, articleID int64) (CommentInfo, error)
- func (d *DB) CommentThreadFor(ctx context.Context, siteID, articleID int64) (int64, error)
- func (d *DB) ConfirmEmailHold(ctx context.Context, id int64, email string, until time.Time) (bool, error)
- func (d *DB) ConversationAfter(ctx context.Context, userID, partnerID, after int64, limit int) ([]DirectMessage, error)
- func (d *DB) ConversationBefore(ctx context.Context, userID, partnerID int64, before *int64, limit int) ([]DirectMessage, error)
- func (d *DB) Conversations(ctx context.Context, userID int64) ([]Conversation, error)
- func (d *DB) CountArticles(ctx context.Context, f ListFilter, offset int, limit *int) (int, error)
- func (d *DB) CreateArticle(ctx context.Context, siteID int64, category, name, title string, ...) (int64, error)
- func (d *DB) CreateArticleVersion(ctx context.Context, w VersionWrite) (Revision, error)
- func (d *DB) CreateBot(ctx context.Context, siteID int64, username, apiKey string, at time.Time) (int64, error)
- func (d *DB) CreateFavouriteFolder(ctx context.Context, userID int64, name string, public bool, at time.Time) (int64, error)
- func (d *DB) CreateForumPost(ctx context.Context, w ForumPostWrite) (int64, error)
- func (d *DB) CreateForumThread(ctx context.Context, siteID int64, w ForumThreadWrite, source string) (int64, int64, error)
- func (d *DB) CreateInviteLink(ctx context.Context, siteID int64, ...) (int64, error)
- func (d *DB) CreateInvitedUser(ctx context.Context, email string, at time.Time) (int64, error)
- func (d *DB) CreateReport(ctx context.Context, siteID, reporterID, reportedID int64, ...) (int64, error)
- func (d *DB) CreateSite(ctx context.Context, s NewSite) (int64, error)
- func (d *DB) CreateTicket(ctx context.Context, siteID int64, kind, subject, body, page string, ...) (int64, error)
- func (d *DB) CreateTypedUser(ctx context.Context, username, displayName, hash, kind string, active bool, ...) (int64, error)
- func (d *DB) CreateUser(ctx context.Context, username, displayName, hash string, active bool, ...) (int64, error)
- func (d *DB) DefaultFolderPublic(ctx context.Context, userID int64) (bool, error)
- func (d *DB) DeleteAllNotifications(ctx context.Context, userID int64, kinds []string) (int64, error)
- func (d *DB) DeleteArticle(ctx context.Context, siteID, articleID int64, fullName string) error
- func (d *DB) DeleteArticleVotes(ctx context.Context, articleID int64) error
- func (d *DB) DeleteCategory(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteFavouriteFolder(ctx context.Context, userID, folderID int64) error
- func (d *DB) DeleteForumCategory(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteForumPost(ctx context.Context, postID int64) error
- func (d *DB) DeleteForumSection(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteIPBan(ctx context.Context, siteID, id int64) (string, error)
- func (d *DB) DeleteInvite(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteMirror(ctx context.Context, id int64) error
- func (d *DB) DeleteNotifications(ctx context.Context, userID int64, ids []int64) (int64, error)
- func (d *DB) DeleteRole(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteRoleCategory(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteSession(ctx context.Context, key string) error
- func (d *DB) DeleteSite(ctx context.Context, slug string) ([]string, error)
- func (d *DB) DeleteTag(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteTagCategory(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteTheme(ctx context.Context, siteID, id int64) error
- func (d *DB) DeleteUnreferencedWikidotUsers(ctx context.Context, ids []int64) (int64, error)
- func (d *DB) Devices(ctx context.Context, userID int64) ([]Device, error)
- func (d *DB) DirectMessageBlocked(ctx context.Context, blockerID, blockedID int64) (bool, error)
- func (d *DB) DropClaimCode(ctx context.Context, userID int64, hash string) error
- func (d *DB) DropEmailHold(ctx context.Context, id int64, email string) (bool, error)
- func (d *DB) EnabledPlugins(ctx context.Context, siteID int64) ([]string, error)
- func (d *DB) EndDevice(ctx context.Context, userID, id int64) (bool, error)
- func (d *DB) EndOtherDevices(ctx context.Context, userID int64, keep string) (int64, error)
- func (d *DB) EnsureTags(ctx context.Context, siteID int64, names []string) ([]int64, error)
- func (d *DB) EnsureWikidotUsers(ctx context.Context, users []ImportUser, at time.Time) (map[int64]int64, error)
- func (d *DB) FavouriteCountOf(ctx context.Context, userID, folderID int64) (int, error)
- func (d *DB) FavouriteFolders(ctx context.Context, userID int64) ([]FavouriteFolder, error)
- func (d *DB) FavouritesOf(ctx context.Context, userID, folderID int64, offset, limit int) ([]Favourite, error)
- func (d *DB) FileByID(ctx context.Context, fileID int64) (*FileRow, error)
- func (d *DB) FileSpaceUsage(ctx context.Context) (live, total int64, err error)
- func (d *DB) FillArticleAuthor(ctx context.Context, articleID, userID int64) (int64, error)
- func (d *DB) FillFileAuthor(ctx context.Context, articleID int64, name string, at time.Time, userID int64) (int64, error)
- func (d *DB) FillPostAuthor(ctx context.Context, postID, userID int64) (int64, error)
- func (d *DB) FillPostVersionAuthor(ctx context.Context, versionID, userID int64) (int64, error)
- func (d *DB) FillRevisionUser(ctx context.Context, articleID int64, revNumber int, userID int64) (int64, error)
- func (d *DB) FillThreadAuthor(ctx context.Context, siteID, threadID, userID int64) (int64, error)
- func (d *DB) FirstActivity(ctx context.Context, userID int64) (time.Time, error)
- func (d *DB) ForumCategories(ctx context.Context, siteID int64) ([]ForumCategory, error)
- func (d *DB) ForumCategory(ctx context.Context, siteID, id int64) (*ForumCategory, error)
- func (d *DB) ForumCategoryCounts(ctx context.Context, categoryID int64) (ForumCounts, error)
- func (d *DB) ForumCategoryLastPost(ctx context.Context, categoryID int64) (*ForumLastPost, error)
- func (d *DB) ForumCommentCounts(ctx context.Context, siteID int64) (ForumCounts, error)
- func (d *DB) ForumCommentLastPost(ctx context.Context, siteID int64) (*ForumLastPost, error)
- func (d *DB) ForumCommentThreads(ctx context.Context, siteID int64, sort ForumThreadSort, offset, limit int) ([]ForumThread, error)
- func (d *DB) ForumFirstPosts(ctx context.Context, threadIDs []int64) (map[int64]ForumThreadPost, error)
- func (d *DB) ForumPost(ctx context.Context, siteID, id int64) (*ForumThreadPost, error)
- func (d *DB) ForumPostContents(ctx context.Context, postIDs []int64) (map[int64]ForumPostContent, error)
- func (d *DB) ForumPostReplies(ctx context.Context, postID int64) ([]ForumThreadPost, error)
- func (d *DB) ForumPostSource(ctx context.Context, postID int64, at *time.Time) (string, error)
- func (d *DB) ForumPostVersions(ctx context.Context, postID int64) ([]ForumPostVersion, error)
- func (d *DB) ForumRootPostCount(ctx context.Context, threadID int64) (int, error)
- func (d *DB) ForumRootPostIDs(ctx context.Context, threadID int64) ([]int64, error)
- func (d *DB) ForumRootPosts(ctx context.Context, threadID int64, offset, limit int) ([]ForumThreadPost, error)
- func (d *DB) ForumSection(ctx context.Context, siteID, id int64) (*ForumSection, error)
- func (d *DB) ForumSectionOverrides(ctx context.Context, siteID int64, sectionIDs []int64) (map[int64][]perms.Override, error)
- func (d *DB) ForumSections(ctx context.Context, siteID int64) ([]ForumSection, error)
- func (d *DB) ForumThread(ctx context.Context, siteID, id int64) (*ForumThread, error)
- func (d *DB) ForumThreadLastPost(ctx context.Context, threadID int64, count int) (*ForumPost, error)
- func (d *DB) ForumThreadPostCount(ctx context.Context, threadID int64) (int, error)
- func (d *DB) ForumThreadPostCounts(ctx context.Context, threadIDs []int64) (map[int64]int, error)
- func (d *DB) ForumThreads(ctx context.Context, categoryID int64, sort ForumThreadSort, offset, limit int) ([]ForumThread, error)
- func (d *DB) ForumThreadsInCategories(ctx context.Context, categoryIDs []int64, offset, limit int) ([]ForumThread, error)
- func (d *DB) GrantRole(ctx context.Context, siteID, userID, roleID int64) error
- func (d *DB) HasFavourited(ctx context.Context, articleID, userID int64) (bool, error)
- func (d *DB) HasVoted(ctx context.Context, articleID int64, userID *int64) (bool, error)
- func (d *DB) HideAllOwnTickets(ctx context.Context, userID int64, at time.Time) (int64, error)
- func (d *DB) HideOwnTickets(ctx context.Context, userID int64, refs []OwnTicketRef, at time.Time) (int64, error)
- func (d *DB) HoldEmail(ctx context.Context, id int64, email string, siteID int64) error
- func (d *DB) IPBanned(ctx context.Context, siteID int64, addr netip.Addr, now time.Time) (bool, error)
- func (d *DB) IPBans(ctx context.Context, siteID int64) ([]IPBan, error)
- func (d *DB) ImportArticle(ctx context.Context, siteID int64, a ImportArticle) (int64, string, error)
- func (d *DB) ImportForumCategory(ctx context.Context, siteID, sectionID, want int64, name, description string, ...) (int64, *Renumbered, error)
- func (d *DB) ImportForumSection(ctx context.Context, siteID int64, name, description string) (int64, error)
- func (d *DB) ImportForumThread(ctx context.Context, siteID int64, t ImportThread, posts []ImportPost, ...) (int, []Renumbered, error)
- func (d *DB) ImportedCategory(ctx context.Context, siteID, sectionID int64, name string) (int64, error)
- func (d *DB) ImportedCommentThread(ctx context.Context, siteID, articleID int64) (int64, error)
- func (d *DB) ImportedSection(ctx context.Context, siteID int64, name string) (int64, error)
- func (d *DB) ImportedThread(ctx context.Context, siteID int64, section, category, name string, ...) (int64, error)
- func (d *DB) InstanceSiteSlugs(ctx context.Context) (map[string]bool, error)
- func (d *DB) IsBlocked(ctx context.Context, blockerID, blockedID int64) (bool, error)
- func (d *DB) IsSiteSuperuser(ctx context.Context, siteID, userID int64) (bool, error)
- func (d *DB) LastSeen(ctx context.Context, userID int64) (LastSeen, error)
- func (d *DB) LatestEditor(ctx context.Context, articleID int64) (*User, error)
- func (d *DB) LatestEditorsOfArticles(ctx context.Context, ids []int64) (map[int64]User, error)
- func (d *DB) LatestRevNumber(ctx context.Context, articleID int64) (int, error)
- func (d *DB) LatestSource(ctx context.Context, articleID int64) (string, error)
- func (d *DB) LikePost(ctx context.Context, postID, userID int64, at time.Time) (bool, error)
- func (d *DB) LikedPostCountOf(ctx context.Context, userID int64) (int, error)
- func (d *DB) LikedPostsOf(ctx context.Context, userID int64, offset, limit int) ([]LikedPost, error)
- func (d *DB) LinksTo(ctx context.Context, siteID int64, fullName string) ([]ExternalLink, error)
- func (d *DB) ListArticles(ctx context.Context, f ListFilter, offset int, limit *int) ([]Article, error)
- func (d *DB) LiveFileNamed(ctx context.Context, articleID int64, name string) (int64, error)
- func (d *DB) LogEntryByID(ctx context.Context, id int64) (LogEntry, error)
- func (d *DB) MarkConversationRead(ctx context.Context, userID, partnerID int64) (int64, error)
- func (d *DB) MarkEmailVerified(ctx context.Context, id int64, email string, at time.Time) (bool, error)
- func (d *DB) MarkNotificationsViewed(ctx context.Context, userID int64, ids []int64) error
- func (d *DB) MarkTokenUsed(ctx context.Context, token string, caseSensitive bool) error
- func (d *DB) MemberCount(ctx context.Context, siteID, roleID *int64) (int, error)
- func (d *DB) MemberSanctions(ctx context.Context, siteID, userID int64) ([]MemberSanction, error)
- func (d *DB) Members(ctx context.Context, siteID, roleID *int64, offset, limit int) ([]Member, error)
- func (d *DB) MembershipQuiz(ctx context.Context, siteID int64) (MembershipQuiz, error)
- func (d *DB) MergeUsers(ctx context.Context, from, into int64) ([]MergeMove, error)
- func (d *DB) MessagesBetween(ctx context.Context, userID, partnerID int64) ([]DirectMessage, error)
- func (d *DB) MessagesByIDs(ctx context.Context, userID, partnerID int64, ids []int64) ([]DirectMessage, error)
- func (d *DB) Mirror(ctx context.Context, id int64) (Mirror, error)
- func (d *DB) MirrorByName(ctx context.Context, wiki, page string) (Mirror, error)
- func (d *DB) MirrorReferrers(ctx context.Context, siteID int64, wiki, page string) ([]string, error)
- func (d *DB) MirrorSource(ctx context.Context, wiki, page string) (string, bool, error)
- func (d *DB) Mirrors(ctx context.Context, siteID int64) ([]Mirror, error)
- func (d *DB) MissingIncludes(ctx context.Context, siteID *int64) ([]MissingInclude, error)
- func (d *DB) MoveArticle(ctx context.Context, articleID int64, category, name, from string) error
- func (d *DB) MoveArticleParent(ctx context.Context, articleID int64, parentID *int64) error
- func (d *DB) MoveFavourite(ctx context.Context, userID, articleID, folderID int64) error
- func (d *DB) MuteArticle(ctx context.Context, userID, articleID int64) error
- func (d *DB) MuteThread(ctx context.Context, userID, threadID int64) error
- func (d *DB) MuteUser(ctx context.Context, userID, mutedID int64) error
- func (d *DB) Mutes(ctx context.Context, userID int64) ([]NotifyMute, error)
- func (d *DB) NotificationOf(ctx context.Context, userID, id int64) ([]Notification, error)
- func (d *DB) NotificationsOf(ctx context.Context, userID int64, cursor *int64, unread bool, kinds []string, ...) ([]Notification, error)
- func (d *DB) OpenInviteCount(ctx context.Context, siteID int64) (int, error)
- func (d *DB) OperationIndex(ctx context.Context, siteID, userID int64) (int, error)
- func (d *DB) OwnTicketCount(ctx context.Context, userID int64) (int, error)
- func (d *DB) OwnTicketDetail(ctx context.Context, userID int64, kind string, id int64) (OwnTicketDetail, error)
- func (d *DB) OwnTickets(ctx context.Context, userID int64, offset, limit int) ([]OwnTicket, error)
- func (d *DB) PermissionCatalog(ctx context.Context) ([]string, error)
- func (d *DB) PluginKVCount(ctx context.Context, siteID int64, plugin string) (int, error)
- func (d *DB) PluginKVDelete(ctx context.Context, siteID int64, plugin, key string) error
- func (d *DB) PluginKVGet(ctx context.Context, siteID int64, plugin, key string) ([]byte, error)
- func (d *DB) PluginKVSet(ctx context.Context, siteID int64, plugin, key string, value []byte) error
- func (d *DB) PostLikeCount(ctx context.Context, postID int64) (int, error)
- func (d *DB) PostLikeCounts(ctx context.Context, postIDs []int64) (map[int64]int, error)
- func (d *DB) PostLikers(ctx context.Context, postID int64, offset, limit int) ([]User, error)
- func (d *DB) PostVersionTimes(ctx context.Context, postID int64) ([]Stamped, error)
- func (d *DB) PostsLikedBy(ctx context.Context, userID int64, postIDs []int64) (map[int64]bool, error)
- func (d *DB) PreviousVersionSource(ctx context.Context, versionID int64) (string, error)
- func (d *DB) ProfileByID(ctx context.Context, id int64) (*Profile, error)
- func (d *DB) ProfileByName(ctx context.Context, name string) (*Profile, error)
- func (d *DB) ProfileExtras(ctx context.Context, userID int64) ([]ProfileField, []ProfileLink, error)
- func (d *DB) PublicFavourites(ctx context.Context, userID int64, defaultPublic bool, limit int) ([]PublicFavourite, error)
- func (d *DB) QuizAttempts(ctx context.Context, siteID, userID int64) ([]quiz.Attempt, error)
- func (d *DB) RatedBy(ctx context.Context, siteID, userID int64, offset, limit int) ([]RatedArticle, error)
- func (d *DB) RatedByCountOf(ctx context.Context, userID int64) (int, error)
- func (d *DB) RatedByOnEverySite(ctx context.Context, userID int64, offset, limit int) ([]RatedArticle, error)
- func (d *DB) RatingTrend(ctx context.Context, siteID, articleID int64, average bool) ([]TrendPoint, error)
- func (d *DB) RecentPostCount(ctx context.Context, siteID int64, categoryIDs []int64, comments bool) (int, error)
- func (d *DB) RecentPosts(ctx context.Context, siteID int64, categoryIDs []int64, comments bool, ...) ([]RecentPost, error)
- func (d *DB) ReleaseAudience(ctx context.Context) ([]int64, error)
- func (d *DB) RemoveFavourite(ctx context.Context, articleID, userID int64) error
- func (d *DB) RenameArticle(ctx context.Context, siteID, articleID int64, category, name, from string, ...) (Revision, error)
- func (d *DB) RenameFile(ctx context.Context, fileID int64, name string) (string, bool, error)
- func (d *DB) RenameUser(ctx context.Context, id int64, username, displayName string) error
- func (d *DB) ReplaceArticleLinks(ctx context.Context, siteID int64, from string, links []ArticleLink) error
- func (d *DB) ReplaceIncludeRefs(ctx context.Context, siteID int64, refs []IncludeRef) error
- func (d *DB) ReplaceVote(ctx context.Context, articleID, userID int64, rate *float64, roleID *int64, ...) (*Vote, error)
- func (d *DB) Report(ctx context.Context, siteID, id int64) (*Report, error)
- func (d *DB) ReportsSince(ctx context.Context, siteID, reporterID, reportedID int64, since time.Time) (int, error)
- func (d *DB) RequiredTags(ctx context.Context, siteID int64, category string, roleIDs []int64) ([][]string, error)
- func (d *DB) ReserveClaimCode(ctx context.Context, userID int64, hash string, ...) (bool, error)
- func (d *DB) ResetFields(ctx context.Context, id int64) (string, *time.Time, string, error)
- func (d *DB) ResetUserVotes(ctx context.Context, siteID, userID int64) (int64, error)
- func (d *DB) RestoreArticleVotes(ctx context.Context, articleID int64, votes []RestoredVote) error
- func (d *DB) RestoreFile(ctx context.Context, fileID int64) (string, bool, error)
- func (d *DB) RevertEmail(ctx context.Context, id int64, previous string, at time.Time) (bool, error)
- func (d *DB) ReviewReport(ctx context.Context, siteID, id int64, status, notes, reply string, by int64, ...) error
- func (d *DB) ReviewTicket(ctx context.Context, siteID, id int64, status, notes, reply string, by int64, ...) error
- func (d *DB) RevisionCount(ctx context.Context, articleID int64) (int, error)
- func (d *DB) RoleByRef(ctx context.Context, siteID int64, ref string) (*roles.Role, error)
- func (d *DB) RoleCategories(ctx context.Context, siteID int64) ([]RoleCategoryRow, error)
- func (d *DB) RoleIDsBySlug(ctx context.Context, siteID int64, slugs []string) (map[string]int64, error)
- func (d *DB) RoleIDsForUser(ctx context.Context, siteID, userID int64) ([]int64, error)
- func (d *DB) RolePermissions(ctx context.Context, ids []int64) ([]perms.Role, error)
- func (d *DB) RolesByUser(ctx context.Context, siteID, userID int64) ([]roles.Role, error)
- func (d *DB) RolesByUsers(ctx context.Context, siteID int64, userIDs []int64) (map[int64][]roles.Role, error)
- func (d *DB) RolesOfUserOnEverySite(ctx context.Context, userID int64) ([]SiteRoles, error)
- func (d *DB) SaveAdminUser(ctx context.Context, siteID int64, u AdminUserRow, builtin []string, ...) error
- func (d *DB) SaveCategory(ctx context.Context, siteID int64, c CategoryRow) error
- func (d *DB) SaveCategoryOverrides(ctx context.Context, categoryID int64, list []CategoryOverride) error
- func (d *DB) SaveForumCategory(ctx context.Context, siteID int64, c ForumCategoryRow) error
- func (d *DB) SaveForumSection(ctx context.Context, siteID int64, s ForumSectionRow) (int64, error)
- func (d *DB) SaveForumSectionOverrides(ctx context.Context, sectionID int64, list []CategoryOverride) error
- func (d *DB) SaveMembershipQuiz(ctx context.Context, siteID int64, q MembershipQuiz) error
- func (d *DB) SaveMirror(ctx context.Context, m Mirror) error
- func (d *DB) SaveProfileExtras(ctx context.Context, userID int64, fields []ProfileField, links []ProfileLink) error
- func (d *DB) SaveRole(ctx context.Context, siteID int64, r RoleRow, withGrants bool) (int64, error)
- func (d *DB) SaveRoleCategory(ctx context.Context, siteID int64, c RoleCategoryRow) error
- func (d *DB) SaveSession(ctx context.Context, key, data string, expires time.Time) error
- func (d *DB) SaveSite(ctx context.Context, s *Site, settings SiteSettings, withRoles bool) error
- func (d *DB) SaveTag(ctx context.Context, siteID int64, t TagRow) error
- func (d *DB) SaveTagCategory(ctx context.Context, siteID int64, c TagCategoryRow) error
- func (d *DB) SaveTagRule(ctx context.Context, categoryID int64, groups string, exempt []int64) error
- func (d *DB) SaveTheme(ctx context.Context, siteID int64, t ThemeRow) (int64, error)
- func (d *DB) SaveToolbarHiddenRoles(ctx context.Context, categoryID int64, roleIDs []int64) error
- func (d *DB) SaveUpdateState(ctx context.Context, s UpdateState) error
- func (d *DB) SearchArticles(ctx context.Context, f SearchFilter, offset, limit int) ([]SearchHit, error)
- func (d *DB) SearchCount(ctx context.Context, f SearchFilter) (int, error)
- func (d *DB) SearchForum(ctx context.Context, siteID int64, f ForumSearchFilter, offset, limit int) ([]ForumSearchHit, error)
- func (d *DB) SeenAddress(ctx context.Context, userID int64, address *netip.Addr, at time.Time) error
- func (d *DB) SeenDevice(ctx context.Context, key string, userID int64, siteID *int64, signedIn bool, ...) error
- func (d *DB) SendDirectMessage(ctx context.Context, senderID, recipientID int64, body string, at time.Time) (DirectMessage, error)
- func (d *DB) SendNotification(ctx context.Context, siteID int64, kind, meta string, recipients []int64, ...) error
- func (d *DB) SessionByKey(ctx context.Context, key string) (string, time.Time, error)
- func (d *DB) SetArticleAuthors(ctx context.Context, articleID int64, authorIDs []int64, userID *int64, ...) (Revision, bool, error)
- func (d *DB) SetArticleIndexed(ctx context.Context, siteID, id int64, indexed bool) error
- func (d *DB) SetArticleLock(ctx context.Context, articleID int64, locked bool) error
- func (d *DB) SetArticleParent(ctx context.Context, articleID int64, parentID *int64, userID *int64, ...) (Revision, error)
- func (d *DB) SetArticleTagIDs(ctx context.Context, articleID int64, tagIDs []int64) error
- func (d *DB) SetArticleTags(ctx context.Context, siteID, articleID int64, tags []string, allowCreate bool, ...) (Revision, bool, error)
- func (d *DB) SetArticleTitle(ctx context.Context, articleID int64, title string) error
- func (d *DB) SetDefaultFolderPublic(ctx context.Context, userID int64, public bool) error
- func (d *DB) SetEmail(ctx context.Context, id int64, email string) error
- func (d *DB) SetFavouriteFolderPublic(ctx context.Context, userID, folderID int64, public bool) error
- func (d *DB) SetIPBan(ctx context.Context, siteID int64, network netip.Prefix, until *time.Time, ...) (int64, error)
- func (d *DB) SetImportedParent(ctx context.Context, siteID, articleID, parentID int64) error
- func (d *DB) SetLastLogin(ctx context.Context, id int64, at time.Time, lang string) error
- func (d *DB) SetPassword(ctx context.Context, id int64, hash string) error
- func (d *DB) SetPendingEmail(ctx context.Context, id int64, email string) error
- func (d *DB) SetPins(ctx context.Context, userID int64, articleIDs []int64) error
- func (d *DB) SetPluginEnabled(ctx context.Context, siteID int64, plugin string, on bool) error
- func (d *DB) SetSanction(ctx context.Context, siteID, userID int64, kind string, until *time.Time, ...) error
- func (d *DB) SetSiteHosts(ctx context.Context, slug, domain, mediaDomain string) error
- func (d *DB) SetSiteSuperuser(ctx context.Context, siteID, userID int64, on bool, by int64, at time.Time) (bool, error)
- func (d *DB) SetSuperuser(ctx context.Context, id int64, on bool) error
- func (d *DB) SetUserPreference(ctx context.Context, userID int64, section, name, raw string) error
- func (d *DB) SetUsername(ctx context.Context, id int64, username, displayName string, at time.Time) error
- func (d *DB) SettleEmailHolds(ctx context.Context, now time.Time) ([]SettledEmail, error)
- func (d *DB) SiteByHosts(ctx context.Context, hosts []string) (*Site, error)
- func (d *DB) SiteBySlug(ctx context.Context, slug string) (*Site, error)
- func (d *DB) SiteCanCreateTags(ctx context.Context, siteID int64) (string, error)
- func (d *DB) SiteChangeCount(ctx context.Context, f SiteChangeFilter) (int, error)
- func (d *DB) SiteChanges(ctx context.Context, f SiteChangeFilter, offset, limit int) ([]SiteChange, error)
- func (d *DB) SiteDomains(ctx context.Context) ([]string, error)
- func (d *DB) SiteHostExists(ctx context.Context, host string) (bool, error)
- func (d *DB) SiteHosts(ctx context.Context) ([]string, error)
- func (d *DB) SiteRatingMode(ctx context.Context, siteID int64) (string, error)
- func (d *DB) SiteSettings(ctx context.Context, siteID int64) (SiteSettings, error)
- func (d *DB) SiteSize(ctx context.Context, siteID int64) (SiteSize, error)
- func (d *DB) SiteSlugs(ctx context.Context) ([]string, error)
- func (d *DB) SiteSources(ctx context.Context, siteID int64) (map[int64]string, error)
- func (d *DB) SiteStaff(ctx context.Context, siteID int64) ([]int64, error)
- func (d *DB) SiteSuperusers(ctx context.Context, siteID int64, among []int64) (map[int64]bool, error)
- func (d *DB) SitemapArticles(ctx context.Context, siteID int64, hidden []string) ([]Article, error)
- func (d *DB) SitemapThreads(ctx context.Context, siteID int64, sectionIDs []int64) ([]SitemapThread, error)
- func (d *DB) Sites(ctx context.Context) ([]Site, error)
- func (d *DB) SoftDeleteFile(ctx context.Context, fileID int64, at time.Time, byUserID *int64) (string, bool, error)
- func (d *DB) SourceAtRevision(ctx context.Context, articleID int64, revNumber int) (string, error)
- func (d *DB) StaffSitesOf(ctx context.Context, userID int64) ([]int64, error)
- func (d *DB) SubscribeToArticle(ctx context.Context, userID, articleID int64) error
- func (d *DB) SubscribeToThread(ctx context.Context, userID, threadID int64) error
- func (d *DB) SubscribedToArticle(ctx context.Context, userID, articleID int64) (bool, error)
- func (d *DB) SubscribedToThread(ctx context.Context, userID, threadID int64) (bool, error)
- func (d *DB) SuggestAuthors(ctx context.Context, siteID int64, typed string, limit int) ([]Suggestion, error)
- func (d *DB) SuggestCategories(ctx context.Context, siteID int64, hidden []string, typed string, limit int) ([]Suggestion, error)
- func (d *DB) SuggestTags(ctx context.Context, siteID int64, typed string, limit int) ([]Suggestion, error)
- func (d *DB) SuperuserCount(ctx context.Context) (int, error)
- func (d *DB) SuperuserRecipients(ctx context.Context) ([]Recipient, error)
- func (d *DB) SuspiciousUsers(ctx context.Context) ([]SuspiciousUser, error)
- func (d *DB) TagCategoryBySlug(ctx context.Context, siteID int64, slug string) (TagCategory, error)
- func (d *DB) TagCloud(ctx context.Context, siteID int64, limit *int) ([]CloudTag, error)
- func (d *DB) TagIDsByFullName(ctx context.Context, siteID int64, category, name string) ([]int64, error)
- func (d *DB) TagIDsByName(ctx context.Context, siteID int64, categorySlug, name string) ([]int64, error)
- func (d *DB) TagRule(ctx context.Context, categoryID int64) (string, []int64, error)
- func (d *DB) TagsCategories(ctx context.Context, siteID int64) ([]TagsCategory, error)
- func (d *DB) TagsOfArticles(ctx context.Context, ids []int64) (map[int64][]ArticleTag, error)
- func (d *DB) Theme(ctx context.Context, siteID, id int64) (ThemeRow, error)
- func (d *DB) ThemeByID(ctx context.Context, id int64) (*Theme, error)
- func (d *DB) Themes(ctx context.Context, siteID int64) ([]ThemeRow, error)
- func (d *DB) ThreadPostKeys(ctx context.Context, threadID int64) ([]PostKey, error)
- func (d *DB) ThreadPostTimes(ctx context.Context, threadID int64) ([]Stamped, error)
- func (d *DB) ThreadSubscribers(ctx context.Context, threadID int64) ([]int64, error)
- func (d *DB) TokenUsed(ctx context.Context, token string) (bool, error)
- func (d *DB) ToolbarHidden(ctx context.Context, siteID int64, category string, roleIDs []int64) (bool, error)
- func (d *DB) ToolbarHiddenRoles(ctx context.Context, categoryID int64) ([]int64, error)
- func (d *DB) UnblockUser(ctx context.Context, blockerID, blockedID int64) (bool, error)
- func (d *DB) UnclaimedWikidotUsers(ctx context.Context) ([]UserChoice, error)
- func (d *DB) UnknownTags(ctx context.Context, siteID int64, tags []string) ([]string, error)
- func (d *DB) UnlikePost(ctx context.Context, postID, userID int64) error
- func (d *DB) Unmute(ctx context.Context, userID int64, articleID, threadID, mutedID *int64) error
- func (d *DB) UnreadCounts(ctx context.Context, userID int64) (Unread, error)
- func (d *DB) UnreadMessages(ctx context.Context, userID int64) (int, error)
- func (d *DB) UnreadNotifications(ctx context.Context, userID int64) (int, error)
- func (d *DB) UnreferencedWikidotUsers(ctx context.Context) ([]UnusedUser, error)
- func (d *DB) UnsubscribeFromArticle(ctx context.Context, userID, articleID int64) (bool, error)
- func (d *DB) UnsubscribeFromThread(ctx context.Context, userID, threadID int64) (bool, error)
- func (d *DB) UpdateArticleTitle(ctx context.Context, articleID int64, title string, userID *int64, ...) (Revision, error)
- func (d *DB) UpdateForumPost(ctx context.Context, postID int64, name, source, previous string, ...) error
- func (d *DB) UpdateForumThread(ctx context.Context, threadID int64, e ForumThreadEdit) error
- func (d *DB) UpdateImportedArticle(ctx context.Context, siteID, articleID int64, u ImportUpdate) error
- func (d *DB) UpdateProfile(ctx context.Context, id int64, firstName, lastName, bio string, avatar *string, ...) error
- func (d *DB) UpdateSearchIndex(ctx context.Context, articleID int64, source, plaintext string) error
- func (d *DB) UpdateState(ctx context.Context) (UpdateState, error)
- func (d *DB) UseClaimCode(ctx context.Context, userID int64, hash string, now time.Time, maxAttempts int) (ClaimOutcome, error)
- func (d *DB) UserByAnyName(ctx context.Context, canonical, raw string) (*User, error)
- func (d *DB) UserByDisplayName(ctx context.Context, name string) (*User, error)
- func (d *DB) UserByEmail(ctx context.Context, email string) (*User, error)
- func (d *DB) UserByID(ctx context.Context, id int64) (*User, error)
- func (d *DB) UserByName(ctx context.Context, canonical string) (*User, error)
- func (d *DB) UserByUsername(ctx context.Context, name string) (*User, error)
- func (d *DB) UserByVerifiedEmail(ctx context.Context, email string) (*User, error)
- func (d *DB) UserByWikidotAlias(ctx context.Context, name string) (*User, error)
- func (d *DB) UserByWikidotName(ctx context.Context, name string) (*User, error)
- func (d *DB) UserForLogin(ctx context.Context, username string) (*User, string, error)
- func (d *DB) UserForSession(ctx context.Context, id int64) (*User, string, error)
- func (d *DB) UserIDsByName(ctx context.Context, name string, partial bool) ([]int64, error)
- func (d *DB) UserMentions(ctx context.Context) ([]string, error)
- func (d *DB) UserPostCount(ctx context.Context, authorID int64, categoryIDs, commentSites []int64, ...) (int, error)
- func (d *DB) UserPosts(ctx context.Context, authorID int64, categoryIDs, commentSites []int64, ...) ([]UserPost, error)
- func (d *DB) UserPreference(ctx context.Context, userID int64, section, name string) (string, error)
- func (d *DB) UserToClaim(ctx context.Context, canonical, spelled string) (*User, string, error)
- func (d *DB) UserVotes(ctx context.Context, userID int64, siteID *int64, from, before time.Time, ...) ([]UserVote, error)
- func (d *DB) UsernameChangedAt(ctx context.Context, id int64) (*time.Time, error)
- func (d *DB) UsernameTaken(ctx context.Context, name string) (bool, error)
- func (d *DB) UsernamesLower(ctx context.Context) (map[string]bool, error)
- func (d *DB) UsersByIDs(ctx context.Context, ids []int64) ([]User, error)
- func (d *DB) VerifiedEmailTaken(ctx context.Context, email string, except int64) (bool, error)
- func (d *DB) VoteByUser(ctx context.Context, articleID int64, userID *int64) (float64, bool, error)
- func (d *DB) VoteGroupRole(ctx context.Context, siteID int64, userID *int64) (*int64, error)
- func (d *DB) VoteStats(ctx context.Context, articleID int64) (VoteStats, error)
- func (d *DB) VoteStatsOfArticles(ctx context.Context, ids []int64) (map[int64]VoteStats, error)
- func (d *DB) WantedLinkCount(ctx context.Context, f WantedFilter) (int, error)
- func (d *DB) WantedLinks(ctx context.Context, f WantedFilter, offset, limit int) ([]WantedLink, error)
- func (d *DB) WikidotUserID(ctx context.Context, userID int64) (int64, error)
- func (d *DB) WithoutMuted(ctx context.Context, readers []int64, articleID, threadID, actorID *int64) ([]int64, error)
- func (d *DB) WriteAdminNote(ctx context.Context, n AdminNote) error
- func (d *DB) WriteRevertEntry(ctx context.Context, w RevertWrite) (Revision, error)
- type Device
- type DirectMessage
- type ExternalLink
- type Favourite
- type FavouriteFolder
- type FileRecord
- type FileRow
- type FileWrite
- type ForeignKey
- type ForumCategory
- type ForumCategoryRow
- type ForumCounts
- type ForumLastPost
- type ForumPost
- type ForumPostContent
- type ForumPostVersion
- type ForumPostWrite
- type ForumSearchFilter
- type ForumSearchHit
- type ForumSection
- type ForumSectionRow
- type ForumThread
- type ForumThreadEdit
- type ForumThreadPost
- type ForumThreadSort
- type ForumThreadWrite
- type IPBan
- type ImportArticle
- type ImportPost
- type ImportPostVersion
- type ImportRevision
- type ImportThread
- type ImportUpdate
- type ImportUser
- type ImportVote
- type IncludeRef
- type InviteRow
- type LastSeen
- type LikedPost
- type ListFilter
- type LogEntry
- type Member
- type MemberSanction
- type MembershipQuiz
- type MergeMove
- type Mirror
- type MissingInclude
- type NamedTag
- type NewSite
- type Notification
- type NotifyMute
- type NumFilter
- type OwnTicket
- type OwnTicketDetail
- type OwnTicketRef
- type PageCategoryCount
- type PostKey
- type Profile
- type ProfileField
- type ProfileLink
- type PublicFavourite
- type RatedArticle
- type RecentPost
- type Recipient
- type Renumbered
- type Report
- type ReportRow
- type RestoredVote
- type RevertWrite
- type Revision
- type RoleCategoryRow
- type RoleChoice
- type RoleRow
- type SearchFilter
- type SearchHit
- type SettledEmail
- type Site
- type SiteChange
- type SiteChangeFilter
- type SiteRoles
- type SiteSettings
- type SiteSize
- type SitemapThread
- type Sort
- type Stamped
- type Suggestion
- type SuspiciousUser
- type Tag
- type TagCategory
- type TagCategoryRow
- type TagRow
- type TagsCategory
- type Theme
- type ThemeRow
- type TicketRow
- type TimeFilter
- type TrendPoint
- type UnknownTagsError
- type Unread
- type UnusedUser
- type UpdateState
- type User
- type UserChoice
- type UserPost
- type UserVote
- type VersionWrite
- type Vote
- type VoteStats
- type WantedFilter
- type WantedLink
Constants ¶
const ( TicketKind = "ticket" MembershipApplyKind = "membershipapply" TicketPending = "pending" )
const ( AdminCreated = "create" AdminChanged = "change" AdminDeleted = "delete" )
const ( RenumberedCategory = "category" RenumberedThread = "thread" RenumberedPost = "post" )
const ( LogNew = "new" LogSource = "source" LogParent = "parent" LogTitle = "title" LogName = "name" LogAuthorship = "authorship" LogFileAdded = "file_added" LogFileDeleted = "file_deleted" LogFileRenamed = "file_renamed" )
const ( ThemeInline = "inline" ThemeExternal = "external" )
const ( MirrorOK = "ok" MirrorMissing = "missing" MirrorFailed = "failed" )
const ( LinkInclude = "include" LinkPlain = "link" )
const ( TimeRange = "range" TimeExcludeRange = "exclude_range" TimeLT = "lt" TimeLTE = "lte" TimeGT = "gt" TimeGTE = "gte" )
const ( NumEQ = "eq" NumNE = "ne" NumLT = "lt" NumLTE = "lte" NumGT = "gt" NumGTE = "gte" )
const ( SortCreatedAt = "created_at" SortCreatedBy = "created_by" SortName = "name" SortTitle = "title" SortUpdatedAt = "updated_at" SortFullName = "fullname" SortRating = "rating" SortVotes = "votes" SortPopularity = "popularity" SortRandom = "random" SortSize = "size" SortRevisions = "revisions" SortComments = "comments" )
const ( PageTypeNormal = "normal" PageTypeHidden = "hidden" )
const ( NotifyTicketResult = "ticket_result" ReportKind = "report" )
const ( NotifyWelcome = "welcome" NotifyNewPostReply = "new_post_reply" NotifyNewThreadPost = "new_thread_post" NotifyNewArticleRevision = "new_article_revision" NotifyForumMention = "forum_mention" NotifyDirectMessage = "direct_message" NotifyPostLike = "post_like" NotifyReleaseAvailable = "release_available" NotifyUpdateRolledBack = "update_rolled_back" NotifyNewTicket = "new_ticket" NotifyPageDeleted = "page_deleted" NotifyExternal = "external" )
const ( CreateTagsDefault = "default" CreateTagsDisabled = "disabled" CreateTagsEnabled = "enabled" )
const ( ReportReviewed = "reviewed" ReportDismissed = "dismissed" )
const ( EmailRequired = "required" EmailOptional = "optional" )
const ( TicketApproved = "approved" TicketRejected = "rejected" TicketClosed = "closed" )
const ( UserTypeNormal = "normal" UserTypeWikidot = "wikidot" UserTypeSystem = "system" UserTypeBot = "bot" )
const DefaultCategory = "_default"
const DefaultFolder int64 = 0
Every favourite lands here until its owner moves it.
const DeviceQuiet = 5 * time.Minute
const EnvDSN = "PWIKIT_TEST_DSN"
EnvDSN points database-backed tests at a live Postgres. It lives here rather than in a _test.go file because other packages' tests gate on the same name.
const EnvWriteDSN = "PWIKIT_TEST_WRITE_DSN"
A test that writes needs a database of its own. Rows it leaves standing for a moment are visible to every other package's tests while they run.
const LedgerTable = "pwikit_migration"
The migration ledger is rebuilt by replaying the migrations a restore names, so carrying its rows would fight with that.
const LogRevert = "revert"
const LogTags = "tags"
const (
LogVotesDeleted = "votes_deleted"
)
const LogWikidot = "wikidot"
LogWikidot marks a revision an import carried over whose kind this engine has no word for, such as a rename Wikidot recorded without keeping the source.
const MaxFavouriteFolders = 50
const MaxPins = 6
const NotifyAnnouncement = "announcement"
const NotifySection = "notify"
const ReportPending = "pending"
Variables ¶
var ( ErrTooManyFolders = errors.New("too many favourite folders") ErrFolderExists = errors.New("a favourite folder by that name exists") )
var ( ErrTagTaken = errors.New("db: tag already exists in its category") ErrTagCategorySlugTaken = errors.New("db: tag category slug already in use") ErrTagCategoryOrderTaken = errors.New("db: tag category priority already in use") ErrTagCategoryNotEmpty = errors.New("db: tag category still holds tags") )
var CommentKinds = []string{NotifyNewPostReply, NotifyNewThreadPost, NotifyForumMention, NotifyPostLike}
Every kind outside these, bar direct messages, is a notice.
var ErrMergeSame = errors.New("the two accounts are the same account")
var ErrMergeTwoWikidot = errors.New("both accounts carry a Wikidot identity")
var ErrNotFound = errors.New("db: not found")
var ErrSiteMissing = errors.New("no such site")
var ErrThemeSlugTaken = errors.New("db: theme slug already in use")
var MutableKinds = []string{NotifyNewArticleRevision, NotifyNewPostReply, NotifyNewThreadPost, NotifyForumMention, NotifyPostLike, NotifyExternal}
A deletion notice carries the only copy of the source, and tickets and welcomes need to be seen, so none of those can be turned off.
var ProfileFieldKeys = []string{"region", "gender", "birthday", "website"}
Functions ¶
func AppliedMigrations ¶
func BackupTables ¶
These take a connection rather than the pool, because a backup streams COPY and rebuilds the schema inside one transaction.
func BuiltinPermissions ¶
Resetting everyone or registered goes back to what a new site gives them.
func CreatingTagsAllowed ¶
Creating tags is off unless something turns it on, and the category has the last word.
func DeletedWikidotName ¶
func MediaName ¶
MediaName picks the name a file is stored under, which an importer needs before it copies the bytes into place.
func MissingTagGroups ¶
func NonEmptyTables ¶
func ParseTagGroups ¶
ParseTagGroups reads one group per line, the tags of a group split by spaces. A page needs at least one tag out of every group.
func QuoteLiteral ¶
CopyTo takes no arguments, so a value the query needs is put into the text after Postgres has quoted it.
func ResetIdentities ¶
The rows carry their own ids, so every identity column has to be told where to carry on from or the next insert collides with row one.
func RestoreForeignKeys ¶
Putting them back checks every row in bulk rather than a trigger at a time.
func SiteExportQuery ¶
func SiteExportQuery(ctx context.Context, conn *pgx.Conn, table string, keepPasswords bool) (string, error)
An empty return means the table does not travel.
func SiteScopeRuled ¶
func SiteScopeRuled() []string
SiteScopeRuled lets a test hold the schema and this file to each other.
func SiteSlugExists ¶
func TagFullName ¶
Types ¶
type AccountEmail ¶
type ActivityDay ¶
type AdminNoteRow ¶
type AdminPageRow ¶
type AdminPageRow struct {
ID int64
Category string
Name string
Title string
Revisions int
UpdatedAt time.Time
}
func (*AdminPageRow) FullName ¶
func (p *AdminPageRow) FullName() string
type AdminUserRow ¶
type AdminUserRow struct {
ID int64
Type string
Username string
WikidotUsername string
DisplayName string
Email string
Bio string
Avatar string
APIKey string
IsActive bool
InactiveUntil *time.Time
IsForumActive bool
ForumInactiveUntil *time.Time
CanSendDM bool
DMUntil *time.Time
IsSuperuser bool
SiteSuperuser bool
BotOfSite bool
Unclaimed bool
Banned bool
OperationIndex int
Roles []int64
}
func (AdminUserRow) ForumActiveAt ¶
func (u AdminUserRow) ForumActiveAt(now time.Time) bool
func (AdminUserRow) MessagesAt ¶
func (u AdminUserRow) MessagesAt(now time.Time) bool
type Announcement ¶
type Article ¶
type Article struct {
ID int64
Category string
Name string
Title string
ParentID *int64
Locked bool
CreatedAt time.Time
UpdatedAt time.Time
MediaName string
}
func (*Article) DisplayName ¶
DisplayName is what a breadcrumb or a link label shows when the page has no title of its own.
type ArticleFile ¶
type ArticleFileEntry ¶
type ArticleHead ¶
type ArticleLink ¶
type ArticleTag ¶
func (ArticleTag) FullName ¶
func (t ArticleTag) FullName() string
type ArticleVote ¶
type AuthorRankFilter ¶
type AuthorRankRow ¶
type AuthoredPage ¶
type CategoryLook ¶
type CategoryLook struct {
ThemeID *int64
}
type CategoryOverride ¶
type CategoryRow ¶
type CategoryRow struct {
ID int64
Name string
IsIndexed bool
Articles int
ThemeID *int64
Settings SiteSettings
Overrides []CategoryOverride
}
type ClaimOutcome ¶
type ClaimOutcome int
const ( ClaimMatched ClaimOutcome = iota ClaimMissing ClaimExpired ClaimWrong ClaimLocked )
type CommentInfo ¶
type Conversation ¶
type Conversation struct {
PartnerID int64
Last DirectMessage
Unread int
}
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) AccessCandidates ¶
func (*DB) AccountEmail ¶
func (*DB) ActivateInviteLink ¶
func (*DB) ActivateUser ¶
func (*DB) ActiveSanctions ¶
func (*DB) ActiveSites ¶
func (*DB) ActiveUsersByNames ¶
A mention names someone by the name they type, which is matched without case so a post that writes it differently still reaches them.
func (*DB) ActivityDays ¶
func (*DB) AddArticleFile ¶
func (*DB) AddArticleLogEntry ¶
func (d *DB) AddArticleLogEntry(ctx context.Context, articleID int64, userID *int64, kind, comment, meta string, at time.Time) (Revision, error)
The revision is numbered under a lock on this article alone, so two writers cannot pick the same number and neither waits on a page it is not touching.
func (*DB) AddArticleVersion ¶
func (d *DB) AddArticleVersion(ctx context.Context, articleID int64, source string, at time.Time) (int64, error)
The revision a revert writes names every piece it moved, so the pieces themselves leave no revisions of their own.
func (*DB) AddFavourite ¶
func (*DB) AddImportedVote ¶
func (*DB) AddQuizAttempt ¶
func (*DB) AdminCategories ¶
func (*DB) AdminCategory ¶
func (*DB) AdminForumCategories ¶
func (*DB) AdminForumCategory ¶
func (*DB) AdminForumSection ¶
func (*DB) AdminForumSections ¶
func (*DB) AdminInvites ¶
func (*DB) AdminNoteScreens ¶
func (*DB) AdminNotes ¶
func (*DB) AdminPageCategories ¶
func (*DB) AdminPages ¶
func (*DB) AdminReport ¶
func (*DB) AdminReports ¶
func (*DB) AdminRoles ¶
func (*DB) AdminTagCategories ¶
func (*DB) AdminTagCategory ¶
func (*DB) AdminTicket ¶
func (*DB) AdminTickets ¶
func (*DB) AdminUsers ¶
func (d *DB) AdminUsers(ctx context.Context, siteID int64, query, kind string, roleID int64, bannedOnly, byEmail, siteOnly bool, limit, offset int) ([]AdminUserRow, int, error)
Matching on email is a lookup by email, so it is only done for someone who may see the addresses anyway.
func (*DB) Announcement ¶
Announcement answers with ErrNotFound for one sent on another site, which this site's staff have no business reading.
func (*DB) AnnouncementAudience ¶
func (*DB) Announcements ¶
func (*DB) AppendImportedPost ¶
func (d *DB) AppendImportedPost(ctx context.Context, threadID int64, post ImportPost, replyTo *int64) (int64, *Renumbered, error)
func (*DB) ApplyPendingEmail ¶
func (*DB) ArticleAuthorIDs ¶
func (*DB) ArticleAuthors ¶
func (*DB) ArticleByID ¶
func (*DB) ArticleByName ¶
ArticleByName takes a page reference the way a URL spells it; dumbName puts the implicit category back so the generated column can match.
func (*DB) ArticleCategories ¶
func (*DB) ArticleChildren ¶
func (*DB) ArticleFavouriteCount ¶
func (*DB) ArticleFile ¶
func (d *DB) ArticleFile(ctx context.Context, siteID int64, articleRef, fileName string) (*ArticleFile, error)
ArticleFile resolves an attachment's on-disk names. ORDER BY id only makes an already-unique row deterministic.
func (*DB) ArticleFileList ¶
func (*DB) ArticleFileNames ¶
func (*DB) ArticleFiles ¶
The name is unique per article only among the rows still alive, so the id breaks the tie for a name that was deleted and uploaded again.
func (*DB) ArticleHasAuthor ¶
func (*DB) ArticleHead ¶
func (*DB) ArticleLastComment ¶
func (*DB) ArticleLog ¶
func (*DB) ArticleLogAbove ¶
func (*DB) ArticleLogCount ¶
func (*DB) ArticleSources ¶
func (d *DB) ArticleSources(ctx context.Context, siteID int64, refs []string) (map[string]string, error)
ArticleSources returns the newest version's source per article, keyed by the caller's own ref strings.
func (*DB) ArticleSubscribers ¶
func (*DB) ArticleTagCategories ¶
A category with no priority sorts under the page's tag count, which is the number it is compared with.
func (*DB) ArticleTagIDs ¶
func (*DB) ArticleTagNames ¶
ArticleTagNames is the list ftml is told about, where a tag outside the default category appears twice, prefixed and bare. Hidden tags stay in.
func (*DB) ArticleTags ¶
ArticleTags returns full names unsorted; the caller lowercases and sorts, because that pass belongs to whoever renders them.
func (*DB) ArticleTitles ¶
func (d *DB) ArticleTitles(ctx context.Context, siteID int64, refs []string) (map[string]string, error)
ArticleTitles keys its result by the caller's own ref strings. Refs with no article are absent from the map rather than present-and-empty: fetch_internal_links drops missing pages instead of reporting them as non-existent.
func (*DB) ArticleVotes ¶
func (*DB) ArticlesByTag ¶
func (d *DB) ArticlesByTag(ctx context.Context, siteID int64, categorySlug, name string, hidden []string) ([]Article, error)
ArticlesByTag leaves out the categories the visitor cannot see, which the caller resolves because permissions are not a database question.
func (*DB) AuthorRank ¶
func (d *DB) AuthorRank(ctx context.Context, siteID int64, f AuthorRankFilter, offset, limit int) ([]AuthorRankRow, error)
func (*DB) AuthorRankOf ¶
func (d *DB) AuthorRankOf(ctx context.Context, siteID int64, f AuthorRankFilter, userID int64) (*AuthorRankRow, error)
Nil means the author has no page that counts.
func (*DB) AuthorScoreTrend ¶
func (*DB) AuthorStats ¶
func (*DB) AuthoredPages ¶
func (*DB) AuthorsOfArticles ¶
func (*DB) Breadcrumbs ¶
Breadcrumbs walks up the parent chain and returns the root first. The seen array is what keeps a page that is its own ancestor from looping forever.
func (*DB) CategoryCanCreateTags ¶
func (d *DB) CategoryCanCreateTags(ctx context.Context, siteID int64, category string) (string, error)
A category with no row of its own reads the same as one left on default. Both hand the question back to the site.
func (*DB) CategoryExists ¶
The page skips the permission check entirely when neither it nor its category has a row, which is how a 404 wins over a 403 there.
func (*DB) CategoryIndexed ¶
func (*DB) CategoryLook ¶
A category nobody has saved yet has no row, and it looks like the site.
func (*DB) CategoryNames ¶
func (*DB) CategoryOverrides ¶
func (*DB) CategoryRatingMode ¶
CategoryRatingMode reports ErrNotFound for a category that has no row of its own as well as for one that exists without settings; both fall back to the site.
func (*DB) CategoryRatingModes ¶
func (*DB) ClearAddresses ¶
func (*DB) ClearConversations ¶
func (*DB) ClearSanction ¶
func (*DB) CommentCount ¶
func (*DB) CommentCountsOfArticles ¶
func (*DB) CommentInfo ¶
A page whose thread has never been created reports the zero value rather than having one written for it on a read.
func (*DB) CommentThreadFor ¶
A page gets its comment thread the first time a reader asks for the discussion, so reading the page never writes and the link still lands.
func (*DB) ConfirmEmailHold ¶
func (*DB) ConversationAfter ¶
func (*DB) ConversationBefore ¶
func (*DB) Conversations ¶
func (*DB) CountArticles ¶
Counted before pagination narrows it, so offset and limit still apply.
func (*DB) CreateArticle ¶
func (*DB) CreateArticleVersion ¶
The version and the revision naming it go in together, so a failed write cannot leave behind a version nothing points at.
func (*DB) CreateBot ¶
func (d *DB) CreateBot(ctx context.Context, siteID int64, username, apiKey string, at time.Time) (int64, error)
A bot signs in with its key rather than a password, so the password column holds the marker that makes every comparison fail.
func (*DB) CreateFavouriteFolder ¶
func (*DB) CreateForumPost ¶
The post, its first version and the thread's timestamp move together, so a post that fails halfway leaves no body-less row behind.
func (*DB) CreateForumThread ¶
func (d *DB) CreateForumThread(ctx context.Context, siteID int64, w ForumThreadWrite, source string) (int64, int64, error)
The thread and its first post go in together, so a thread that fails halfway does not show up empty in the category listing.
func (*DB) CreateInviteLink ¶
func (*DB) CreateInvitedUser ¶
func (*DB) CreateReport ¶
func (*DB) CreateTicket ¶
func (*DB) CreateTypedUser ¶
func (*DB) CreateUser ¶
func (*DB) DefaultFolderPublic ¶
The default folder has no row of its own, so whether it is public is kept with the owner's other profile switches.
func (*DB) DeleteAllNotifications ¶
func (*DB) DeleteArticle ¶
The files on disk are left to the caller, which is the only layer that knows where the state directory is.
func (*DB) DeleteArticleVotes ¶
func (*DB) DeleteCategory ¶
func (*DB) DeleteFavouriteFolder ¶
The pages in it go back to the default folder rather than being unfavourited.
func (*DB) DeleteForumCategory ¶
func (*DB) DeleteForumSection ¶
The overrides go in the same step as the section, so a section that cannot be deleted because categories remain keeps its permissions.
func (*DB) DeleteIPBan ¶
func (*DB) DeleteNotifications ¶
func (*DB) DeleteRoleCategory ¶
func (*DB) DeleteSite ¶
Rows elsewhere that pointed at what went are cleared, or removed when the pointer cannot be empty. An account is never removed.
func (*DB) DeleteTagCategory ¶
func (*DB) DeleteUnreferencedWikidotUsers ¶
func (*DB) DirectMessageBlocked ¶
func (*DB) DropClaimCode ¶
func (*DB) DropEmailHold ¶
func (*DB) EnabledPlugins ¶
func (*DB) EndOtherDevices ¶
func (*DB) EnsureTags ¶
EnsureTags resolves the tag names an archive carries, creating the ones this site has never had. It is the import's way in to the same resolution the editor uses, so a tag written here is the tag the editor would have made.
func (*DB) EnsureWikidotUsers ¶
func (d *DB) EnsureWikidotUsers(ctx context.Context, users []ImportUser, at time.Time) (map[int64]int64, error)
EnsureWikidotUsers answers the local id of every account the archive names, creating the ones this database has never seen.
func (*DB) FavouriteCountOf ¶
func (*DB) FavouriteFolders ¶
func (*DB) FavouritesOf ¶
func (d *DB) FavouritesOf(ctx context.Context, userID, folderID int64, offset, limit int) ([]Favourite, error)
Only the owner ever reads this, so no permission filter runs here. Whoever calls it has already established that the rows belong to the reader.
func (*DB) FileSpaceUsage ¶
func (*DB) FillArticleAuthor ¶
func (*DB) FillFileAuthor ¶
func (*DB) FillPostAuthor ¶
func (*DB) FillPostVersionAuthor ¶
func (*DB) FillRevisionUser ¶
func (*DB) FillThreadAuthor ¶
func (*DB) FirstActivity ¶
Zero means the person has done nothing yet.
func (*DB) ForumCategories ¶
func (*DB) ForumCategory ¶
func (*DB) ForumCategoryCounts ¶
func (*DB) ForumCategoryLastPost ¶
func (*DB) ForumCommentCounts ¶
func (*DB) ForumCommentLastPost ¶
func (*DB) ForumCommentThreads ¶
func (d *DB) ForumCommentThreads(ctx context.Context, siteID int64, sort ForumThreadSort, offset, limit int) ([]ForumThread, error)
func (*DB) ForumFirstPosts ¶
func (*DB) ForumPostContents ¶
func (*DB) ForumPostReplies ¶
func (*DB) ForumPostSource ¶
A post with no version behind it reads as empty rather than as missing, which is the same thing the thread page shows for it.
func (*DB) ForumPostVersions ¶
func (*DB) ForumRootPostCount ¶
func (*DB) ForumRootPostIDs ¶
func (*DB) ForumRootPosts ¶
func (*DB) ForumSection ¶
func (*DB) ForumSectionOverrides ¶
func (*DB) ForumSections ¶
func (*DB) ForumThread ¶
func (*DB) ForumThreadLastPost ¶
func (*DB) ForumThreadPostCount ¶
func (*DB) ForumThreadPostCounts ¶
func (*DB) ForumThreads ¶
func (d *DB) ForumThreads(ctx context.Context, categoryID int64, sort ForumThreadSort, offset, limit int) ([]ForumThread, error)
func (*DB) ForumThreadsInCategories ¶
func (*DB) HasFavourited ¶
func (*DB) HideAllOwnTickets ¶
func (*DB) HideOwnTickets ¶
func (*DB) ImportArticle ¶
func (d *DB) ImportArticle(ctx context.Context, siteID int64, a ImportArticle) (int64, string, error)
ImportArticle writes one page and its whole history as the archive recorded it. It goes around the ordinary save path on purpose, since that one renumbers revisions, rebuilds links and tells subscribers about every one of them.
func (*DB) ImportForumCategory ¶
func (*DB) ImportForumSection ¶
func (*DB) ImportForumThread ¶
func (d *DB) ImportForumThread(ctx context.Context, siteID int64, t ImportThread, posts []ImportPost, parents []int) (int, []Renumbered, error)
ImportForumThread writes a thread and its posts together. A reply names its parent by the position the parent holds in posts, so the caller flattens the tree with every parent ahead of its children.
func (*DB) ImportedCategory ¶
func (*DB) ImportedCommentThread ¶
func (*DB) ImportedSection ¶
func (*DB) ImportedThread ¶
func (*DB) InstanceSiteSlugs ¶
func (*DB) IsSiteSuperuser ¶
func (*DB) LatestEditor ¶
func (*DB) LatestEditorsOfArticles ¶
func (*DB) LatestRevNumber ¶
func (*DB) LatestSource ¶
func (*DB) LikePost ¶
A false answer means the like was already there, which is how the caller knows not to tell the author a second time.
func (*DB) LikedPostCountOf ¶
func (*DB) LikedPostsOf ¶
func (*DB) ListArticles ¶
func (*DB) LiveFileNamed ¶
func (*DB) LogEntryByID ¶
func (*DB) MarkConversationRead ¶
func (*DB) MarkEmailVerified ¶
func (*DB) MarkNotificationsViewed ¶
func (*DB) MarkTokenUsed ¶
func (*DB) MemberCount ¶
func (*DB) MemberSanctions ¶
func (*DB) MembershipQuiz ¶
A site that never saved a quiz gets the defaults, switched off.
func (*DB) MergeUsers ¶
func (*DB) MessagesBetween ¶
func (*DB) MessagesByIDs ¶
func (*DB) MirrorByName ¶
func (*DB) MirrorReferrers ¶
func (*DB) MirrorSource ¶
func (*DB) MissingIncludes ¶
func (*DB) MoveArticle ¶
func (*DB) MoveArticleParent ¶
func (*DB) MoveFavourite ¶
func (*DB) MuteArticle ¶
func (*DB) NotificationOf ¶
func (*DB) NotificationsOf ¶
func (*DB) OpenInviteCount ¶
func (*DB) OperationIndex ¶
func (*DB) OwnTicketCount ¶
func (*DB) OwnTicketDetail ¶
func (*DB) OwnTickets ¶
func (*DB) PermissionCatalog ¶
func (*DB) PluginKVCount ¶
func (*DB) PluginKVDelete ¶
func (*DB) PluginKVGet ¶
func (*DB) PluginKVSet ¶
func (*DB) PostLikeCount ¶
func (*DB) PostLikeCounts ¶
func (*DB) PostLikers ¶
func (*DB) PostVersionTimes ¶
func (*DB) PostsLikedBy ¶
func (*DB) PreviousVersionSource ¶
func (*DB) ProfileByName ¶
func (*DB) ProfileExtras ¶
func (d *DB) ProfileExtras(ctx context.Context, userID int64) ([]ProfileField, []ProfileLink, error)
func (*DB) PublicFavourites ¶
func (d *DB) PublicFavourites(ctx context.Context, userID int64, defaultPublic bool, limit int) ([]PublicFavourite, error)
The caller still filters out pages the viewer may not see.
func (*DB) QuizAttempts ¶
func (*DB) RatedByCountOf ¶
func (*DB) RatedByOnEverySite ¶
func (*DB) RatingTrend ¶
func (d *DB) RatingTrend(ctx context.Context, siteID, articleID int64, average bool) ([]TrendPoint, error)
Votes from before the history was kept count from when they were cast, or from the page's creation when that is unknown, so the last point is the rating now.
func (*DB) RecentPostCount ¶
func (*DB) RecentPosts ¶
func (*DB) RemoveFavourite ¶
func (*DB) RenameArticle ¶
func (d *DB) RenameArticle(ctx context.Context, siteID, articleID int64, category, name, from string, userID *int64, at time.Time) (Revision, error)
What a page points at moves with it, but what points at the page does not. Everyone who linked to the old name keeps linking to the old name.
func (*DB) RenameFile ¶
A file that is already in the asked-for state reports no name, which is how the caller knows to leave it out of the revision it writes.
func (*DB) RenameUser ¶
func (*DB) ReplaceArticleLinks ¶
func (d *DB) ReplaceArticleLinks(ctx context.Context, siteID int64, from string, links []ArticleLink) error
The whole set is replaced under one transaction, so nobody reads a page as having no links at all while it is being saved.
func (*DB) ReplaceIncludeRefs ¶
func (*DB) ReplaceVote ¶
func (d *DB) ReplaceVote(ctx context.Context, articleID, userID int64, rate *float64, roleID *int64, at time.Time) (*Vote, error)
The vote that was there comes back, since the action log records what changed rather than what it changed to.
func (*DB) ReportsSince ¶
func (*DB) RequiredTags ¶
func (d *DB) RequiredTags(ctx context.Context, siteID int64, category string, roleIDs []int64) ([][]string, error)
RequiredTags is nil when the category asks for nothing or one of the roles is exempt.
func (*DB) ReserveClaimCode ¶
func (d *DB) ReserveClaimCode(ctx context.Context, userID int64, hash string, now, expires, notBefore time.Time) (bool, error)
The check and the write are one statement, so two sends racing for the same account cannot both get through.
func (*DB) ResetFields ¶
func (*DB) ResetUserVotes ¶
func (*DB) RestoreArticleVotes ¶
A vote whose voter is gone is dropped rather than failing the restore, since the row it would need points at a user that no longer exists.
func (*DB) RestoreFile ¶
func (*DB) RevertEmail ¶
func (*DB) ReviewReport ¶
func (*DB) ReviewTicket ¶
func (*DB) RevisionCount ¶
func (*DB) RoleCategories ¶
func (*DB) RoleIDsBySlug ¶
func (d *DB) RoleIDsBySlug(ctx context.Context, siteID int64, slugs []string) (map[string]int64, error)
A slug with no row is left out rather than created, because a read path must not write.
func (*DB) RoleIDsForUser ¶
func (*DB) RolePermissions ¶
RolePermissions answers in the order the ids arrived, and a role with no rows of its own still comes back so the merge sees it.
func (*DB) RolesByUser ¶
Ordered the way the name tail and showcase queries both consume it. The tie- break on id covers the rows whose index is not unique.
func (*DB) RolesByUsers ¶
func (*DB) RolesOfUserOnEverySite ¶
func (*DB) SaveAdminUser ¶
func (*DB) SaveCategory ¶
func (*DB) SaveCategoryOverrides ¶
func (*DB) SaveForumCategory ¶
func (*DB) SaveForumSection ¶
func (*DB) SaveForumSectionOverrides ¶
func (*DB) SaveMembershipQuiz ¶
func (*DB) SaveProfileExtras ¶
func (d *DB) SaveProfileExtras(ctx context.Context, userID int64, fields []ProfileField, links []ProfileLink) error
func (*DB) SaveRoleCategory ¶
func (*DB) SaveSession ¶
func (*DB) SaveTagCategory ¶
func (*DB) SaveTagRule ¶
func (*DB) SaveToolbarHiddenRoles ¶
func (*DB) SaveUpdateState ¶
func (d *DB) SaveUpdateState(ctx context.Context, s UpdateState) error
func (*DB) SearchArticles ¶
func (*DB) SearchCount ¶
func (*DB) SearchForum ¶
func (d *DB) SearchForum(ctx context.Context, siteID int64, f ForumSearchFilter, offset, limit int) ([]ForumSearchHit, error)
func (*DB) SeenAddress ¶
func (*DB) SeenDevice ¶
func (*DB) SendDirectMessage ¶
func (*DB) SendNotification ¶
func (d *DB) SendNotification(ctx context.Context, siteID int64, kind, meta string, recipients []int64, at time.Time) error
The notification and the rows naming its readers go in together, so nobody ends up with a notification that reaches no one.
func (*DB) SessionByKey ¶
func (*DB) SetArticleAuthors ¶
func (d *DB) SetArticleAuthors(ctx context.Context, articleID int64, authorIDs []int64, userID *int64, at time.Time) (Revision, bool, error)
An empty list means the caller had nothing to say, not that the page should lose the credit it has.
func (*DB) SetArticleIndexed ¶
func (*DB) SetArticleLock ¶
func (*DB) SetArticleParent ¶
func (*DB) SetArticleTagIDs ¶
The revision that records this is written by the caller, so nothing is logged here.
func (*DB) SetArticleTags ¶
func (d *DB) SetArticleTags(ctx context.Context, siteID, articleID int64, tags []string, allowCreate bool, userID *int64, at time.Time) (Revision, bool, error)
A name with a space in it is dropped rather than refused, so one bad entry does not cost the page the rest of its tags.
func (*DB) SetArticleTitle ¶
func (*DB) SetDefaultFolderPublic ¶
func (*DB) SetFavouriteFolderPublic ¶
func (*DB) SetImportedParent ¶
func (*DB) SetLastLogin ¶
func (*DB) SetPendingEmail ¶
func (*DB) SetPins ¶
Pages pinned before keep their pin time, and anything past MaxPins or not written by the user is left out.
func (*DB) SetPluginEnabled ¶
func (*DB) SetSanction ¶
func (*DB) SetSiteHosts ¶
func (*DB) SetSiteSuperuser ¶
func (*DB) SetUserPreference ¶
func (*DB) SetUsername ¶
func (*DB) SettleEmailHolds ¶
Rows are locked and skipped rather than waited on, so two requests settling at once never apply the same hold twice.
func (*DB) SiteByHosts ¶
SiteByHosts tries each host in turn and returns the first that matches. Callers pass site.LookupHosts, whose ordering carries the host:port round that has to run before the bare-host one.
func (*DB) SiteCanCreateTags ¶
SiteCanCreateTags reads the site row alone. The page asks Site.settings, which never merges the category or the built-in defaults into it.
func (*DB) SiteChangeCount ¶
func (*DB) SiteChanges ¶
func (d *DB) SiteChanges(ctx context.Context, f SiteChangeFilter, offset, limit int) ([]SiteChange, error)
func (*DB) SiteHostExists ¶
func (*DB) SiteRatingMode ¶
func (*DB) SiteSettings ¶
func (*DB) SiteSources ¶
func (*DB) SiteSuperusers ¶
func (*DB) SitemapArticles ¶
func (*DB) SitemapThreads ¶
func (*DB) SoftDeleteFile ¶
func (*DB) SourceAtRevision ¶
A revision that only renamed or retagged the page records no version, so the source of the newest earlier revision that does is the source it had.
func (*DB) StaffSitesOf ¶
func (*DB) SubscribeToArticle ¶
func (*DB) SubscribeToThread ¶
func (*DB) SubscribedToArticle ¶
func (*DB) SubscribedToThread ¶
func (*DB) SuggestAuthors ¶
func (*DB) SuggestCategories ¶
func (*DB) SuggestTags ¶
func (*DB) SuperuserRecipients ¶
func (*DB) SuspiciousUsers ¶
func (d *DB) SuspiciousUsers(ctx context.Context) ([]SuspiciousUser, error)
func (*DB) TagCategoryBySlug ¶
func (*DB) TagCloud ¶
The limit lands after the busiest tags come first, so it decides which tags are in the cloud and not just how many.
func (*DB) TagIDsByFullName ¶
func (d *DB) TagIDsByFullName(ctx context.Context, siteID int64, category, name string) ([]int64, error)
A name without a category matches that tag in every category, which is what makes one name able to name several tags.
func (*DB) TagIDsByName ¶
func (*DB) TagsCategories ¶
func (*DB) TagsOfArticles ¶
func (*DB) ThreadPostKeys ¶
func (*DB) ThreadPostTimes ¶
func (*DB) ThreadSubscribers ¶
func (*DB) ToolbarHidden ¶
func (*DB) ToolbarHiddenRoles ¶
func (*DB) UnblockUser ¶
func (*DB) UnclaimedWikidotUsers ¶
func (d *DB) UnclaimedWikidotUsers(ctx context.Context) ([]UserChoice, error)
func (*DB) UnknownTags ¶
func (*DB) UnreadCounts ¶
func (*DB) UnreadMessages ¶
func (*DB) UnreadNotifications ¶
func (*DB) UnreferencedWikidotUsers ¶
func (d *DB) UnreferencedWikidotUsers(ctx context.Context) ([]UnusedUser, error)
func (*DB) UnsubscribeFromArticle ¶
func (*DB) UnsubscribeFromThread ¶
func (*DB) UpdateArticleTitle ¶
func (d *DB) UpdateArticleTitle(ctx context.Context, articleID int64, title string, userID *int64, at time.Time) (Revision, error)
The old title is read under the same lock that replaces it, so the revision cannot name a title some other writer has already moved past.
func (*DB) UpdateForumPost ¶
func (d *DB) UpdateForumPost(ctx context.Context, postID int64, name, source, previous string, authorID *int64, at time.Time) error
A body that did not change leaves no version, so the edit history only holds the times the text actually moved.
func (*DB) UpdateForumThread ¶
func (*DB) UpdateImportedArticle ¶
func (*DB) UpdateProfile ¶
func (*DB) UpdateSearchIndex ¶
func (*DB) UpdateState ¶
func (d *DB) UpdateState(ctx context.Context) (UpdateState, error)
func (*DB) UseClaimCode ¶
func (*DB) UserByAnyName ¶
func (*DB) UserByDisplayName ¶
The oldest row wins so a later account cannot take over a name a page already points at.
func (*DB) UserByName ¶
UserByName looks up a canonical username against both the local and the Wikidot name. Callers pass wikidot.CanonicalizeUsername output.
func (*DB) UserByUsername ¶
A page list that filters by author names the account as it is spelled here, never as it was on the site an imported account came from.
func (*DB) UserByVerifiedEmail ¶
func (*DB) UserByWikidotAlias ¶
func (*DB) UserByWikidotName ¶
The stored name is whatever the other site displayed, so canonicalizing first would compare a spaced name against a hyphenated one and never match.
func (*DB) UserForLogin ¶
func (*DB) UserForSession ¶
UserForSession returns the password hash alongside the user because the session carries a hash of it; a session opened under an older password has to stop working. The hash is kept out of User so it cannot travel by accident.
func (*DB) UserIDsByName ¶
func (*DB) UserMentions ¶
Pages and posts name accounts in [[user]] blocks, which hold no reference the database can see.
func (*DB) UserPostCount ¶
func (*DB) UserPreference ¶
func (*DB) UserToClaim ¶
The hash comes back because an unusable one is what tells a row waiting to be claimed apart from somebody's live account.
func (*DB) UsernameChangedAt ¶
func (*DB) UsernameTaken ¶
func (*DB) UsernamesLower ¶
func (*DB) VerifiedEmailTaken ¶
func (*DB) VoteByUser ¶
func (*DB) VoteGroupRole ¶
VoteGroupRole answers which role a vote is filed under. The two built-in roles outrank the user's own, and for an anonymous reader only everyone can.
func (*DB) VoteStatsOfArticles ¶
func (*DB) WantedLinkCount ¶
func (*DB) WantedLinks ¶
func (d *DB) WantedLinks(ctx context.Context, f WantedFilter, offset, limit int) ([]WantedLink, error)
The link table has no order of its own, so the row id is what keeps a page of results from reshuffling between requests.
func (*DB) WikidotUserID ¶
func (*DB) WithoutMuted ¶
func (d *DB) WithoutMuted(ctx context.Context, readers []int64, articleID, threadID, actorID *int64) ([]int64, error)
WithoutMuted drops the readers who muted the page or thread a notice is about, or the person whose doing it is. Pass nil for whatever does not apply.
func (*DB) WriteRevertEntry ¶
type DirectMessage ¶
type ExternalLink ¶
type FileRecord ¶
type ForeignKey ¶
func LiftForeignKeys ¶
LiftForeignKeys takes the references off so rows can arrive in any order. Two of them point at each other, so no load order satisfies every one.
type ForumCategory ¶
type ForumCategoryRow ¶
type ForumCounts ¶
type ForumLastPost ¶
type ForumLastPost struct {
ID int64
CreatedAt time.Time
ThreadID int64
ThreadName string
ThreadCategoryID *int64
ThreadArticleID *int64
AuthorID *int64
}
ForumLastPost carries ids rather than rows so the caller can reach for the article and the author through the lookups it already has.
type ForumPostContent ¶
type ForumPostVersion ¶
type ForumPostWrite ¶
type ForumSearchFilter ¶
type ForumSearchFilter struct {
Words []string
AuthorID *int64
From, To *time.Time
CategoryID *int64
Comments bool
// A thread of its own matches only inside these sections, even by CategoryID.
Sections []int64
}
Comments keeps to the threads under pages and wins over CategoryID.
type ForumSearchHit ¶
type ForumSection ¶
type ForumSectionRow ¶
type ForumThread ¶
type ForumThreadEdit ¶
type ForumThreadPost ¶
type ForumThreadSort ¶
type ForumThreadSort int
const ( ForumThreadsByReply ForumThreadSort = iota ForumThreadsByStart )
type ForumThreadWrite ¶
type ImportArticle ¶
type ImportArticle struct {
Category string
Name string
Title string
Locked bool
CreatedAt time.Time
UpdatedAt time.Time
AuthorID *int64
// Indexed is the newest source. The import has no renderer, so the raw text
// stands in for the rendering until the page is next edited.
Indexed string
Revisions []ImportRevision
Votes []ImportVote
TagIDs []int64
}
type ImportPost ¶
type ImportPostVersion ¶
type ImportRevision ¶
type ImportThread ¶
type ImportUpdate ¶
type ImportUser ¶
type ImportVote ¶
type IncludeRef ¶
type LikedPost ¶
type LikedPost struct {
SiteID int64
Post ForumThreadPost
ThreadName string
LikedAt time.Time
}
type ListFilter ¶
type ListFilter struct {
SiteID int64
Hidden []string
PageType string
Name string
HasName bool
NamePrefix string
HasNamePrefix bool
NoTags bool
RequiredTags []int64
PresentTags []int64
AbsentTags []int64
ExactTags []int64
NotID *int64
Categories []string
NotCategories []string
HasParent bool
ParentID *int64
HasNotParent bool
NotParentID *int64
AuthorID *int64
SameAuthorsAs *int64
NotSameAuthorsAs *int64
LinkTo string
HasLinkTo bool
CreatedAt *TimeFilter
UpdatedAt *TimeFilter
Rating *NumFilter
Votes *NumFilter
Popularity *NumFilter
RatingMode string
Sort Sort
}
type MemberSanction ¶
type MembershipQuiz ¶
type MissingInclude ¶
type Notification ¶
type NotifyMute ¶
type OwnTicketDetail ¶
type OwnTicketRef ¶
type PageCategoryCount ¶
type ProfileField ¶
type ProfileLink ¶
type PublicFavourite ¶
type RatedArticle ¶
type RecentPost ¶
type Renumbered ¶
type RestoredVote ¶
type RevertWrite ¶
type RoleCategoryRow ¶
type RoleChoice ¶
func (RoleChoice) Label ¶
func (c RoleChoice) Label() string
type RoleRow ¶
type RoleRow struct {
ID int64
Slug string
Name string
ShortName string
CategoryID *int64
Index int
IsStaff bool
GroupVotes bool
VotesTitle string
InlineVisualMode string
ProfileVisualMode string
Color string
Icon string
BadgeText string
BadgeBg string
BadgeTextColor string
BadgeShowBorder bool
Allow []string
Deny []string
Users int
}
type SearchFilter ¶
type SearchFilter struct {
Words []string
Category string
AuthorID *int64
Include [][]int64
Exclude []int64
From *time.Time
To *time.Time
Hidden []string
SiteID int64
}
func (SearchFilter) CountSQL ¶
func (f SearchFilter) CountSQL() (string, []any)
type SettledEmail ¶
type Site ¶
type Site struct {
ID int64
Slug string
Title string
Headline string
Domain string
MediaDomain string
HomePage string
Icon string
ThemeID *int64
SystemThemeID *int64
AuthIcon string
SignupNotice string
PasswordHelp string
Welcome string
SignupOpen bool
MembershipPasswordEnabled bool
MembershipPassword string
MembershipPasswordRoleID *int64
ApplicationRoleID *int64
DefaultRoleID *int64
VerifiedRoleID *int64
EmailPolicy string
Language string
TimeZone string
LanguageFollowsVisitor bool
SelfVotesForbidden bool
EditForbiddenHint string
DeletionNoticeEnabled bool
DeletionNotice string
}
type SiteChange ¶
type SiteChangeFilter ¶
type SiteSettings ¶
type Suggestion ¶
type SuspiciousUser ¶
type TagCategoryRow ¶
type TagsCategory ¶
type TimeFilter ¶
End is the first moment after the period. Range and ExcludeRange read both ends, the rest read only the end the operator names.
type TrendPoint ¶
type UnknownTagsError ¶
type UnknownTagsError struct {
Names []string
}
func (*UnknownTagsError) Error ¶
func (e *UnknownTagsError) Error() string
type UnusedUser ¶
type UpdateState ¶
type UpdateState struct {
CheckedAt *time.Time
CheckError string
NextCheckAt *time.Time
LatestVersion string
LatestPublishedAt *time.Time
LatestPostgres string
LatestNotes string
ScheduledVersion string
ScheduledAt *time.Time
ScheduledByHand bool
PostponedUntil *time.Time
SkippedVersion string
FailedVersions []string
PinnedVersion string
LastFrom string
LastTo string
LastOutcome string
LastError string
LastAt *time.Time
RollbackVersion string
RollbackKind string
RollbackExpiresAt *time.Time
}
type User ¶
type User struct {
ID int64
Type string
Username string
WikidotUsername string
DisplayName string
Avatar string
IsActive bool
InactiveUntil *time.Time
IsSuperuser bool
IsForumActive bool
ForumInactiveUntil *time.Time
CanSendDirectMessages bool
DirectMessagesUntil *time.Time
EmailVerifiedAt *time.Time
Language string
}
func (*User) ActiveAt ¶
A deadline in the future overrides the stored flag in both directions, so is_active is ignored whenever inactive_until is set.
func (*User) DisplayLabel ¶
type UserChoice ¶
type VersionWrite ¶
type WantedFilter ¶
type WantedLink ¶
Source Files
¶
- access.go
- account_write.go
- address.go
- announcement.go
- archive_ids.go
- archive_repair.go
- archive_update.go
- archive_write.go
- article.go
- article_delete.go
- article_log.go
- article_meta.go
- article_revert.go
- article_row.go
- article_write.go
- author_rank.go
- backup.go
- backup_scope.go
- category_admin.go
- category_tags.go
- category_toolbar.go
- chrome.go
- claim_code.go
- db.go
- email_hold.go
- email_write.go
- favourite_folder.go
- favourite_write.go
- file.go
- file_write.go
- forum.go
- forum_admin.go
- forum_overrides.go
- forum_search.go
- forum_write.go
- include_mirror.go
- ip_ban.go
- like_write.go
- links.go
- listpages.go
- member.go
- member_sanction.go
- membership_quiz.go
- message.go
- message_write.go
- my_tickets.go
- mypages.go
- notification.go
- notify_mute.go
- notify_write.go
- options.go
- page_admin.go
- perms.go
- plugins.go
- profile.go
- profile_activity.go
- profile_extras.go
- rating.go
- rating_trend.go
- report_admin.go
- role.go
- role_write.go
- search.go
- search_suggest.go
- search_write.go
- session.go
- session_device.go
- site.go
- site_delete.go
- site_settings.go
- site_superuser.go
- site_write.go
- sitechanges.go
- sitemap.go
- tag.go
- tag_admin.go
- tag_write.go
- theme_write.go
- ticket_admin.go
- update.go
- user.go
- user_admin.go
- user_merge.go
- user_prune.go
- vote.go
- wantedpages.go