Documentation
¶
Index ¶
- Constants
- func ClientFor(db *sql.DB) *generated.Client
- func CommentOnPublicNode() predicate.Comment
- func ContentListPredicate(ctx context.Context) predicate.Node
- func Dialect() string
- func GetClient(ctx context.Context, defaultClient *generated.Client) *generated.Client
- func InTxDriver(d string, eq entsql.ExecQuerier) dialect.Driver
- func NewDynamicContentRepositoryFactory(client *generated.Client, contentTypeRepo entity.ContentTypeRepository, ...) ...
- func NodeIDsWithField(ctx context.Context, client *generated.Client, fs entity.FieldStorageDef) ([]int, bool, error)
- func OnContentChange(client *generated.Client, changed func())
- func OrderByCounter(column string, desc bool) node.OrderOption
- func OrderByViewDays(since int, desc bool) node.OrderOption
- func OrderRandom(s *entsql.Selector)
- func Rebind(query string) string
- func RebuildSearchIndex(ctx context.Context, client *generated.Client) (int, error)
- func SealSecrets(ctx context.Context, db *sql.DB) (int, map[string]int, error)
- func SecretsKeyWeak() bool
- func SecretsSealed() bool
- func SetContentListFilter(fn func(ctx context.Context) func(*entsql.Selector))
- func SetDialect(d string)
- func SetSecrets(b *secretbox.Box)
- func TodayStartSite() time.Time
- func TxDriver(ctx context.Context) (dialect.Driver, bool)
- func UnreadableSecrets(ctx context.Context, db *sql.DB) (map[string]int, error)
- func ViewDaysSince(days int) int
- func WithContentListFilter(ctx context.Context, predicates []predicate.Node) []predicate.Node
- type AccountSettingsRepository
- type BlockRepository
- func (r BlockRepository) BlockByID(ctx context.Context, id int) (*entity.BlockDef, error)
- func (r BlockRepository) BlockByMachineName(ctx context.Context, name string) (*entity.BlockDef, error)
- func (r BlockRepository) Blocks(ctx context.Context, theme string) ([]entity.BlockWithPlacement, error)
- func (r BlockRepository) CopyPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
- func (r BlockRepository) CreateBlock(ctx context.Context, b entity.BlockDef, p entity.BlockPlacementDef) (*entity.BlockDef, error)
- func (r BlockRepository) CreateMenuPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
- func (r BlockRepository) CreatePluginPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
- func (r BlockRepository) CreateViewPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
- func (r BlockRepository) DeleteBlock(ctx context.Context, id int) error
- func (r BlockRepository) DeletePlacement(ctx context.Context, placementID int) error
- func (r BlockRepository) MachineNameTaken(ctx context.Context, name string, excludeID int) (bool, error)
- func (r BlockRepository) PlacementByBlockID(ctx context.Context, blockID int, theme string) (*entity.BlockPlacementDef, error)
- func (r BlockRepository) PlacementByID(ctx context.Context, id int) (*entity.BlockPlacementDef, error)
- func (r BlockRepository) PublishedPlacementsByRegion(ctx context.Context, theme string, region entity.Region) ([]entity.BlockWithPlacement, error)
- func (r BlockRepository) ReorderPlacements(ctx context.Context, updates []entity.BlockPlacementOrderUpdate) error
- func (r BlockRepository) SearchBlocks(ctx context.Context, query string, limit int) ([]entity.BlockDef, error)
- func (r BlockRepository) ThemeHasPlacements(ctx context.Context, theme string) (bool, error)
- func (r BlockRepository) UpdateBlock(ctx context.Context, b entity.BlockDef) (*entity.BlockDef, error)
- func (r BlockRepository) UpdatePlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
- type BlockedBotRepository
- type BlockedIPRepository
- type BreadcrumbRuleRepository
- func (r BreadcrumbRuleRepository) BreadcrumbRuleByID(ctx context.Context, id int) (*entity.BreadcrumbRuleDef, error)
- func (r BreadcrumbRuleRepository) BreadcrumbRules(ctx context.Context) (entity.BreadcrumbRuleDefs, error)
- func (r BreadcrumbRuleRepository) CreateBreadcrumbRule(ctx context.Context, d entity.BreadcrumbRuleDef) (*entity.BreadcrumbRuleDef, error)
- func (r BreadcrumbRuleRepository) DeleteBreadcrumbRule(ctx context.Context, id int) error
- func (r BreadcrumbRuleRepository) UpdateBreadcrumbRule(ctx context.Context, d entity.BreadcrumbRuleDef) (*entity.BreadcrumbRuleDef, error)
- func (r BreadcrumbRuleRepository) UpdateBreadcrumbRuleWeight(ctx context.Context, id, weight int) error
- type CaptchaSettingsRepository
- type CommentRepository
- func (r CommentRepository) ByCreatedByPaginated(ctx context.Context, userID int, status int8, limit int, offset int) (entity.Comments, error)
- func (r CommentRepository) ByID(ctx context.Context, id int) (*entity.Comment, error)
- func (r CommentRepository) ByNodeID(ctx context.Context, nid int, status int8) (entity.Comments, error)
- func (r CommentRepository) ByNodeIDPaginated(ctx context.Context, nid int, status int8, limit int, offset int) (entity.Comments, error)
- func (r CommentRepository) CountByNodeID(ctx context.Context, nid int, status int8, rootOnly bool) (int, error)
- func (r CommentRepository) CountByNodeIDs(ctx context.Context, nids []int, status int8, rootOnly bool) (map[int]int, error)
- func (r CommentRepository) CountCommentsWithPathLEQ(ctx context.Context, nid int, status int8, path string) (int, error)
- func (r CommentRepository) Create(ctx context.Context, c *entity.Comment) (*entity.Comment, error)
- func (r CommentRepository) Delete(ctx context.Context, id int) error
- func (r CommentRepository) DeleteByNodeID(ctx context.Context, nodeID int) error
- func (r CommentRepository) DescendantIDs(ctx context.Context, id int) ([]int, error)
- func (r CommentRepository) Find(ctx context.Context, filter entity.CommentsFilter) (entity.Comments, error)
- func (r CommentRepository) GetCommentPath(ctx context.Context, commentID int) (string, error)
- func (r CommentRepository) GetLatestComments(ctx context.Context, limit int, status int8, excludeTypes []string) (entity.Comments, error)
- func (r CommentRepository) HasDuplicate(ctx context.Context, authorID int, content string, since time.Time) (bool, error)
- func (r CommentRepository) ListForAdmin(ctx context.Context, filter entity.AdminCommentsListFilter) (entity.Comments, int, error)
- func (r CommentRepository) ListRecentPublished(ctx context.Context, status int8, excludeTypes []string, limit int, offset int) (entity.Comments, int, error)
- func (r CommentRepository) NodeIDsByAuthor(ctx context.Context, userID int) ([]int, error)
- func (r CommentRepository) SetStatus(ctx context.Context, id int, status int8, reason string) error
- func (r CommentRepository) SpamBefore(ctx context.Context, before time.Time) ([]int, error)
- func (r CommentRepository) TotalCount(ctx context.Context, filter entity.CommentsFilter) (int, error)
- func (r CommentRepository) Update(ctx context.Context, id int, c *entity.Comment) (*entity.Comment, error)
- type CommentSettingsRepository
- type ContentTypeRepository
- func (r ContentTypeRepository) AttachExistingField(ctx context.Context, contentTypeID, fieldStorageID int, label string, ...) (*entity.FieldInstanceDef, error)
- func (r ContentTypeRepository) ContentTypeByID(ctx context.Context, id int) (*entity.ContentTypeDef, error)
- func (r ContentTypeRepository) ContentTypeByMachineName(ctx context.Context, machineName string) (*entity.ContentTypeDef, error)
- func (r ContentTypeRepository) ContentTypes(ctx context.Context) (entity.ContentTypeDefs, error)
- func (r ContentTypeRepository) CountFieldValues(ctx context.Context, contentTypeID, fieldID int, ...) (int, error)
- func (r ContentTypeRepository) CreateContentType(ctx context.Context, ct entity.ContentTypeDef) (*entity.ContentTypeDef, error)
- func (r ContentTypeRepository) CreateField(ctx context.Context, f entity.FieldInstanceDef) (*entity.FieldInstanceDef, error)
- func (r ContentTypeRepository) DeleteContentType(ctx context.Context, id int) error
- func (r ContentTypeRepository) DeleteField(ctx context.Context, id int) error
- func (r ContentTypeRepository) FieldByID(ctx context.Context, id int) (*entity.FieldInstanceDef, error)
- func (r ContentTypeRepository) FieldDateValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]time.Time, error)
- func (r ContentTypeRepository) FieldInstanceLabelsByFieldStorageIDs(ctx context.Context, fieldStorageIDs []int) (map[int]string, error)
- func (r ContentTypeRepository) FieldNumberValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]float64, error)
- func (r ContentTypeRepository) FieldSets(ctx context.Context) (entity.ContentTypeDefs, error)
- func (r ContentTypeRepository) FieldStorageByID(ctx context.Context, id int) (*entity.FieldStorageDef, error)
- func (r ContentTypeRepository) FieldStorageUsage(ctx context.Context, storageID int) (entity.FieldStorageUsage, error)
- func (r ContentTypeRepository) FieldStorages(ctx context.Context) (entity.FieldStorageDefs, error)
- func (r ContentTypeRepository) FieldTaxonomyMultiValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int][]int, error)
- func (r ContentTypeRepository) FieldTaxonomyValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]int, error)
- func (r ContentTypeRepository) FieldTextValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]string, error)
- func (r ContentTypeRepository) FieldValues(ctx context.Context, nodeID int, fields entity.FieldInstanceDefs) (map[int]any, error)
- func (r ContentTypeRepository) FieldValuesForNodes(ctx context.Context, nodeIDs []int, fields entity.FieldInstanceDefs) (map[int]map[int]any, error)
- func (r ContentTypeRepository) FieldsByContentTypeID(ctx context.Context, contentTypeID int) (entity.FieldInstanceDefs, error)
- func (r ContentTypeRepository) NodesWithSeveralFieldValues(ctx context.Context, storage entity.FieldStorageDef) ([]int, error)
- func (r ContentTypeRepository) RichTextFieldStorageIDs(ctx context.Context, fieldStorageIDs []int) (map[int]bool, error)
- func (r ContentTypeRepository) SetFieldMultiple(ctx context.Context, storageID int, multiple bool) error
- func (r ContentTypeRepository) SetFieldValues(ctx context.Context, nodeID int, fields entity.FieldInstanceDefs, ...) error
- func (r ContentTypeRepository) TextFormatIDsByNode(ctx context.Context, nodeID int, fields entity.FieldInstanceDefs) (map[int]int, error)
- func (r ContentTypeRepository) UpdateContentType(ctx context.Context, ct entity.ContentTypeDef) (*entity.ContentTypeDef, error)
- func (r ContentTypeRepository) UpdateField(ctx context.Context, f entity.FieldInstanceDef) (*entity.FieldInstanceDef, error)
- func (r ContentTypeRepository) UpdateFieldDetailDisplay(ctx context.Context, fieldID int, d entity.FieldDetailDisplay) error
- func (r ContentTypeRepository) UpdateFieldSortOrder(ctx context.Context, fieldID int, sortOrder int, formGroupID *int) error
- type DashboardRepository
- func (r *DashboardRepository) OnModeration(ctx context.Context) (int, error)
- func (r *DashboardRepository) Popular(ctx context.Context, q entity.PopularQuery) ([]entity.PopularNode, int, error)
- func (r *DashboardRepository) Stats(ctx context.Context, since, today time.Time) (entity.DashboardStats, error)
- type DateFormatRepository
- func (r *DateFormatRepository) CreateDateFormat(ctx context.Context, f entity.DateFormat) (int, error)
- func (r *DateFormatRepository) DateFormatByID(ctx context.Context, id int) (*entity.DateFormat, error)
- func (r *DateFormatRepository) DateFormatUsage(ctx context.Context, machineName string) ([]string, error)
- func (r *DateFormatRepository) DateFormats(ctx context.Context) ([]entity.DateFormat, error)
- func (r *DateFormatRepository) DeleteDateFormat(ctx context.Context, id int) error
- func (r *DateFormatRepository) InstanceDateFormats(ctx context.Context) (map[string]string, error)
- func (r *DateFormatRepository) UpdateDateFormat(ctx context.Context, f entity.DateFormat) error
- type DynamicContentRepository
- func (r DynamicContentRepository) ByNodeID(ctx context.Context, nodeID int) (*entity.DynamicContent, error)
- func (r DynamicContentRepository) Create(ctx context.Context, e *entity.DynamicContent) (*entity.DynamicContent, error)
- func (r DynamicContentRepository) Update(ctx context.Context, e *entity.DynamicContent) (*entity.DynamicContent, error)
- type EntUnitOfWork
- type FileFocalPoints
- type FileRepository
- func (r FileRepository) ByID(ctx context.Context, id int) (*entity.File, error)
- func (r FileRepository) ByIDs(ctx context.Context, ids []int) (map[int]entity.File, error)
- func (r FileRepository) ByURI(ctx context.Context, uri string) (*entity.File, error)
- func (r FileRepository) Create(ctx context.Context, uri, mimeType string, width, height, sizeBytes int, ...) (*entity.File, error)
- func (r FileRepository) SetFocal(ctx context.Context, id int, focal *entity.FocalPoint) error
- func (r FileRepository) SetOriginalFilename(ctx context.Context, id int, name string) error
- func (r FileRepository) UpdateAlt(ctx context.Context, id int, alt string) error
- type ImageStyleRepository
- func (r ImageStyleRepository) CreateImageStyle(ctx context.Context, s entity.ImageStyleDef) (*entity.ImageStyleDef, error)
- func (r ImageStyleRepository) DeleteImageStyle(ctx context.Context, id int) error
- func (r ImageStyleRepository) ImageStyleByID(ctx context.Context, id int) (*entity.ImageStyleDef, error)
- func (r ImageStyleRepository) ImageStyleByName(ctx context.Context, name string) (*entity.ImageStyleDef, error)
- func (r ImageStyleRepository) ImageStyles(ctx context.Context) (entity.ImageStyleDefs, error)
- func (r ImageStyleRepository) UpdateImageStyle(ctx context.Context, s entity.ImageStyleDef) (*entity.ImageStyleDef, error)
- type ImageStyleRepositoryAdapter
- type IntegrationSettingsRepository
- type InterfacePackRepository
- func (r *InterfacePackRepository) Delete(ctx context.Context, lang string) error
- func (r *InterfacePackRepository) Install(ctx context.Context, p entity.InterfacePack, strings []entity.InterfaceString) error
- func (r *InterfacePackRepository) Packs(ctx context.Context) ([]entity.InterfacePack, error)
- func (r *InterfacePackRepository) Strings(ctx context.Context) ([]entity.InterfaceString, error)
- type InterfaceStringRepository
- type MailLogRepository
- func (r *MailLogRepository) Add(ctx context.Context, e entity.MailLogEntry) error
- func (r *MailLogRepository) DeleteBefore(ctx context.Context, t time.Time) error
- func (r *MailLogRepository) LastSent(ctx context.Context) (map[string]time.Time, error)
- func (r *MailLogRepository) List(ctx context.Context, f entity.MailLogFilter) ([]entity.MailLogEntry, int, error)
- type MailSettingsRepository
- type MailTemplateRepository
- type MaintenanceRepository
- type MediaRepository
- func (r *MediaRepository) MediaFiles(ctx context.Context, f entity.MediaFilter) ([]entity.File, int, error)
- func (r *MediaRepository) MediaTotals(ctx context.Context) (entity.MediaTotals, error)
- func (r *MediaRepository) MediaUploaders(ctx context.Context) ([]entity.User, error)
- func (r *MediaRepository) MediaUseCounts(ctx context.Context, fileIDs []int) (map[int]int, error)
- func (r *MediaRepository) MediaUses(ctx context.Context, fileID int) ([]entity.MediaUse, error)
- type MenuRepository
- func (r MenuRepository) CreateMenu(ctx context.Context, m entity.MenuDef) (*entity.MenuDef, error)
- func (r MenuRepository) CreateMenuLink(ctx context.Context, l entity.MenuLinkDef) (*entity.MenuLinkDef, error)
- func (r MenuRepository) DeleteMenu(ctx context.Context, id int) error
- func (r MenuRepository) DeleteMenuLink(ctx context.Context, id int) error
- func (r MenuRepository) MenuByID(ctx context.Context, id int) (*entity.MenuDef, error)
- func (r MenuRepository) MenuByMachineName(ctx context.Context, machineName string) (*entity.MenuDef, error)
- func (r MenuRepository) MenuLinkByID(ctx context.Context, id int) (*entity.MenuLinkDef, error)
- func (r MenuRepository) MenuLinksByMenuID(ctx context.Context, menuID int) (entity.MenuLinkDefs, error)
- func (r MenuRepository) Menus(ctx context.Context) (entity.MenuDefs, error)
- func (r MenuRepository) ReorderMenuLinks(ctx context.Context, updates []entity.MenuLinkOrderUpdate) error
- func (r MenuRepository) UpdateMenu(ctx context.Context, m entity.MenuDef) (*entity.MenuDef, error)
- func (r MenuRepository) UpdateMenuLink(ctx context.Context, l entity.MenuLinkDef) (*entity.MenuLinkDef, error)
- type ModuleRepository
- func (r *ModuleRepository) CountRows(ctx context.Context, table string) (int, error)
- func (r *ModuleRepository) DeleteMenuLinks(ctx context.Context, paths []string) error
- func (r *ModuleRepository) DeletePluginPlacements(ctx context.Context, ids []entity.PluginBlockID) error
- func (r *ModuleRepository) PluginPlacements(ctx context.Context, ids []entity.PluginBlockID) ([]entity.PluginPlacementRef, error)
- func (r *ModuleRepository) SetEnabled(ctx context.Context, name string, enabled bool) error
- func (r *ModuleRepository) States(ctx context.Context) (map[string]bool, error)
- type ModuleUninstallRepository
- func (r *ModuleUninstallRepository) ClearFieldFormatters(ctx context.Context, names []string) error
- func (r *ModuleUninstallRepository) DeleteMailTexts(ctx context.Context, prefix string) error
- func (r *ModuleUninstallRepository) DeleteMailTransportSettings(ctx context.Context, transports []string) error
- func (r *ModuleUninstallRepository) DeleteNodeTypeSettings(ctx context.Context, types []string) error
- func (r *ModuleUninstallRepository) DeleteViewCriteria(ctx context.Context, prefix string) error
- func (r *ModuleUninstallRepository) DeleteVocabularyIfUnused(ctx context.Context, vid int) (bool, error)
- func (r *ModuleUninstallRepository) FileIDs(ctx context.Context, columns [][2]string) ([]int, error)
- func (r *ModuleUninstallRepository) NodeIDsOfTypes(ctx context.Context, types []string, limit int) ([]int, error)
- func (r *ModuleUninstallRepository) RemoveTextFilters(ctx context.Context, names []string) (map[int][]string, error)
- type NodeCounterRepository
- type NodeDeleteRepository
- type NodeRepository
- func (r NodeRepository) AnyWithViewRoles(ctx context.Context) (bool, error)
- func (r NodeRepository) ByID(ctx context.Context, nodeID int) (*entity.Node, error)
- func (r NodeRepository) ByIDs(ctx context.Context, ids []int) (map[int]entity.Node, error)
- func (r NodeRepository) BySlug(ctx context.Context, slug string) (*entity.Node, error)
- func (r NodeRepository) ByType(ctx context.Context, nodeType string) (entity.Nodes, error)
- func (r NodeRepository) ClearSchedule(ctx context.Context, nodeID int) error
- func (r NodeRepository) CountByType(ctx context.Context, nodeType string) (int, error)
- func (r NodeRepository) CountPathNodes(ctx context.Context, nodeType string, onlyAuto bool) (int, error)
- func (r NodeRepository) CountPublicSitemapNodes(ctx context.Context, excludeTypes []string) (int, error)
- func (r NodeRepository) CreateRow(ctx context.Context, n entity.Node) (int, error)
- func (r NodeRepository) DueToPublish(ctx context.Context, now time.Time) ([]int, error)
- func (r NodeRepository) DueToUnpublish(ctx context.Context, now time.Time) ([]int, error)
- func (r NodeRepository) ListForAdmin(ctx context.Context, filter entity.AdminNodesFilter) (*entity.Nodes, int, error)
- func (r NodeRepository) ListForFeed(ctx context.Context, filter entity.FeedNodeFilter) (entity.Nodes, error)
- func (r NodeRepository) ListPublicSitemapNodes(ctx context.Context, excludeTypes []string, limit, offset int) ([]entity.SitemapNodeRow, error)
- func (r NodeRepository) PageSEO(ctx context.Context, nodeID int) (entity.PageSEO, error)
- func (r NodeRepository) PathBatch(ctx context.Context, nodeType string, afterID, limit int, onlyAuto bool) (entity.Nodes, error)
- func (r NodeRepository) RestoreNode(ctx context.Context, nodeID int) error
- func (r NodeRepository) Schedule(ctx context.Context) (entity.NodeSchedule, error)
- func (r NodeRepository) SearchByTitle(ctx context.Context, query string, types []string, limit int) ([]entity.NodeSearchHit, error)
- func (r NodeRepository) SetLangcode(ctx context.Context, nodeID int, code string) error
- func (r NodeRepository) SetPath(ctx context.Context, nodeID int, slug string, auto bool) error
- func (r NodeRepository) SetPublishing(ctx context.Context, nodeID, status, onModeration int) error
- func (r NodeRepository) SlugExists(ctx context.Context, slug string) (bool, error)
- func (r NodeRepository) SlugExistsExcludingNode(ctx context.Context, slug string, excludeNodeID int) (bool, error)
- func (r NodeRepository) TrashNode(ctx context.Context, nodeID, by int, at time.Time) error
- func (r NodeRepository) TrashedBefore(ctx context.Context, before time.Time) ([]int, error)
- func (r NodeRepository) TrashedNodes(ctx context.Context, limit, offset int) (entity.Nodes, int, error)
- func (r NodeRepository) URLsByIDs(ctx context.Context, ids []int) (map[int]string, error)
- func (r NodeRepository) UpdateOnModeration(ctx context.Context, nodeID int, onModeration int) error
- func (r NodeRepository) UpdateRow(ctx context.Context, n entity.Node) error
- func (r NodeRepository) UpdateStatus(ctx context.Context, nodeID int, status int) error
- func (r NodeRepository) UpsertPageSEO(ctx context.Context, nodeID int, metaTitle, metaDescription string) error
- type NodeRevisionRepository
- func (r NodeRevisionRepository) ByID(ctx context.Context, nodeID, id int) (*entity.NodeRevision, error)
- func (r NodeRevisionRepository) Create(ctx context.Context, rev entity.NodeRevision) (int, error)
- func (r NodeRevisionRepository) Latest(ctx context.Context, nodeID int) (*entity.NodeRevision, error)
- func (r NodeRevisionRepository) List(ctx context.Context, nodeID, offset, limit int) ([]entity.NodeRevision, int, error)
- func (r NodeRevisionRepository) Prune(ctx context.Context, nodeID, keep int) error
- func (r NodeRevisionRepository) Recent(ctx context.Context, f entity.RecentRevisionsFilter) ([]entity.RecentRevision, int, error)
- type OAuthSettingsRepository
- func (r *OAuthSettingsRepository) LinkedAccounts(ctx context.Context) (map[string]int, error)
- func (r *OAuthSettingsRepository) List(ctx context.Context) (map[string]entity.OAuthProviderSettings, error)
- func (r *OAuthSettingsRepository) Upsert(ctx context.Context, s entity.OAuthProviderSettings) error
- type PreviewLinkRepository
- func (r *PreviewLinkRepository) DeletePreviewLinks(ctx context.Context, nodeID int) error
- func (r *PreviewLinkRepository) PreviewLinkByHash(ctx context.Context, tokenHash string) (*entity.PreviewLink, error)
- func (r *PreviewLinkRepository) PreviewLinkOf(ctx context.Context, nodeID int) (*entity.PreviewLink, error)
- func (r *PreviewLinkRepository) ReplacePreviewLink(ctx context.Context, link entity.PreviewLink, tokenHash string) error
- type RedirectRepository
- func (r *RedirectRepository) Create(ctx context.Context, red entity.Redirect) (*entity.Redirect, error)
- func (r *RedirectRepository) Delete(ctx context.Context, id int) error
- func (r *RedirectRepository) DeleteByFromPath(ctx context.Context, fromPath string) error
- func (r *RedirectRepository) List(ctx context.Context) ([]entity.Redirect, error)
- func (r *RedirectRepository) Search(ctx context.Context, q string, offset, limit int) ([]entity.Redirect, int, error)
- type RoleRepository
- func (r RoleRepository) ByID(ctx context.Context, id int) (*entity.Role, error)
- func (r RoleRepository) ByName(ctx context.Context, name string) (*entity.Role, error)
- func (r RoleRepository) CountUsers(ctx context.Context, id int) (int, error)
- func (r RoleRepository) Create(ctx context.Context, roleEntity entity.Role) (*entity.Role, error)
- func (r RoleRepository) Delete(ctx context.Context, id int) error
- func (r RoleRepository) Find(ctx context.Context, filter entity.RoleFilter) (*entity.Role, error)
- func (r RoleRepository) List(ctx context.Context) (*entity.Roles, error)
- func (r RoleRepository) Update(ctx context.Context, roleEntity entity.Role) (*entity.Role, error)
- type SEORepository
- func (r *SEORepository) CreateSEORule(ctx context.Context, rule entity.SEORuleDef) (*entity.SEORuleDef, error)
- func (r *SEORepository) DeleteSEORule(ctx context.Context, id int) error
- func (r *SEORepository) SEORuleByID(ctx context.Context, id int) (*entity.SEORuleDef, error)
- func (r *SEORepository) SEORules(ctx context.Context) (entity.SEORuleDefs, error)
- func (r *SEORepository) SEOTemplates(ctx context.Context) (entity.SEOTemplates, error)
- func (r *SEORepository) SaveSEOTemplate(ctx context.Context, t entity.SEOTemplate) error
- func (r *SEORepository) UpdateSEORule(ctx context.Context, rule entity.SEORuleDef) error
- func (r *SEORepository) UpdateSEORuleWeight(ctx context.Context, id, weight int) error
- type SearchConfigRepository
- func (r *SearchConfigRepository) SaveSearchSettings(ctx context.Context, s entity.SearchSettings) error
- func (r *SearchConfigRepository) SaveSearchType(ctx context.Context, t entity.SearchTypeDef) error
- func (r *SearchConfigRepository) SearchSettings(ctx context.Context) (*entity.SearchSettings, error)
- func (r *SearchConfigRepository) SearchTypes(ctx context.Context) (entity.SearchTypeDefs, error)
- func (r *SearchConfigRepository) UpdateSearchTypeWeight(ctx context.Context, nodeType string, weight int) error
- type SearchRepository
- type SiteInformationRepository
- func (r *SiteInformationRepository) Cached() *entity.SiteInformation
- func (r *SiteInformationRepository) Get(ctx context.Context) (*entity.SiteInformation, error)
- func (r *SiteInformationRepository) RenameFrontFeedView(ctx context.Context, oldName, newName string) error
- func (r *SiteInformationRepository) SetLanguages(ctx context.Context, languages []entity.SiteLanguage) error
- func (r *SiteInformationRepository) SetRobotsExtra(ctx context.Context, rules string) error
- func (r *SiteInformationRepository) SetSchemaOrg(ctx context.Context, o entity.SiteSchemaOrg) error
- func (r *SiteInformationRepository) SetTheme(ctx context.Context, theme string) error
- func (r *SiteInformationRepository) Update(ctx context.Context, s *entity.SiteInformation) error
- type StatisticsSettingsRepository
- type TaxonomyRepository
- func (r TaxonomyRepository) CountNodesByTermID(ctx context.Context, termID int) (int, error)
- func (r TaxonomyRepository) CreateTerm(ctx context.Context, vocabularyID int, name, slug string, createdBy int) (*entity.TaxonomyTerm, error)
- func (r TaxonomyRepository) CreateTermFull(ctx context.Context, vocabularyID int, name, slug, desc string, ...) (*entity.TaxonomyTerm, error)
- func (r TaxonomyRepository) CreateVocabulary(ctx context.Context, name, slug, termPathPrefix, desc string, ...) (*entity.TaxonomyVocabulary, error)
- func (r TaxonomyRepository) DeleteTerm(ctx context.Context, id int) error
- func (r TaxonomyRepository) DeleteVocabulary(ctx context.Context, id int) error
- func (r TaxonomyRepository) FieldTermIDsForNode(ctx context.Context, nodeID int) ([]int, error)
- func (r TaxonomyRepository) NodeTermsByID(ctx context.Context, nID int) (entity.TaxonomyTerms, error)
- func (r TaxonomyRepository) NodeTermsByIDs(ctx context.Context, nodeIDs []int) (map[int]entity.TaxonomyTerms, error)
- func (r TaxonomyRepository) SearchTermsByName(ctx context.Context, vocabularyID int, query string, limit int) (entity.TaxonomyTerms, error)
- func (r TaxonomyRepository) TermByID(ctx context.Context, id int) (*entity.TaxonomyTerm, error)
- func (r TaxonomyRepository) TermBySlug(ctx context.Context, slug string) (*entity.TaxonomyTerm, error)
- func (r TaxonomyRepository) TermNodeCounts(ctx context.Context, vocabularyID int) (map[int]int, error)
- func (r TaxonomyRepository) TermsByIDs(ctx context.Context, ids []int) (map[int]entity.TaxonomyTerm, error)
- func (r TaxonomyRepository) TermsByVocabularyID(ctx context.Context, vocabularyID int) (entity.TaxonomyTerms, error)
- func (r TaxonomyRepository) UpdateNodeTerms(ctx context.Context, nodeID int, termIDs []int) error
- func (r TaxonomyRepository) UpdateTerm(ctx context.Context, id int, name, slug, desc string, weight, parentID int) (*entity.TaxonomyTerm, error)
- func (r TaxonomyRepository) UpdateTermPageTitle(ctx context.Context, id int, pageTitle string) error
- func (r TaxonomyRepository) UpdateTermSortOrder(ctx context.Context, id int, weight, parentID int) error
- func (r TaxonomyRepository) UpdateVocabulary(ctx context.Context, id int, name, slug, termPathPrefix, desc string, ...) (*entity.TaxonomyVocabulary, error)
- func (r TaxonomyRepository) UpdateVocabularySortOrder(ctx context.Context, id int, weight int) error
- func (r TaxonomyRepository) Vocabularies(ctx context.Context) (entity.TaxonomyVocabularies, error)
- func (r TaxonomyRepository) VocabularyByID(ctx context.Context, id int) (*entity.TaxonomyVocabulary, error)
- type TextFormatRepository
- func (r TextFormatRepository) CreateTextFormat(ctx context.Context, f entity.TextFormatDef) (*entity.TextFormatDef, error)
- func (r TextFormatRepository) DeleteTextFormat(ctx context.Context, id int) error
- func (r TextFormatRepository) TextFormatByID(ctx context.Context, id int) (*entity.TextFormatDef, error)
- func (r TextFormatRepository) TextFormatByMachineName(ctx context.Context, machineName string) (*entity.TextFormatDef, error)
- func (r TextFormatRepository) TextFormats(ctx context.Context) (entity.TextFormatDefs, error)
- func (r TextFormatRepository) UpdateTextFormat(ctx context.Context, f entity.TextFormatDef) (*entity.TextFormatDef, error)
- type ThemeSettingsRepository
- type TwoFactorRepository
- func (r *TwoFactorRepository) AcceptStep(ctx context.Context, userID int, step int64) (bool, error)
- func (r *TwoFactorRepository) ByUser(ctx context.Context, userID int) (*entity.TwoFactor, error)
- func (r *TwoFactorRepository) Disable(ctx context.Context, userID int) error
- func (r *TwoFactorRepository) Enable(ctx context.Context, userID int, secret string, step int64, ...) error
- func (r *TwoFactorRepository) EnabledAmong(ctx context.Context, userIDs []int) (map[int]bool, error)
- func (r *TwoFactorRepository) ReplaceRecoveryCodes(ctx context.Context, userID int, codeHashes []string) error
- func (r *TwoFactorRepository) UseRecoveryCode(ctx context.Context, userID int, codeHash string) (bool, error)
- type UploadSettingsRepository
- type UserAuthTokenRepository
- func (r *UserAuthTokenRepository) Consume(ctx context.Context, tokenHash, kind string) (userID int, ok bool, err error)
- func (r *UserAuthTokenRepository) Insert(ctx context.Context, userID int, tokenHash, kind string, expiresAt time.Time) error
- func (r *UserAuthTokenRepository) InvalidateUserKind(ctx context.Context, userID int, kind string) error
- func (r *UserAuthTokenRepository) Pending(ctx context.Context, kind string, userIDs []int) (map[int]time.Time, error)
- func (r *UserAuthTokenRepository) Valid(ctx context.Context, tokenHash, kind string) (userID int, ok bool, err error)
- type UserContentRepository
- func (r *UserContentRepository) DeleteUnreferencedFiles(ctx context.Context, fileIDs []int) ([]string, error)
- func (r *UserContentRepository) FileIDsByCreator(ctx context.Context, userID int) ([]int, error)
- func (r *UserContentRepository) ModuleInstalled(ctx context.Context, module string) (bool, error)
- func (r *UserContentRepository) NodeFileIDs(ctx context.Context, nodeIDs []int) ([]int, error)
- func (r *UserContentRepository) NodeIDs(ctx context.Context, userID int, limit int) ([]int, error)
- func (r *UserContentRepository) NodesWithFile(ctx context.Context, fileID int) ([]int, error)
- func (r *UserContentRepository) Summary(ctx context.Context, userID int) (entity.UserContentSummary, error)
- type UserFieldRepository
- func (r *UserFieldRepository) CreateField(ctx context.Context, f entity.UserFieldDef) (int, error)
- func (r *UserFieldRepository) DeleteField(ctx context.Context, id int) error
- func (r *UserFieldRepository) DeleteUserValues(ctx context.Context, userID int) error
- func (r *UserFieldRepository) Fields(ctx context.Context) (entity.UserFieldDefs, error)
- func (r *UserFieldRepository) SetValues(ctx context.Context, userID int, values map[int]string) error
- func (r *UserFieldRepository) UpdateField(ctx context.Context, f entity.UserFieldDef) error
- func (r *UserFieldRepository) Values(ctx context.Context, userID int) (map[int]string, error)
- type UserFileUsageRepository
- type UserOAuthIdentityRepository
- func (r *UserOAuthIdentityRepository) ByUser(ctx context.Context, userID int) ([]entity.UserOAuthIdentity, error)
- func (r *UserOAuthIdentityRepository) Create(ctx context.Context, identity entity.UserOAuthIdentity) (*entity.UserOAuthIdentity, error)
- func (r *UserOAuthIdentityRepository) Delete(ctx context.Context, userID int, provider string) error
- func (r *UserOAuthIdentityRepository) FindByProviderUser(ctx context.Context, provider, providerUserID string) (*entity.UserOAuthIdentity, error)
- func (r *UserOAuthIdentityRepository) FindByUserAndProvider(ctx context.Context, userID int, provider string) (*entity.UserOAuthIdentity, error)
- type UserRepository
- func (r UserRepository) BumpSessionVersion(ctx context.Context, id int) (int, error)
- func (r UserRepository) ByID(ctx context.Context, id int) (*entity.User, error)
- func (r UserRepository) ByIDs(ctx context.Context, ids []int) (map[int]entity.User, error)
- func (r UserRepository) BySlug(ctx context.Context, slug string) (*entity.User, error)
- func (r UserRepository) ConfirmEmail(ctx context.Context, userID int) error
- func (r UserRepository) CountWithStatus(ctx context.Context, status int) (int, error)
- func (r UserRepository) Create(ctx context.Context, ct entity.User) (*entity.User, error)
- func (r UserRepository) Delete(ctx context.Context, id int) error
- func (r UserRepository) Find(ctx context.Context, filter entity.UserFilter) (*entity.User, error)
- func (r UserRepository) FindByEmailOrUsername(ctx context.Context, identity string) (*entity.User, error)
- func (r UserRepository) FindByUsername(ctx context.Context, username string) (*entity.User, error)
- func (r UserRepository) List(ctx context.Context) (*entity.Users, error)
- func (r UserRepository) ListForAdmin(ctx context.Context, page int, perPage int, opts entity.AdminPeopleListOpts) (*entity.Users, int, int, error)
- func (r UserRepository) Search(ctx context.Context, query string, limit int) (*entity.Users, error)
- func (r UserRepository) SearchActiveByName(ctx context.Context, query string, roles []int, limit int) (*entity.Users, error)
- func (r UserRepository) SessionStateByID(ctx context.Context, id int) (int, int, error)
- func (r UserRepository) TouchAccessedAtIfStale(ctx context.Context, userID int, minInterval time.Duration) error
- func (r UserRepository) Update(ctx context.Context, ct entity.User) (*entity.User, error)
- func (r UserRepository) UsersWithRoles(ctx context.Context, roleIDs []int) ([]entity.User, error)
- type ViewRepository
- func (r ViewRepository) AttachmentDisplays(ctx context.Context) (entity.ViewDisplayDefs, error)
- func (r ViewRepository) CreateFilter(ctx context.Context, f entity.ViewFilterDef) (*entity.ViewFilterDef, error)
- func (r ViewRepository) CreateSort(ctx context.Context, s entity.ViewSortDef) (*entity.ViewSortDef, error)
- func (r ViewRepository) CreateView(ctx context.Context, v entity.ViewDisplayDef) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) CreateViewContainer(ctx context.Context, v entity.View) (*entity.View, error)
- func (r ViewRepository) CreateViewField(ctx context.Context, f entity.ViewFieldDef) (*entity.ViewFieldDef, error)
- func (r ViewRepository) DefaultDisplayOfView(ctx context.Context, viewID int) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) DeleteFilter(ctx context.Context, id int) error
- func (r ViewRepository) DeleteSort(ctx context.Context, id int) error
- func (r ViewRepository) DeleteView(ctx context.Context, id int) error
- func (r ViewRepository) DeleteViewContainer(ctx context.Context, id int) error
- func (r ViewRepository) DeleteViewField(ctx context.Context, id int) error
- func (r ViewRepository) DisplaysOfView(ctx context.Context, viewID int) (entity.ViewDisplayDefs, error)
- func (r ViewRepository) FieldsByViewID(ctx context.Context, viewID int) (entity.ViewFieldDefs, error)
- func (r ViewRepository) FilterByID(ctx context.Context, id int) (*entity.ViewFilterDef, error)
- func (r ViewRepository) FiltersByViewID(ctx context.Context, viewID int) (entity.ViewFilterDefs, error)
- func (r ViewRepository) PageDisplaysWithArgument(ctx context.Context) (entity.ViewDisplayDefs, error)
- func (r ViewRepository) PublicPageViews(ctx context.Context) (entity.ViewDisplayDefs, error)
- func (r ViewRepository) SetPublishedSnapshot(ctx context.Context, id int, snapshot string, publishedAt time.Time) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) SetViewContainerMachineName(ctx context.Context, id int, machineName string) (*entity.View, error)
- func (r ViewRepository) SetViewMachineName(ctx context.Context, id int, machineName string) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) SortByID(ctx context.Context, id int) (*entity.ViewSortDef, error)
- func (r ViewRepository) SortsByViewID(ctx context.Context, viewID int) (entity.ViewSortDefs, error)
- func (r ViewRepository) TermDisplays(ctx context.Context) (entity.ViewDisplayDefs, error)
- func (r ViewRepository) UpdateFilter(ctx context.Context, f entity.ViewFilterDef) (*entity.ViewFilterDef, error)
- func (r ViewRepository) UpdateSort(ctx context.Context, s entity.ViewSortDef) (*entity.ViewSortDef, error)
- func (r ViewRepository) UpdateView(ctx context.Context, v entity.ViewDisplayDef) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) UpdateViewField(ctx context.Context, f entity.ViewFieldDef) (*entity.ViewFieldDef, error)
- func (r ViewRepository) UserTabDisplays(ctx context.Context) (entity.ViewDisplayDefs, error)
- func (r ViewRepository) ViewByID(ctx context.Context, id int) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) ViewByMachineName(ctx context.Context, machineName string) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) ViewByURLPath(ctx context.Context, urlPath string) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) ViewByURLPathAny(ctx context.Context, urlPath string) (*entity.ViewDisplayDef, error)
- func (r ViewRepository) ViewContainerByID(ctx context.Context, id int) (*entity.View, error)
- func (r ViewRepository) ViewFieldByID(ctx context.Context, id int) (*entity.ViewFieldDef, error)
- func (r ViewRepository) Views(ctx context.Context) (entity.ViewDisplayDefs, error)
Constants ¶
const SettingsRowID = settingsRowID
SettingsRowID - the id of a settings table's single row (a module's settings).
Variables ¶
This section is empty.
Functions ¶
func ClientFor ¶
ClientFor - an ent client on db in the configured dialect (a module's repository built on the shared *sql.DB).
func CommentOnPublicNode ¶
CommentOnPublicNode - the comments on public content only (published, not on moderation): what the public comment lists show.
func ContentListPredicate ¶
ContentListPredicate - the content lists' narrowing for ctx (nil - none).
func Dialect ¶
func Dialect() string
Dialect - the database the repositories' ent clients speak (SetDialect): a module's own ent client (its own schema) opens its driver with it.
func GetClient ¶
GetClient returns the transactional client from ctx, or the given client if there is no transaction.
func InTxDriver ¶
func InTxDriver(d string, eq entsql.ExecQuerier) dialect.Driver
InTxDriver - a transaction running queries through eq (a transaction's client) as an ent driver: a transaction ent begins on it (an update with edges does) is that one, committed or rolled back by its owner.
func NewDynamicContentRepositoryFactory ¶
func NewDynamicContentRepositoryFactory( client *generated.Client, contentTypeRepo entity.ContentTypeRepository, taxonomyRepo entity.TaxonomyRepository, ) func(entity.ContentTypeDef, entity.FieldInstanceDefs) entity.DynamicContentRepository
NewDynamicContentRepositoryFactory returns a factory the interfaces layer can hold without importing ent: it captures the ent client and content type repository at wiring time and returns an entity.DynamicContentRepository per resolved content type.
func NodeIDsWithField ¶
func NodeIDsWithField(ctx context.Context, client *generated.Client, fs entity.FieldStorageDef) ([]int, bool, error)
NodeIDsWithField - the nodes having any value of the field, a node with several values repeated; false for a field type without a value table.
func OnContentChange ¶
OnContentChange calls changed after each change of the content written through client - a node's or a comment's, created, updated or deleted: once its transaction commits (never on a rollback), at once outside one. It runs for each change, a bulk update's once: changed should be cheap (a debounced refresh). Writes through clients of their own (clientFor: the deletions' raw paths) aren't seen: they signal their own.
func OrderByCounter ¶
func OrderByCounter(column string, desc bool) node.OrderOption
OrderByCounter orders nodes by a node_counter column (totalcount, daycount), 0 for a node without a counter row. Not ent's node.ByNodeCounterField: for an edge keyed on node_counter it joins a "GROUP BY nid" subquery selecting the column, which PostgreSQL rejects (the column is neither grouped nor aggregated).
func OrderByViewDays ¶
func OrderByViewDays(since int, desc bool) node.OrderOption
OrderByViewDays orders nodes by their views from the day since on (node_view_days), 0 for a node not viewed then. since is written as a number, not an argument: ent drops an ORDER BY expression's arguments (MySQL: "expected 2 arguments, got 1"); it is an int, never text.
func OrderRandom ¶
OrderRandom - ent order option shuffling the rows (a module's query).
func Rebind ¶
Rebind - a module's hand-written query (? placeholders) in the placeholders of the repositories' database.
func RebuildSearchIndex ¶
RebuildSearchIndex writes the words of every node again (app search reindex, a new site's content): a batch of nodes at a time, each batch's old words replaced, so the search keeps finding meanwhile. It returns how many nodes it indexed.
func SealSecrets ¶
SealSecrets seals again what isn't sealed with the site's first key: the plain secrets (saved before the site had a key) and the ones sealed with an older key (SECRETS_KEY "new,old"). It returns how many it sealed and, per column (secretColumn.label), how many none of the keys opens.
func SecretsKeyWeak ¶
func SecretsKeyWeak() bool
SecretsKeyWeak - whether the site's key is guessable (secretbox.Box.Weak).
func SecretsSealed ¶
func SecretsSealed() bool
SecretsSealed - whether the site has a key to seal the secrets with.
func SetContentListFilter ¶
SetContentListFilter sets what narrows the content lists' nodes (every content View's, the search's) for ctx's request: fn returns the condition to add to the nodes' query (its Where on the nodes' selector), nil - none. nil fn - no narrowing.
func SetDialect ¶
func SetDialect(d string)
SetDialect sets the database those repositories' ent clients speak (dialect.MySQL, dialect.Postgres).
func SetSecrets ¶
SetSecrets sets the key the secrets are sealed with (at startup).
func TodayStartSite ¶
TodayStartSite returns midnight in the site's time zone (pkg/sitetime): where "viewed today" starts (node_counter.daycount, ViewSortBuiltinViewsToday).
func TxDriver ¶
TxDriver - the context's transaction (a unit of work's) as an ent driver, for a module's own client writing in it (modulekit.Driver); false outside one.
func UnreadableSecrets ¶
UnreadableSecrets - per column (secretColumn.label), how many stored secrets none of the site's keys opens: sealed with a key the site no longer has.
func ViewDaysSince ¶
ViewDaysSince - the first day (entity.ViewDay) of the last days of views, today included.
Types ¶
type AccountSettingsRepository ¶
type AccountSettingsRepository struct {
// contains filtered or unexported fields
}
AccountSettingsRepository implements entity.AccountSettingsRepository.
func NewAccountSettingsRepository ¶
func NewAccountSettingsRepository(db *sql.DB) *AccountSettingsRepository
NewAccountSettingsRepository - the account settings repository on db.
func (*AccountSettingsRepository) Get ¶
func (r *AccountSettingsRepository) Get(ctx context.Context) (*entity.AccountSettings, error)
Get - the account settings (registration, avatars, two-factor, the account emails) from their single row.
func (*AccountSettingsRepository) Update ¶
func (r *AccountSettingsRepository) Update(ctx context.Context, s *entity.AccountSettings) error
Update saves s into the account settings row.
type BlockRepository ¶
type BlockRepository struct {
// contains filtered or unexported fields
}
BlockRepository is the ent adapter for entity.BlockRepository.
func NewBlockRepository ¶
func NewBlockRepository(client *generated.Client) *BlockRepository
NewBlockRepository - the block repository on client.
func (BlockRepository) BlockByID ¶
BlockByID - the block with id; ErrEntityNotFound if there is none.
func (BlockRepository) BlockByMachineName ¶
func (r BlockRepository) BlockByMachineName(ctx context.Context, name string) (*entity.BlockDef, error)
BlockByMachineName - the block named name (entity.BlockDef.MachineName).
func (BlockRepository) Blocks ¶
func (r BlockRepository) Blocks(ctx context.Context, theme string) ([]entity.BlockWithPlacement, error)
Blocks - see entity.BlockRepository.Blocks; by region, then weight.
func (BlockRepository) CopyPlacement ¶
func (r BlockRepository) CopyPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
CopyPlacement creates a copy of p (any type: a custom block's placement points at the same block) - used to give a new theme the placements of the previous one.
func (BlockRepository) CreateBlock ¶
func (r BlockRepository) CreateBlock(ctx context.Context, b entity.BlockDef, p entity.BlockPlacementDef) (*entity.BlockDef, error)
CreateBlock creates the block and its single placement together; the caller wraps it in a UOW.
func (BlockRepository) CreateMenuPlacement ¶
func (r BlockRepository) CreateMenuPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
CreateMenuPlacement creates a menu-block placement (no BlockDef row - see entity.BlockPlacementDef.MenuID).
func (BlockRepository) CreatePluginPlacement ¶
func (r BlockRepository) CreatePluginPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
CreatePluginPlacement creates a plugin-block placement (no BlockDef row - see entity.PluginBlockID).
func (BlockRepository) CreateViewPlacement ¶
func (r BlockRepository) CreateViewPlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
CreateViewPlacement creates a View-block placement (no BlockDef row - see entity.BlockPlacementDef.ViewDisplayID).
func (BlockRepository) DeleteBlock ¶
func (r BlockRepository) DeleteBlock(ctx context.Context, id int) error
DeleteBlock removes the block along with its placements (application-level cascade, not FK ON DELETE).
func (BlockRepository) DeletePlacement ¶
func (r BlockRepository) DeletePlacement(ctx context.Context, placementID int) error
DeletePlacement removes one placement row directly (custom or plugin) - unlike DeleteBlock, never touches a BlockDef row.
func (BlockRepository) MachineNameTaken ¶
func (r BlockRepository) MachineNameTaken(ctx context.Context, name string, excludeID int) (bool, error)
MachineNameTaken reports whether a block other than excludeID (0 - none) is named name.
func (BlockRepository) PlacementByBlockID ¶
func (r BlockRepository) PlacementByBlockID(ctx context.Context, blockID int, theme string) (*entity.BlockPlacementDef, error)
PlacementByBlockID - the custom block's placement in theme; ErrEntityNotFound if it has none there.
func (BlockRepository) PlacementByID ¶
func (r BlockRepository) PlacementByID(ctx context.Context, id int) (*entity.BlockPlacementDef, error)
PlacementByID returns any placement (custom/plugin/view/menu) by its own ID; PlacementByBlockID can't find plugin/view/menu placements, which have no owning BlockDef.
func (BlockRepository) PublishedPlacementsByRegion ¶
func (r BlockRepository) PublishedPlacementsByRegion(ctx context.Context, theme string, region entity.Region) ([]entity.BlockWithPlacement, error)
PublishedPlacementsByRegion returns published placements for one region of one theme, weight-sorted - raw data for CacheService; per-page visibility is filtered per request (see entity.BlockRepository.PublishedPlacementsByRegion).
func (BlockRepository) ReorderPlacements ¶
func (r BlockRepository) ReorderPlacements(ctx context.Context, updates []entity.BlockPlacementOrderUpdate) error
ReorderPlacements bulk-applies Region/Weight from the admin drag-and-drop list (one UpdateOneID call per row).
func (BlockRepository) SearchBlocks ¶
func (r BlockRepository) SearchBlocks(ctx context.Context, query string, limit int) ([]entity.BlockDef, error)
SearchBlocks - see entity.BlockRepository.SearchBlocks.
func (BlockRepository) ThemeHasPlacements ¶
ThemeHasPlacements reports whether the theme has any placement.
func (BlockRepository) UpdateBlock ¶
func (r BlockRepository) UpdateBlock(ctx context.Context, b entity.BlockDef) (*entity.BlockDef, error)
UpdateBlock saves the block (one without a MachineName named from its title).
func (BlockRepository) UpdatePlacement ¶
func (r BlockRepository) UpdatePlacement(ctx context.Context, p entity.BlockPlacementDef) (*entity.BlockPlacementDef, error)
UpdatePlacement saves the placement's region, weight, title and visibility (a nil PluginConfig keeps the stored one) and returns it.
type BlockedBotRepository ¶
type BlockedBotRepository struct {
// contains filtered or unexported fields
}
BlockedBotRepository implements entity.BlockedBotRepository.
func NewBlockedBotRepository ¶
func NewBlockedBotRepository(db *sql.DB) *BlockedBotRepository
NewBlockedBotRepository creates a new BlockedBotRepository.
func (*BlockedBotRepository) Create ¶
func (r *BlockedBotRepository) Create(ctx context.Context, pattern, comment string) (*entity.BlockedBot, error)
Create inserts a new blocked bot pattern.
func (*BlockedBotRepository) Delete ¶
func (r *BlockedBotRepository) Delete(ctx context.Context, id int) error
Delete removes a blocked bot by ID.
func (*BlockedBotRepository) List ¶
func (r *BlockedBotRepository) List(ctx context.Context) ([]entity.BlockedBot, error)
List returns all blocked bot patterns, newest first.
type BlockedIPRepository ¶
type BlockedIPRepository struct {
// contains filtered or unexported fields
}
BlockedIPRepository implements entity.BlockedIPRepository.
func NewBlockedIPRepository ¶
func NewBlockedIPRepository(db *sql.DB) *BlockedIPRepository
NewBlockedIPRepository creates a new BlockedIPRepository.
func (*BlockedIPRepository) Create ¶
func (r *BlockedIPRepository) Create(ctx context.Context, ip, comment string) (*entity.BlockedIP, error)
Create inserts a new, permanent, manually-added blocked IP.
type BreadcrumbRuleRepository ¶
type BreadcrumbRuleRepository struct {
// contains filtered or unexported fields
}
BreadcrumbRuleRepository is the ent adapter for entity.BreadcrumbRuleRepository.
func NewBreadcrumbRuleRepository ¶
func NewBreadcrumbRuleRepository(client *generated.Client) *BreadcrumbRuleRepository
NewBreadcrumbRuleRepository - the breadcrumb rule repository on client.
func (BreadcrumbRuleRepository) BreadcrumbRuleByID ¶
func (r BreadcrumbRuleRepository) BreadcrumbRuleByID(ctx context.Context, id int) (*entity.BreadcrumbRuleDef, error)
BreadcrumbRuleByID - the rule with id; ErrEntityNotFound if there is none.
func (BreadcrumbRuleRepository) BreadcrumbRules ¶
func (r BreadcrumbRuleRepository) BreadcrumbRules(ctx context.Context) (entity.BreadcrumbRuleDefs, error)
BreadcrumbRules - see entity.BreadcrumbRuleRepository.BreadcrumbRules.
func (BreadcrumbRuleRepository) CreateBreadcrumbRule ¶
func (r BreadcrumbRuleRepository) CreateBreadcrumbRule(ctx context.Context, d entity.BreadcrumbRuleDef) (*entity.BreadcrumbRuleDef, error)
CreateBreadcrumbRule adds the rule d and returns it with its ID.
func (BreadcrumbRuleRepository) DeleteBreadcrumbRule ¶
func (r BreadcrumbRuleRepository) DeleteBreadcrumbRule(ctx context.Context, id int) error
DeleteBreadcrumbRule deletes the rule with id.
func (BreadcrumbRuleRepository) UpdateBreadcrumbRule ¶
func (r BreadcrumbRuleRepository) UpdateBreadcrumbRule(ctx context.Context, d entity.BreadcrumbRuleDef) (*entity.BreadcrumbRuleDef, error)
UpdateBreadcrumbRule saves d over the rule d.ID and returns it.
func (BreadcrumbRuleRepository) UpdateBreadcrumbRuleWeight ¶
func (r BreadcrumbRuleRepository) UpdateBreadcrumbRuleWeight(ctx context.Context, id, weight int) error
UpdateBreadcrumbRuleWeight sets only the rule's weight (its place in the order).
type CaptchaSettingsRepository ¶
type CaptchaSettingsRepository struct {
// contains filtered or unexported fields
}
CaptchaSettingsRepository implements entity.CaptchaSettingsRepository.
func NewCaptchaSettingsRepository ¶
func NewCaptchaSettingsRepository(db *sql.DB) *CaptchaSettingsRepository
NewCaptchaSettingsRepository - the CAPTCHA settings repository on db.
func (*CaptchaSettingsRepository) Get ¶
func (r *CaptchaSettingsRepository) Get(ctx context.Context) (*entity.CaptchaSettings, error)
Get - the CAPTCHA settings from their single row; Forms holds the switches of the core's forms and of the modules' ones that were saved.
func (*CaptchaSettingsRepository) Update ¶
func (r *CaptchaSettingsRepository) Update(ctx context.Context, s *entity.CaptchaSettings) error
Update saves the settings row (the secret key sealed), creating it if it isn't there.
type CommentRepository ¶
type CommentRepository struct {
// contains filtered or unexported fields
}
CommentRepository provides database access to comments.
func NewCommentRepository ¶
func NewCommentRepository(client *generated.Client) *CommentRepository
NewCommentRepository - the comment repository on client.
func (CommentRepository) ByCreatedByPaginated ¶
func (r CommentRepository) ByCreatedByPaginated(ctx context.Context, userID int, status int8, limit int, offset int) (entity.Comments, error)
ByCreatedByPaginated returns user's comments ordered by CreatedAt desc
func (CommentRepository) ByNodeID ¶
func (r CommentRepository) ByNodeID(ctx context.Context, nid int, status int8) (entity.Comments, error)
ByNodeID returns all comments for a specific node (with hierarchy)
func (CommentRepository) ByNodeIDPaginated ¶
func (r CommentRepository) ByNodeIDPaginated(ctx context.Context, nid int, status int8, limit int, offset int) (entity.Comments, error)
ByNodeIDPaginated returns paginated comments in threaded order (materialized path). Single query with ORDER BY path - exactly limit comments per page.
func (CommentRepository) CountByNodeID ¶
func (r CommentRepository) CountByNodeID(ctx context.Context, nid int, status int8, rootOnly bool) (int, error)
CountByNodeID returns count of comments for a node If rootOnly is true, counts only root comments (without parent)
func (CommentRepository) CountByNodeIDs ¶
func (r CommentRepository) CountByNodeIDs(ctx context.Context, nids []int, status int8, rootOnly bool) (map[int]int, error)
CountByNodeIDs returns comment counts for multiple nodes in a single query.
func (CommentRepository) CountCommentsWithPathLEQ ¶
func (r CommentRepository) CountCommentsWithPathLEQ(ctx context.Context, nid int, status int8, path string) (int, error)
CountCommentsWithPathLEQ returns count of comments with path <= given path (for same nid, status)
func (CommentRepository) Create ¶
Create creates a new comment and its materialized path (the parent's path plus its own ID) in one transaction (the caller's when ctx carries one): a reply never ends up a root.
func (CommentRepository) Delete ¶
func (r CommentRepository) Delete(ctx context.Context, id int) error
Delete deletes a comment by ID Delete removes the comment and all its replies in one statement.
func (CommentRepository) DeleteByNodeID ¶
func (r CommentRepository) DeleteByNodeID(ctx context.Context, nodeID int) error
DeleteByNodeID deletes every comment on the node.
func (CommentRepository) DescendantIDs ¶
DescendantIDs walks the reply tree by parent_id, level by level (the materialized path may be missing on imported comments).
func (CommentRepository) Find ¶
func (r CommentRepository) Find(ctx context.Context, filter entity.CommentsFilter) (entity.Comments, error)
Find returns comments with filters
func (CommentRepository) GetCommentPath ¶
GetCommentPath returns the materialized path for a comment
func (CommentRepository) GetLatestComments ¶
func (r CommentRepository) GetLatestComments(ctx context.Context, limit int, status int8, excludeTypes []string) (entity.Comments, error)
GetLatestComments returns the latest comments of every node type except those whose comments are a discussion of their own (a forum topic's, entity.OwnDiscussionNodeTypes), on public content only. Only the essential fields, no user relations.
func (CommentRepository) HasDuplicate ¶
func (r CommentRepository) HasDuplicate(ctx context.Context, authorID int, content string, since time.Time) (bool, error)
HasDuplicate - see entity.CommentsRepository.HasDuplicate.
func (CommentRepository) ListForAdmin ¶
func (r CommentRepository) ListForAdmin(ctx context.Context, filter entity.AdminCommentsListFilter) (entity.Comments, int, error)
ListForAdmin returns all comments for admin list with pagination and configurable sort.
func (CommentRepository) ListRecentPublished ¶
func (r CommentRepository) ListRecentPublished(ctx context.Context, status int8, excludeTypes []string, limit int, offset int) (entity.Comments, int, error)
ListRecentPublished returns published comments site-wide (including forum) on public content, except on nodes of excludeTypes, newest first, with total count.
func (CommentRepository) NodeIDsByAuthor ¶
NodeIDsByAuthor - see entity.CommentsRepository.NodeIDsByAuthor.
func (CommentRepository) SpamBefore ¶
SpamBefore - see entity.CommentsRepository.SpamBefore.
func (CommentRepository) TotalCount ¶
func (r CommentRepository) TotalCount(ctx context.Context, filter entity.CommentsFilter) (int, error)
TotalCount returns total count of comments with filters
type CommentSettingsRepository ¶
type CommentSettingsRepository struct {
// contains filtered or unexported fields
}
CommentSettingsRepository implements entity.CommentSettingsRepository. Read on every comment form and post (several times a post), the row is kept after the first read until the repository writes it (afterWrite).
func NewCommentSettingsRepository ¶
func NewCommentSettingsRepository(db *sql.DB) *CommentSettingsRepository
NewCommentSettingsRepository creates a CommentSettingsRepository.
func (*CommentSettingsRepository) Get ¶
func (r *CommentSettingsRepository) Get(ctx context.Context) (entity.CommentSettings, error)
Get - see entity.CommentSettingsRepository.Get; outside a transaction, the settings kept since the last write.
func (*CommentSettingsRepository) Update ¶
func (r *CommentSettingsRepository) Update(ctx context.Context, s entity.CommentSettings) error
Update saves the settings row, creating it if it isn't there.
type ContentTypeRepository ¶
type ContentTypeRepository struct {
// contains filtered or unexported fields
}
ContentTypeRepository is the ent adapter for entity.ContentTypeRepository (runtime content type builder; for the field storage/instance split see entity/field_storage.go).
func NewContentTypeRepository ¶
func NewContentTypeRepository(client *generated.Client) *ContentTypeRepository
NewContentTypeRepository - the content type repository on client.
func (ContentTypeRepository) AttachExistingField ¶
func (r ContentTypeRepository) AttachExistingField(ctx context.Context, contentTypeID, fieldStorageID int, label string, required bool, sortOrder int) (*entity.FieldInstanceDef, error)
AttachExistingField creates only a FieldInstanceDef for an existing FieldStorageDef. The new instance gets the same visibility defaults as CreateField (shown on the detail page with its label).
func (ContentTypeRepository) ContentTypeByID ¶
func (r ContentTypeRepository) ContentTypeByID(ctx context.Context, id int) (*entity.ContentTypeDef, error)
ContentTypeByID - the content type with id; ErrEntityNotFound if there is none.
func (ContentTypeRepository) ContentTypeByMachineName ¶
func (r ContentTypeRepository) ContentTypeByMachineName(ctx context.Context, machineName string) (*entity.ContentTypeDef, error)
ContentTypeByMachineName - the content type named machineName; ErrEntityNotFound if there is none.
func (ContentTypeRepository) ContentTypes ¶
func (r ContentTypeRepository) ContentTypes(ctx context.Context) (entity.ContentTypeDefs, error)
ContentTypes - see entity.ContentTypeRepository.ContentTypes; by label.
func (ContentTypeRepository) CountFieldValues ¶
func (r ContentTypeRepository) CountFieldValues(ctx context.Context, contentTypeID, fieldID int, fieldType entity.ContentTypeFieldType, multiple bool) (int, error)
CountFieldValues counts stored values of the field on nodes of this content type only (for the confirmation shown before detaching it). fieldID is the shared FieldStorageDef.ID, so contentTypeID is required to exclude values of other content types using the same field.
func (ContentTypeRepository) CreateContentType ¶
func (r ContentTypeRepository) CreateContentType(ctx context.Context, ct entity.ContentTypeDef) (*entity.ContentTypeDef, error)
CreateContentType adds the content type ct (settings the create form doesn't send keep their column defaults) and returns it with its ID.
func (ContentTypeRepository) CreateField ¶
func (r ContentTypeRepository) CreateField(ctx context.Context, f entity.FieldInstanceDef) (*entity.FieldInstanceDef, error)
CreateField creates a new FieldStorageDef (the machine name must be globally unique; the service layer handles duplicate-key errors) and a FieldInstanceDef pointing at it. Both inserts share a transaction when the caller wraps them in entity.UnitOfWork.Do (GetClient picks up the tx client from ctx).
func (ContentTypeRepository) DeleteContentType ¶
func (r ContentTypeRepository) DeleteContentType(ctx context.Context, id int) error
DeleteContentType deletes the type and its field instances (groups among them, and their form and display settings) - field_instances has no cascade on content_type_id. Each field goes as DeleteField does, so a storage nothing else uses leaves the catalog. Run it in a transaction: outside one, a failure halfway leaves some fields gone and the type in place.
func (ContentTypeRepository) DeleteField ¶
func (r ContentTypeRepository) DeleteField(ctx context.Context, id int) error
DeleteField removes one content type's instance of a field. The shared FieldStorageDef stays in the reusable catalog while another instance or anything else holds it (FieldStorageUsage); with the last instance of an unused storage it goes too. field_value_*.field_id is the shared storage ID, so value rows are deleted only for nodes of this field's content type - otherwise the values of every other content type using the field would be wiped too.
func (ContentTypeRepository) FieldByID ¶
func (r ContentTypeRepository) FieldByID(ctx context.Context, id int) (*entity.FieldInstanceDef, error)
FieldByID - the field instance with id, with its storage; ErrEntityNotFound if there is none.
func (ContentTypeRepository) FieldDateValuesForNodes ¶
func (r ContentTypeRepository) FieldDateValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]time.Time, error)
FieldDateValuesForNodes - a date field's start per node; a node with several dates - the nearest not ended yet (by now in the site's zone), all ended - the latest: what a View sorts by.
func (ContentTypeRepository) FieldInstanceLabelsByFieldStorageIDs ¶
func (r ContentTypeRepository) FieldInstanceLabelsByFieldStorageIDs(ctx context.Context, fieldStorageIDs []int) (map[int]string, error)
FieldInstanceLabelsByFieldStorageIDs - see entity.ContentTypeRepository for why field_storages has no label. First instance (by id) wins per field_storage_id, which is deterministic and favors no content type.
func (ContentTypeRepository) FieldNumberValuesForNodes ¶
func (r ContentTypeRepository) FieldNumberValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]float64, error)
FieldNumberValuesForNodes - a number field's value per node, for the nodes among nodeIDs that have one (see entity.ContentTypeRepository.FieldTextValuesForNodes).
func (ContentTypeRepository) FieldSets ¶
func (r ContentTypeRepository) FieldSets(ctx context.Context) (entity.ContentTypeDefs, error)
FieldSets - see entity.ContentTypeRepository.FieldSets.
func (ContentTypeRepository) FieldStorageByID ¶
func (r ContentTypeRepository) FieldStorageByID(ctx context.Context, id int) (*entity.FieldStorageDef, error)
FieldStorageByID - see entity.ContentTypeRepository.FieldStorageByID.
func (ContentTypeRepository) FieldStorageUsage ¶
func (r ContentTypeRepository) FieldStorageUsage(ctx context.Context, storageID int) (entity.FieldStorageUsage, error)
FieldStorageUsage counts what still holds the storage: its instances, Views (fields, filters, sorts, carousel link and glossary displays), breadcrumb rules and SEO rules.
func (ContentTypeRepository) FieldStorages ¶
func (r ContentTypeRepository) FieldStorages(ctx context.Context) (entity.FieldStorageDefs, error)
FieldStorages returns the whole catalog of reusable fields, for the "add existing field" picker.
func (ContentTypeRepository) FieldTaxonomyMultiValuesForNodes ¶
func (r ContentTypeRepository) FieldTaxonomyMultiValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int][]int, error)
FieldTaxonomyMultiValuesForNodes is FieldTaxonomyValuesForNodes for a Multiple() taxonomy field: node_id -> all its term IDs, read from field_value_taxonomy_multi. Used by hub routes that match a node against several term IDs and by detail-page rendering of multi-value fields.
func (ContentTypeRepository) FieldTaxonomyValuesForNodes ¶
func (r ContentTypeRepository) FieldTaxonomyValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]int, error)
FieldTaxonomyValuesForNodes - see entity.ContentTypeRepository.FieldTaxonomyValuesForNodes.
func (ContentTypeRepository) FieldTextValuesForNodes ¶
func (r ContentTypeRepository) FieldTextValuesForNodes(ctx context.Context, fieldStorageID int, nodeIDs []int) (map[int]string, error)
FieldTextValuesForNodes - see entity.ContentTypeRepository.FieldTextValuesForNodes.
func (ContentTypeRepository) FieldValues ¶
func (r ContentTypeRepository) FieldValues(ctx context.Context, nodeID int, fields entity.FieldInstanceDefs) (map[int]any, error)
FieldValues - a node's value per field (fieldValues: one query per value table, taxonomy fields too). A field never set for this node is simply absent from the map - not an error.
func (ContentTypeRepository) FieldValuesForNodes ¶
func (r ContentTypeRepository) FieldValuesForNodes(ctx context.Context, nodeIDs []int, fields entity.FieldInstanceDefs) (map[int]map[int]any, error)
FieldValuesForNodes - the values of fields for each of nodeIDs (node → field instance ID → value), one query per value table over all the fields and nodes: text, number, date (a time.Time, or an entity.DateValue for a field with a time or an end), bool, image and file (the file ID - the caller resolves files in one batch), list and reference (one value or, Multiple(), a slice in the order saved), link ([]entity.Link in the order saved, whatever the cardinality), user ([]int user IDs, likewise), blocks ([]int item IDs, likewise). Taxonomy fields go through FieldTaxonomy(Multi)ValuesForNodes; other types are skipped.
func (ContentTypeRepository) FieldsByContentTypeID ¶
func (r ContentTypeRepository) FieldsByContentTypeID(ctx context.Context, contentTypeID int) (entity.FieldInstanceDefs, error)
FieldsByContentTypeID - the type's fields with their storages, by sort order, then ID.
func (ContentTypeRepository) NodesWithSeveralFieldValues ¶
func (r ContentTypeRepository) NodesWithSeveralFieldValues(ctx context.Context, storage entity.FieldStorageDef) ([]int, error)
NodesWithSeveralFieldValues - the nodes holding more than one value of a multi-value field (they block making it single-valued), sorted by ID.
func (ContentTypeRepository) RichTextFieldStorageIDs ¶
func (r ContentTypeRepository) RichTextFieldStorageIDs(ctx context.Context, fieldStorageIDs []int) (map[int]bool, error)
RichTextFieldStorageIDs - see entity.ContentTypeRepository.
func (ContentTypeRepository) SetFieldMultiple ¶
func (r ContentTypeRepository) SetFieldMultiple(ctx context.Context, storageID int, multiple bool) error
SetFieldMultiple switches a field storage between one and several values per node: its values move to the other value table, its config gets "multiple" (a single-valued reference loses "symmetric"), and each instance's widget that the new cardinality doesn't allow is replaced (cardinalityWidget). The caller makes sure no node has several values before making a field single-valued (NodesWithSeveralFieldValues), in the same transaction: it writes several tables.
func (ContentTypeRepository) SetFieldValues ¶
func (r ContentTypeRepository) SetFieldValues(ctx context.Context, nodeID int, fields entity.FieldInstanceDefs, values map[int]any, textFormats map[int]int) error
SetFieldValues replaces each field's values of the node with its value in values (absent - none) and, a text, its text format: through the store of the field's type (fieldStoreOf), its rows keyed by the shared FieldStorageID (not the per-type instance ID). The search index gets the fields' words again.
func (ContentTypeRepository) TextFormatIDsByNode ¶
func (r ContentTypeRepository) TextFormatIDsByNode(ctx context.Context, nodeID int, fields entity.FieldInstanceDefs) (map[int]int, error)
TextFormatIDsByNode returns, for fields with non-empty AllowedTextFormatIDs(), the TextFormatDef each existing value was saved with, so the edit form can preselect it: one query for all of them, none if the content type doesn't use formats.
func (ContentTypeRepository) UpdateContentType ¶
func (r ContentTypeRepository) UpdateContentType(ctx context.Context, ct entity.ContentTypeDef) (*entity.ContentTypeDef, error)
UpdateContentType saves ct's settings over the type ct.ID (its machine name stays) and returns it.
func (ContentTypeRepository) UpdateField ¶
func (r ContentTypeRepository) UpdateField(ctx context.Context, f entity.FieldInstanceDef) (*entity.FieldInstanceDef, error)
UpdateField updates FieldStorageDef.Config (shared by every content type using the field) and the instance's Label/Required/HiddenInForm/ DefaultImageID/UsableInForm/UsableInDetail/Config (the per-type WidgetConfig). It never touches SortOrder/FormGroupID (UpdateFieldSortOrder) or ShowOnDetail/ShowLabel/DisplayOrder/ DetailImageStyle/ParentGroupID (UpdateFieldDetailDisplay): disjoint write paths keep one admin tab from clobbering another's settings.
func (ContentTypeRepository) UpdateFieldDetailDisplay ¶
func (r ContentTypeRepository) UpdateFieldDetailDisplay(ctx context.Context, fieldID int, d entity.FieldDetailDisplay) error
UpdateFieldDetailDisplay updates the detail-page display settings, including ParentGroupID (see UpdateField for why it is separate).
func (ContentTypeRepository) UpdateFieldSortOrder ¶
func (r ContentTypeRepository) UpdateFieldSortOrder(ctx context.Context, fieldID int, sortOrder int, formGroupID *int) error
UpdateFieldSortOrder updates the form field order and FormGroupID from the fields tab drag-and-drop table (see UpdateField for why it is separate). FormGroupID is also set per field via UpdateField; this path updates it in bulk when an admin drags a field into a form group.
type DashboardRepository ¶
type DashboardRepository struct {
// contains filtered or unexported fields
}
DashboardRepository - entity.DashboardRepository: counts over the nodes, comments, users and node_counter.
func NewDashboardRepository ¶
func NewDashboardRepository(db *sql.DB) *DashboardRepository
NewDashboardRepository creates a DashboardRepository.
func (*DashboardRepository) OnModeration ¶
func (r *DashboardRepository) OnModeration(ctx context.Context) (int, error)
OnModeration - see entity.DashboardRepository.OnModeration.
func (*DashboardRepository) Popular ¶
func (r *DashboardRepository) Popular(ctx context.Context, q entity.PopularQuery) ([]entity.PopularNode, int, error)
Popular - entity.DashboardRepository.Popular: a day's and all views from node_counter, a week's and a month's summed from node_view_days.
func (*DashboardRepository) Stats ¶
func (r *DashboardRepository) Stats(ctx context.Context, since, today time.Time) (entity.DashboardStats, error)
Stats - see entity.DashboardRepository.Stats.
type DateFormatRepository ¶
type DateFormatRepository struct {
// contains filtered or unexported fields
}
DateFormatRepository manages the date_formats catalog.
func NewDateFormatRepository ¶
func NewDateFormatRepository(db *sql.DB) *DateFormatRepository
NewDateFormatRepository - the date format repository on db.
func (*DateFormatRepository) CreateDateFormat ¶
func (r *DateFormatRepository) CreateDateFormat(ctx context.Context, f entity.DateFormat) (int, error)
CreateDateFormat adds the date format f and returns its ID.
func (*DateFormatRepository) DateFormatByID ¶
func (r *DateFormatRepository) DateFormatByID(ctx context.Context, id int) (*entity.DateFormat, error)
DateFormatByID - the date format with id.
func (*DateFormatRepository) DateFormatUsage ¶
func (r *DateFormatRepository) DateFormatUsage(ctx context.Context, machineName string) ([]string, error)
DateFormatUsage - see entity.DateFormatRepository.DateFormatUsage.
func (*DateFormatRepository) DateFormats ¶
func (r *DateFormatRepository) DateFormats(ctx context.Context) ([]entity.DateFormat, error)
DateFormats - every date format, by label, then ID.
func (*DateFormatRepository) DeleteDateFormat ¶
func (r *DateFormatRepository) DeleteDateFormat(ctx context.Context, id int) error
DeleteDateFormat deletes the date format with id.
func (*DateFormatRepository) InstanceDateFormats ¶
InstanceDateFormats - see entity.DateFormatRepository.InstanceDateFormats.
func (*DateFormatRepository) UpdateDateFormat ¶
func (r *DateFormatRepository) UpdateDateFormat(ctx context.Context, f entity.DateFormat) error
UpdateDateFormat updates label and pattern; the machine name never changes.
type DynamicContentRepository ¶
type DynamicContentRepository struct {
// contains filtered or unexported fields
}
DynamicContentRepository - the nodes of one content type: the node row and its field values (entity.ContentTypeRepository's generic SetFieldValues/FieldValues, not a per-type ent entity). Built per request (NewDynamicContentRepositoryFactory): admin-created types are dynamic, and the struct is cheap.
func NewDynamicContentRepository ¶
func NewDynamicContentRepository( client *generated.Client, contentTypeRepo entity.ContentTypeRepository, taxonomyRepo entity.TaxonomyRepository, def entity.ContentTypeDef, fields entity.FieldInstanceDefs, ) *DynamicContentRepository
NewDynamicContentRepository - the repository of the nodes of the content type def with its fields: their values go through contentTypeRepo, the terms a node is loaded with come from taxonomyRepo.
func (DynamicContentRepository) ByNodeID ¶
func (r DynamicContentRepository) ByNodeID(ctx context.Context, nodeID int) (*entity.DynamicContent, error)
ByNodeID - the node with its field values, terms and text formats.
func (DynamicContentRepository) Create ¶
func (r DynamicContentRepository) Create(ctx context.Context, e *entity.DynamicContent) (*entity.DynamicContent, error)
Create persists a new node row plus its field values, in one transaction (the caller's unit of work when ctx carries one): a failed value leaves no node.
func (DynamicContentRepository) Update ¶
func (r DynamicContentRepository) Update(ctx context.Context, e *entity.DynamicContent) (*entity.DynamicContent, error)
Update saves the node's field values, then its own fields (title, slug, publishing, comment mode, flags, the schedule; the author and the date when set - an administrator's override, zero leaves them) - in one transaction (the caller's when ctx carries one): a failure halfway leaves the node as it was, its values not deleted.
type EntUnitOfWork ¶
type EntUnitOfWork struct {
// contains filtered or unexported fields
}
EntUnitOfWork implements entity.UnitOfWork with ent transactions.
func NewUnitOfWork ¶
func NewUnitOfWork(client *generated.Client) *EntUnitOfWork
NewUnitOfWork - the unit of work running its transactions on client.
func (*EntUnitOfWork) Do ¶
Do runs fn in a transaction: the repositories fn calls (GetClient) write in it, and it commits when fn succeeds. Inside another unit of work, or with a transaction's client, fn joins that transaction: a second one on another connection would not see its rows and could wait on its locks.
type FileFocalPoints ¶
type FileFocalPoints struct {
Files entity.FileRepository
Scheme string
}
FileFocalPoints implements imagestyle.FocalPoints over the files table: the focal point of the file stored at Scheme + key (public://, private://).
func (FileFocalPoints) FocalPoint ¶
func (f FileFocalPoints) FocalPoint(ctx context.Context, key string) (*imagestyle.FocalPoint, error)
FocalPoint - the focal point of the file stored under key (as a share of its width and height); nil when the file isn't known or has none.
type FileRepository ¶
type FileRepository struct {
// contains filtered or unexported fields
}
FileRepository is the ent-backed entity.FileRepository.
func NewFileRepository ¶
func NewFileRepository(fileClient *generated.FileClient) *FileRepository
NewFileRepository - the file repository on fileClient.
func (FileRepository) ByURI ¶
ByURI resolves a file by its URI (the first row of several sharing it).
func (FileRepository) Create ¶
func (r FileRepository) Create( ctx context.Context, uri, mimeType string, width, height, sizeBytes int, createdBy int, ) (*entity.File, error)
Create creates a new File record.
func (FileRepository) SetFocal ¶
func (r FileRepository) SetFocal(ctx context.Context, id int, focal *entity.FocalPoint) error
SetFocal sets a file's focal point (see entity.FileRepository.SetFocal).
func (FileRepository) SetOriginalFilename ¶
SetOriginalFilename sets a file's OriginalFilename (see entity.FileRepository.SetOriginalFilename).
type ImageStyleRepository ¶
type ImageStyleRepository struct {
// contains filtered or unexported fields
}
ImageStyleRepository is the ent adapter for entity.ImageStyleRepository.
func NewImageStyleRepository ¶
func NewImageStyleRepository(client *generated.Client) *ImageStyleRepository
NewImageStyleRepository - the image style repository on client.
func (ImageStyleRepository) CreateImageStyle ¶
func (r ImageStyleRepository) CreateImageStyle(ctx context.Context, s entity.ImageStyleDef) (*entity.ImageStyleDef, error)
CreateImageStyle adds the image style s and returns it with its ID.
func (ImageStyleRepository) DeleteImageStyle ¶
func (r ImageStyleRepository) DeleteImageStyle(ctx context.Context, id int) error
DeleteImageStyle deletes the image style with id; ErrEntityNotFound if there is none.
func (ImageStyleRepository) ImageStyleByID ¶
func (r ImageStyleRepository) ImageStyleByID(ctx context.Context, id int) (*entity.ImageStyleDef, error)
ImageStyleByID - the image style with id; ErrEntityNotFound if there is none.
func (ImageStyleRepository) ImageStyleByName ¶
func (r ImageStyleRepository) ImageStyleByName(ctx context.Context, name string) (*entity.ImageStyleDef, error)
ImageStyleByName - the image style named name; ErrEntityNotFound if there is none.
func (ImageStyleRepository) ImageStyles ¶
func (r ImageStyleRepository) ImageStyles(ctx context.Context) (entity.ImageStyleDefs, error)
ImageStyles - every image style, by name.
func (ImageStyleRepository) UpdateImageStyle ¶
func (r ImageStyleRepository) UpdateImageStyle(ctx context.Context, s entity.ImageStyleDef) (*entity.ImageStyleDef, error)
UpdateImageStyle never touches Name: URLs and Go call sites reference a style by name, so renaming would silently break them.
type ImageStyleRepositoryAdapter ¶
type ImageStyleRepositoryAdapter struct {
// contains filtered or unexported fields
}
ImageStyleRepositoryAdapter implements pkg/imagestyle.ImageStyleRepository (context-free) on top of the DB-backed entity.ImageStyleRepository, so the resize/serve pipeline (imagestyle.StyleService) resolves styles managed in the admin UI.
func NewImageStyleRepositoryAdapter ¶
func NewImageStyleRepositoryAdapter(repo entity.ImageStyleRepository) *ImageStyleRepositoryAdapter
NewImageStyleRepositoryAdapter - the adapter resolving styles through repo.
func (*ImageStyleRepositoryAdapter) FindByName ¶
func (a *ImageStyleRepositoryAdapter) FindByName(name string) (*imagestyle.ImageStyle, error)
FindByName - the style named name for the resize pipeline; imagestyle.ErrStyleNotFound if there is none.
type IntegrationSettingsRepository ¶
type IntegrationSettingsRepository struct {
// contains filtered or unexported fields
}
IntegrationSettingsRepository - counters and codes (one row).
func NewIntegrationSettingsRepository ¶
func NewIntegrationSettingsRepository(db *sql.DB) *IntegrationSettingsRepository
NewIntegrationSettingsRepository - the integration settings repository on db.
func (*IntegrationSettingsRepository) Get ¶
func (r *IntegrationSettingsRepository) Get(ctx context.Context) (*entity.IntegrationSettings, error)
Get - the counters, codes and consent settings from their single row.
func (*IntegrationSettingsRepository) Update ¶
func (r *IntegrationSettingsRepository) Update(ctx context.Context, s entity.IntegrationSettings) error
Update saves s into the integration settings row.
type InterfacePackRepository ¶
type InterfacePackRepository struct {
// contains filtered or unexported fields
}
InterfacePackRepository - entity.InterfacePackRepository on ent: the packs in interface_packs, their strings in interface_strings (origin "pack").
func NewInterfacePackRepository ¶
func NewInterfacePackRepository(db *sql.DB) *InterfacePackRepository
NewInterfacePackRepository - the repository on db.
func NewInterfacePackRepositoryOn ¶
func NewInterfacePackRepositoryOn(client *generated.Client) *InterfacePackRepository
NewInterfacePackRepositoryOn - the repository on client: for a caller with a client of its database (its dialect), not the app's.
func (*InterfacePackRepository) Delete ¶
func (r *InterfacePackRepository) Delete(ctx context.Context, lang string) error
Delete - see entity.InterfacePackRepository.Delete.
func (*InterfacePackRepository) Install ¶
func (r *InterfacePackRepository) Install(ctx context.Context, p entity.InterfacePack, strings []entity.InterfaceString) error
Install - see entity.InterfacePackRepository.Install.
func (*InterfacePackRepository) Packs ¶
func (r *InterfacePackRepository) Packs(ctx context.Context) ([]entity.InterfacePack, error)
Packs - see entity.InterfacePackRepository.Packs.
func (*InterfacePackRepository) Strings ¶
func (r *InterfacePackRepository) Strings(ctx context.Context) ([]entity.InterfaceString, error)
Strings - see entity.InterfacePackRepository.Strings.
type InterfaceStringRepository ¶
type InterfaceStringRepository struct {
// contains filtered or unexported fields
}
InterfaceStringRepository - entity.InterfaceStringRepository on ent.
func NewInterfaceStringRepository ¶
func NewInterfaceStringRepository(db *sql.DB) *InterfaceStringRepository
NewInterfaceStringRepository - the repository on db.
func (*InterfaceStringRepository) All ¶
func (r *InterfaceStringRepository) All(ctx context.Context) ([]entity.InterfaceString, error)
All - see entity.InterfaceStringRepository.All.
func (*InterfaceStringRepository) Delete ¶
func (r *InterfaceStringRepository) Delete(ctx context.Context, lang, msgctx, source string) error
Delete - see entity.InterfaceStringRepository.Delete.
func (*InterfaceStringRepository) Save ¶
func (r *InterfaceStringRepository) Save(ctx context.Context, s entity.InterfaceString) error
Save - see entity.InterfaceStringRepository.Save.
type MailLogRepository ¶
type MailLogRepository struct {
// contains filtered or unexported fields
}
MailLogRepository implements entity.MailLogRepository.
func NewMailLogRepository ¶
func NewMailLogRepository(db *sql.DB) *MailLogRepository
NewMailLogRepository creates a new MailLogRepository.
func (*MailLogRepository) Add ¶
func (r *MailLogRepository) Add(ctx context.Context, e entity.MailLogEntry) error
Add records an email (its address, subject and error cut to the columns).
func (*MailLogRepository) DeleteBefore ¶
DeleteBefore removes the entries older than t.
func (*MailLogRepository) List ¶
func (r *MailLogRepository) List(ctx context.Context, f entity.MailLogFilter) ([]entity.MailLogEntry, int, error)
List - the entries f asks for, newest first, and how many there are.
type MailSettingsRepository ¶
type MailSettingsRepository struct {
// contains filtered or unexported fields
}
MailSettingsRepository implements entity.MailSettingsRepository.
func NewMailSettingsRepository ¶
func NewMailSettingsRepository(db *sql.DB) *MailSettingsRepository
NewMailSettingsRepository - the mail settings repository on db.
func (*MailSettingsRepository) Get ¶
func (r *MailSettingsRepository) Get(ctx context.Context) (*entity.MailSettings, error)
Get - the mail settings from their single row, with the modules' ways of sending's settings (mail_transport_settings).
func (*MailSettingsRepository) Update ¶
func (r *MailSettingsRepository) Update(ctx context.Context, s *entity.MailSettings) error
Update saves the settings row (the secrets sealed), creating it if it isn't there, and replaces the transports' settings with s's (every value sealed; an empty one isn't kept).
type MailTemplateRepository ¶
type MailTemplateRepository struct {
// contains filtered or unexported fields
}
MailTemplateRepository implements entity.MailTemplateRepository.
func NewMailTemplateRepository ¶
func NewMailTemplateRepository(db *sql.DB) *MailTemplateRepository
NewMailTemplateRepository creates a new MailTemplateRepository.
func (*MailTemplateRepository) All ¶
func (r *MailTemplateRepository) All(ctx context.Context) (map[string]entity.StoredMail, error)
All - the emails changed, by key.
func (*MailTemplateRepository) SaveText ¶
func (r *MailTemplateRepository) SaveText(ctx context.Context, key string, t entity.MailTemplate) error
SaveText stores an email's text (blank - the default's).
func (*MailTemplateRepository) SetEnabled ¶
SetEnabled switches an email on or off.
type MaintenanceRepository ¶
type MaintenanceRepository struct {
// contains filtered or unexported fields
}
MaintenanceRepository implements entity.MaintenanceRepository.
func NewMaintenanceRepository ¶
func NewMaintenanceRepository(db *sql.DB) *MaintenanceRepository
NewMaintenanceRepository creates a new MaintenanceRepository.
func (*MaintenanceRepository) Get ¶
func (r *MaintenanceRepository) Get(ctx context.Context) (*entity.MaintenanceSettings, error)
Get returns the maintenance settings (single row).
func (*MaintenanceRepository) Update ¶
func (r *MaintenanceRepository) Update(ctx context.Context, s *entity.MaintenanceSettings) error
Update saves the maintenance settings.
type MediaRepository ¶
type MediaRepository struct {
// contains filtered or unexported fields
}
MediaRepository implements entity.MediaRepository: the files table with the places that use its files - the file and image fields, the types' default images and the modules' tables of files (migrations.FileColumns; entity.Module.NodeFiles name their content).
func NewMediaRepository ¶
func NewMediaRepository(db *sql.DB) *MediaRepository
NewMediaRepository - the media repository on db.
func (*MediaRepository) MediaFiles ¶
func (r *MediaRepository) MediaFiles(ctx context.Context, f entity.MediaFilter) ([]entity.File, int, error)
MediaFiles - see entity.MediaRepository.MediaFiles.
func (*MediaRepository) MediaTotals ¶
func (r *MediaRepository) MediaTotals(ctx context.Context) (entity.MediaTotals, error)
MediaTotals - how many files there are and their size in all.
func (*MediaRepository) MediaUploaders ¶
MediaUploaders - see entity.MediaRepository.MediaUploaders.
func (*MediaRepository) MediaUseCounts ¶
MediaUseCounts - see entity.MediaRepository.MediaUseCounts.
type MenuRepository ¶
type MenuRepository struct {
// contains filtered or unexported fields
}
MenuRepository is the ent adapter for entity.MenuRepository.
func NewMenuRepository ¶
func NewMenuRepository(client *generated.Client) *MenuRepository
NewMenuRepository - the menu repository on client.
func (MenuRepository) CreateMenu ¶
CreateMenu adds the menu m and returns it with its ID.
func (MenuRepository) CreateMenuLink ¶
func (r MenuRepository) CreateMenuLink(ctx context.Context, l entity.MenuLinkDef) (*entity.MenuLinkDef, error)
CreateMenuLink adds the menu link l and returns it with its ID.
func (MenuRepository) DeleteMenu ¶
func (r MenuRepository) DeleteMenu(ctx context.Context, id int) error
DeleteMenu removes the menu and all its links. This is an application-level cascade (fk_menu_links_menu has no ON DELETE CASCADE), so it runs two statements on the same tx-carrying ctx.
func (MenuRepository) DeleteMenuLink ¶
func (r MenuRepository) DeleteMenuLink(ctx context.Context, id int) error
DeleteMenuLink moves the deleted link's children up one level (to its ParentID) instead of relying on the FK's ON DELETE SET NULL, which would promote them all the way to the menu's top level.
func (MenuRepository) MenuByMachineName ¶
func (r MenuRepository) MenuByMachineName(ctx context.Context, machineName string) (*entity.MenuDef, error)
MenuByMachineName - the menu named machineName; ErrEntityNotFound if there is none.
func (MenuRepository) MenuLinkByID ¶
func (r MenuRepository) MenuLinkByID(ctx context.Context, id int) (*entity.MenuLinkDef, error)
MenuLinkByID - the menu link with id; ErrEntityNotFound if there is none.
func (MenuRepository) MenuLinksByMenuID ¶
func (r MenuRepository) MenuLinksByMenuID(ctx context.Context, menuID int) (entity.MenuLinkDefs, error)
MenuLinksByMenuID - the menu's links, all levels in one flat list, by weight, then ID.
func (MenuRepository) ReorderMenuLinks ¶
func (r MenuRepository) ReorderMenuLinks(ctx context.Context, updates []entity.MenuLinkOrderUpdate) error
ReorderMenuLinks bulk-applies Weight/ParentID from the admin drag-and-drop tree (one UpdateOneID call per row).
func (MenuRepository) UpdateMenu ¶
UpdateMenu never touches MachineName - identity strings are not renamed (same as TextFormatDef/ImageStyleDef).
func (MenuRepository) UpdateMenuLink ¶
func (r MenuRepository) UpdateMenuLink(ctx context.Context, l entity.MenuLinkDef) (*entity.MenuLinkDef, error)
UpdateMenuLink saves l over the link l.ID (its menu stays) and returns it; ErrEntityNotFound if there is none.
type ModuleRepository ¶
type ModuleRepository struct {
// contains filtered or unexported fields
}
ModuleRepository implements entity.ModuleRepository.
func NewModuleRepository ¶
func NewModuleRepository(db *sql.DB) *ModuleRepository
NewModuleRepository - the module repository on db.
func (*ModuleRepository) CountRows ¶
CountRows - rows in a module's data table (any table, so the query is built for it, quoted for the database).
func (*ModuleRepository) DeleteMenuLinks ¶
func (r *ModuleRepository) DeleteMenuLinks(ctx context.Context, paths []string) error
DeleteMenuLinks - see entity.ModuleRepository.DeleteMenuLinks.
func (*ModuleRepository) DeletePluginPlacements ¶
func (r *ModuleRepository) DeletePluginPlacements(ctx context.Context, ids []entity.PluginBlockID) error
DeletePluginPlacements removes the plugin blocks' placements, every theme.
func (*ModuleRepository) PluginPlacements ¶
func (r *ModuleRepository) PluginPlacements(ctx context.Context, ids []entity.PluginBlockID) ([]entity.PluginPlacementRef, error)
PluginPlacements - where the plugin blocks are placed, every theme.
func (*ModuleRepository) SetEnabled ¶
SetEnabled stores the module's state.
type ModuleUninstallRepository ¶
type ModuleUninstallRepository struct {
// contains filtered or unexported fields
}
ModuleUninstallRepository - the core tables' side of a module's uninstall (service.ModuleUninstall): its content, the settings of its content types, the files only its tables use, a vocabulary it owns.
func NewModuleUninstallRepository ¶
func NewModuleUninstallRepository(db *sql.DB) *ModuleUninstallRepository
NewModuleUninstallRepository creates a ModuleUninstallRepository.
func (*ModuleUninstallRepository) ClearFieldFormatters ¶
func (r *ModuleUninstallRepository) ClearFieldFormatters(ctx context.Context, names []string) error
ClearFieldFormatters makes the fields shown by these formatters - on the detail page (field_instances.detail_formatter) and in Views (view_fields.formatter) - show as links again.
func (*ModuleUninstallRepository) DeleteMailTexts ¶
func (r *ModuleUninstallRepository) DeleteMailTexts(ctx context.Context, prefix string) error
DeleteMailTexts forgets what the Mail page changed of the emails whose key starts with prefix (a module's): their texts and switches.
func (*ModuleUninstallRepository) DeleteMailTransportSettings ¶
func (r *ModuleUninstallRepository) DeleteMailTransportSettings(ctx context.Context, transports []string) error
DeleteMailTransportSettings forgets the settings of the ways of sending (a module's) and, if the saved mail settings send through one of them, that choice: the server config's settings apply again.
func (*ModuleUninstallRepository) DeleteNodeTypeSettings ¶
func (r *ModuleUninstallRepository) DeleteNodeTypeSettings(ctx context.Context, types []string) error
DeleteNodeTypeSettings removes what core settings keep for the content types: their search, SEO and breadcrumb rules; a block shown only on them loses them from its visibility, and is deleted when none is left (it showed on their pages only).
func (*ModuleUninstallRepository) DeleteViewCriteria ¶
func (r *ModuleUninstallRepository) DeleteViewCriteria(ctx context.Context, prefix string) error
DeleteViewCriteria removes the Views' sort criteria, filters and fields whose key (builtin_field) starts with prefix: a module's.
func (*ModuleUninstallRepository) DeleteVocabularyIfUnused ¶
func (r *ModuleUninstallRepository) DeleteVocabularyIfUnused(ctx context.Context, vid int) (bool, error)
DeleteVocabularyIfUnused deletes the vocabulary with its terms unless a taxonomy field, a search badge or a field value still uses it; reports whether it was deleted.
func (*ModuleUninstallRepository) FileIDs ¶
func (r *ModuleUninstallRepository) FileIDs(ctx context.Context, columns [][2]string) ([]int, error)
FileIDs - the files the columns reference (each a table and a column of a module's tables, from its schema); none while the module isn't installed.
func (*ModuleUninstallRepository) NodeIDsOfTypes ¶
func (r *ModuleUninstallRepository) NodeIDsOfTypes(ctx context.Context, types []string, limit int) ([]int, error)
NodeIDsOfTypes - up to limit IDs of nodes of the types, the trash's too.
func (*ModuleUninstallRepository) RemoveTextFilters ¶
func (r *ModuleUninstallRepository) RemoveTextFilters(ctx context.Context, names []string) (map[int][]string, error)
RemoveTextFilters takes the filters out of the text formats that have them on; returns those formats' filters left, by ID.
type NodeCounterRepository ¶
type NodeCounterRepository struct {
// contains filtered or unexported fields
}
NodeCounterRepository implements entity.NodeCounterRepository.
func NewNodeCounterRepository ¶
func NewNodeCounterRepository(db *sql.DB) *NodeCounterRepository
NewNodeCounterRepository creates a new NodeCounterRepository.
func (*NodeCounterRepository) DeleteViewDaysBefore ¶
func (r *NodeCounterRepository) DeleteViewDaysBefore(ctx context.Context, day int) error
DeleteViewDaysBefore drops the views by day older than day.
func (*NodeCounterRepository) IncrementView ¶
func (r *NodeCounterRepository) IncrementView(ctx context.Context, nid int) error
IncrementView counts a view of the node: its totals (incrementCounter) and its views of the site's day (node_view_days).
type NodeDeleteRepository ¶
type NodeDeleteRepository struct {
// contains filtered or unexported fields
}
NodeDeleteRepository implements entity.NodeDeleteRepository.
func NewNodeDeleteRepository ¶
func NewNodeDeleteRepository(db *sql.DB) *NodeDeleteRepository
NewNodeDeleteRepository creates a new NodeDeleteRepository.
func (*NodeDeleteRepository) DeleteNode ¶
func (r *NodeDeleteRepository) DeleteNode(ctx context.Context, nodeID int) error
DeleteNode deletes nodeID and everything attached to it in one transaction.
type NodeRepository ¶
type NodeRepository struct {
// contains filtered or unexported fields
}
NodeRepository provides database access to nodes.
func NewNodeRepository ¶
func NewNodeRepository(client *generated.Client) *NodeRepository
NewNodeRepository - the node repository on client.
func (NodeRepository) AnyWithViewRoles ¶
func (r NodeRepository) AnyWithViewRoles(ctx context.Context) (bool, error)
AnyWithViewRoles reports whether some node has view roles of its own (entity.Node.ViewRoles), whoever asks.
func (NodeRepository) ByID ¶
ByID - the node with nodeID, with its author and view counter; ErrEntityNotFound if there is none.
func (NodeRepository) ByIDs ¶
ByIDs - the nodes among ids that exist, by ID: their own columns, no edges.
func (NodeRepository) BySlug ¶
BySlug - the node with slug, with its author (and the author's role) and view counter; ErrEntityNotFound if there is none.
func (NodeRepository) ClearSchedule ¶
func (r NodeRepository) ClearSchedule(ctx context.Context, nodeID int) error
ClearSchedule clears the node's scheduled publishing and unpublishing.
func (NodeRepository) CountByType ¶
CountByType counts all nodes of the given type (any status, the trash too), used to guard deleting or renaming a content type that still has nodes.
func (NodeRepository) CountPathNodes ¶
func (r NodeRepository) CountPathNodes(ctx context.Context, nodeType string, onlyAuto bool) (int, error)
CountPathNodes - how many nodes of nodeType PathBatch goes through (onlyAuto - only those following their type's pattern).
func (NodeRepository) CountPublicSitemapNodes ¶
func (r NodeRepository) CountPublicSitemapNodes(ctx context.Context, excludeTypes []string) (int, error)
CountPublicSitemapNodes - see entity.NodesRepository.CountPublicSitemapNodes.
func (NodeRepository) CreateRow ¶
CreateRow stores a new node's row: its type, title, slug, status, moderation, comment mode, author and dates (created now unless set); its title's words go to the search index.
func (NodeRepository) DueToPublish ¶
DueToPublish - see entity.NodeScheduleRepository.DueToPublish; the earliest due first.
func (NodeRepository) DueToUnpublish ¶
DueToUnpublish - the nodes whose scheduled unpublishing has come by now, the earliest due first.
func (NodeRepository) ListForAdmin ¶
func (r NodeRepository) ListForAdmin(ctx context.Context, filter entity.AdminNodesFilter) (*entity.Nodes, int, error)
ListForAdmin returns nodes for the admin list with filters and pagination.
func (NodeRepository) ListForFeed ¶
func (r NodeRepository) ListForFeed(ctx context.Context, filter entity.FeedNodeFilter) (entity.Nodes, error)
ListForFeed - see entity.NodesRepository.ListForFeed.
func (NodeRepository) ListPublicSitemapNodes ¶
func (r NodeRepository) ListPublicSitemapNodes(ctx context.Context, excludeTypes []string, limit, offset int) ([]entity.SitemapNodeRow, error)
ListPublicSitemapNodes - see entity.NodesRepository.ListPublicSitemapNodes.
func (NodeRepository) PageSEO ¶
PageSEO - the node's own title and description (page_seo), empty without them.
func (NodeRepository) PathBatch ¶
func (r NodeRepository) PathBatch(ctx context.Context, nodeType string, afterID, limit int, onlyAuto bool) (entity.Nodes, error)
PathBatch - see entity.NodesRepository.PathBatch.
func (NodeRepository) RestoreNode ¶
func (r NodeRepository) RestoreNode(ctx context.Context, nodeID int) error
RestoreNode - see entity.NodeTrashRepository.RestoreNode.
func (NodeRepository) Schedule ¶
func (r NodeRepository) Schedule(ctx context.Context) (entity.NodeSchedule, error)
Schedule - see entity.NodeScheduleRepository.Schedule.
func (NodeRepository) SearchByTitle ¶
func (r NodeRepository) SearchByTitle(ctx context.Context, query string, types []string, limit int) ([]entity.NodeSearchHit, error)
SearchByTitle is a lightweight node search for pickers: no eager-loaded edges, since callers need only id/title/type/slug. Matches nodes.title or any short text field value (where alternative titles live), of public nodes only (published, not on moderation).
func (NodeRepository) SetLangcode ¶
SetLangcode - see entity.NodesRepository.SetLangcode.
func (NodeRepository) SetPublishing ¶
func (r NodeRepository) SetPublishing(ctx context.Context, nodeID, status, onModeration int) error
SetPublishing - see entity.NodesRepository.SetPublishing: updated_at set to what it was (the schema's update default would make it now).
func (NodeRepository) SlugExists ¶
SlugExists reports whether a node has the slug (of any type, whoever asks - entity.WithAllNodeTypes: slugs are unique across all nodes).
func (NodeRepository) SlugExistsExcludingNode ¶
func (r NodeRepository) SlugExistsExcludingNode(ctx context.Context, slug string, excludeNodeID int) (bool, error)
SlugExistsExcludingNode reports whether another node than excludeNodeID has the slug (of any type, whoever asks).
func (NodeRepository) TrashedBefore ¶
TrashedBefore - see entity.NodeTrashRepository.TrashedBefore.
func (NodeRepository) TrashedNodes ¶
func (r NodeRepository) TrashedNodes(ctx context.Context, limit, offset int) (entity.Nodes, int, error)
TrashedNodes - see entity.NodeTrashRepository.TrashedNodes.
func (NodeRepository) UpdateOnModeration ¶
UpdateOnModeration sets whether the node waits on moderation (1) or not (0).
func (NodeRepository) UpdateRow ¶
UpdateRow stores a node's row (CreateRow's columns), keeping its author and creation time when n doesn't set them; its title's words go to the search index.
func (NodeRepository) UpdateStatus ¶
UpdateStatus publishes (1) or unpublishes (0) the node; publishing clears its scheduled publishing, unpublishing its scheduled unpublishing (done, either way).
func (NodeRepository) UpsertPageSEO ¶
func (r NodeRepository) UpsertPageSEO(ctx context.Context, nodeID int, metaTitle, metaDescription string) error
UpsertPageSEO - see entity.NodesRepository.UpsertPageSEO.
type NodeRevisionRepository ¶
type NodeRevisionRepository struct {
// contains filtered or unexported fields
}
NodeRevisionRepository - entity.NodeRevisionRepository on ent.
func NewNodeRevisionRepository ¶
func NewNodeRevisionRepository(client *generated.Client) *NodeRevisionRepository
NewNodeRevisionRepository - the node revision repository on client.
func (NodeRevisionRepository) ByID ¶
func (r NodeRevisionRepository) ByID(ctx context.Context, nodeID, id int) (*entity.NodeRevision, error)
ByID - see entity.NodeRevisionRepository.ByID.
func (NodeRevisionRepository) Create ¶
func (r NodeRevisionRepository) Create(ctx context.Context, rev entity.NodeRevision) (int, error)
Create stores the revision rev (its snapshot encoded) and returns its ID.
func (NodeRevisionRepository) Latest ¶
func (r NodeRevisionRepository) Latest(ctx context.Context, nodeID int) (*entity.NodeRevision, error)
Latest - see entity.NodeRevisionRepository.Latest.
func (NodeRevisionRepository) List ¶
func (r NodeRevisionRepository) List(ctx context.Context, nodeID, offset, limit int) ([]entity.NodeRevision, int, error)
List - see entity.NodeRevisionRepository.List.
func (NodeRevisionRepository) Prune ¶
func (r NodeRevisionRepository) Prune(ctx context.Context, nodeID, keep int) error
Prune - see entity.NodeRevisionRepository.Prune.
func (NodeRevisionRepository) Recent ¶
func (r NodeRevisionRepository) Recent(ctx context.Context, f entity.RecentRevisionsFilter) ([]entity.RecentRevision, int, error)
Recent - see entity.NodeRevisionRepository.Recent.
type OAuthSettingsRepository ¶
type OAuthSettingsRepository struct {
// contains filtered or unexported fields
}
OAuthSettingsRepository implements entity.OAuthSettingsRepository.
func NewOAuthSettingsRepository ¶
func NewOAuthSettingsRepository(db *sql.DB) *OAuthSettingsRepository
NewOAuthSettingsRepository - the OAuth settings repository on db.
func (*OAuthSettingsRepository) LinkedAccounts ¶
LinkedAccounts - see entity.OAuthSettingsRepository.LinkedAccounts.
func (*OAuthSettingsRepository) List ¶
func (r *OAuthSettingsRepository) List(ctx context.Context) (map[string]entity.OAuthProviderSettings, error)
List - see entity.OAuthSettingsRepository.List.
func (*OAuthSettingsRepository) Upsert ¶
func (r *OAuthSettingsRepository) Upsert(ctx context.Context, s entity.OAuthProviderSettings) error
Upsert saves a provider's row (the client secret sealed), creating it if it isn't there.
type PreviewLinkRepository ¶
type PreviewLinkRepository struct {
// contains filtered or unexported fields
}
PreviewLinkRepository - see entity.PreviewLinkRepository.
func NewPreviewLinkRepository ¶
func NewPreviewLinkRepository(client *generated.Client) *PreviewLinkRepository
NewPreviewLinkRepository - the preview link repository on client.
func (*PreviewLinkRepository) DeletePreviewLinks ¶
func (r *PreviewLinkRepository) DeletePreviewLinks(ctx context.Context, nodeID int) error
DeletePreviewLinks - see entity.PreviewLinkRepository.DeletePreviewLinks.
func (*PreviewLinkRepository) PreviewLinkByHash ¶
func (r *PreviewLinkRepository) PreviewLinkByHash(ctx context.Context, tokenHash string) (*entity.PreviewLink, error)
PreviewLinkByHash - see entity.PreviewLinkRepository.PreviewLinkByHash.
func (*PreviewLinkRepository) PreviewLinkOf ¶
func (r *PreviewLinkRepository) PreviewLinkOf(ctx context.Context, nodeID int) (*entity.PreviewLink, error)
PreviewLinkOf - see entity.PreviewLinkRepository.PreviewLinkOf.
func (*PreviewLinkRepository) ReplacePreviewLink ¶
func (r *PreviewLinkRepository) ReplacePreviewLink(ctx context.Context, link entity.PreviewLink, tokenHash string) error
ReplacePreviewLink - see entity.PreviewLinkRepository.ReplacePreviewLink.
type RedirectRepository ¶
type RedirectRepository struct {
// contains filtered or unexported fields
}
RedirectRepository implements entity.RedirectRepository.
func NewRedirectRepository ¶
func NewRedirectRepository(db *sql.DB) *RedirectRepository
NewRedirectRepository creates a new RedirectRepository.
func (*RedirectRepository) Create ¶
func (r *RedirectRepository) Create(ctx context.Context, red entity.Redirect) (*entity.Redirect, error)
Create inserts a new redirect.
func (*RedirectRepository) Delete ¶
func (r *RedirectRepository) Delete(ctx context.Context, id int) error
Delete removes a redirect by ID.
func (*RedirectRepository) DeleteByFromPath ¶
func (r *RedirectRepository) DeleteByFromPath(ctx context.Context, fromPath string) error
DeleteByFromPath removes a redirect by from_path.
type RoleRepository ¶
type RoleRepository struct {
// contains filtered or unexported fields
}
RoleRepository is the ent-backed entity.RoleRepository.
func NewRoleRepository ¶
func NewRoleRepository(client *generated.RoleClient) *RoleRepository
NewRoleRepository - the role repository on client.
func (RoleRepository) CountUsers ¶
CountUsers - see entity.RoleRepository.CountUsers.
func (RoleRepository) Delete ¶
func (r RoleRepository) Delete(ctx context.Context, id int) error
Delete deletes the role with id.
func (RoleRepository) Find ¶
func (r RoleRepository) Find(ctx context.Context, filter entity.RoleFilter) (*entity.Role, error)
Find - the first role matching filter (by name when it has one); ErrEntityNotFound if there is none.
type SEORepository ¶
type SEORepository struct {
// contains filtered or unexported fields
}
SEORepository - seo_templates and seo_rules (entity.SEOTemplateRepository, entity.SEORuleRepository).
func NewSEORepository ¶
func NewSEORepository(db *sql.DB) *SEORepository
NewSEORepository - the SEO templates and rules repository on db.
func (*SEORepository) CreateSEORule ¶
func (r *SEORepository) CreateSEORule(ctx context.Context, rule entity.SEORuleDef) (*entity.SEORuleDef, error)
CreateSEORule adds the rule and returns it with its ID.
func (*SEORepository) DeleteSEORule ¶
func (r *SEORepository) DeleteSEORule(ctx context.Context, id int) error
DeleteSEORule deletes the rule with id.
func (*SEORepository) SEORuleByID ¶
func (r *SEORepository) SEORuleByID(ctx context.Context, id int) (*entity.SEORuleDef, error)
SEORuleByID - the rule with id; ErrEntityNotFound if there is none.
func (*SEORepository) SEORules ¶
func (r *SEORepository) SEORules(ctx context.Context) (entity.SEORuleDefs, error)
SEORules - see entity.SEORuleRepository.SEORules.
func (*SEORepository) SEOTemplates ¶
func (r *SEORepository) SEOTemplates(ctx context.Context) (entity.SEOTemplates, error)
SEOTemplates - every saved scope's templates, by scope.
func (*SEORepository) SaveSEOTemplate ¶
func (r *SEORepository) SaveSEOTemplate(ctx context.Context, t entity.SEOTemplate) error
SaveSEOTemplate saves a scope's templates, creating the row if it isn't there.
func (*SEORepository) UpdateSEORule ¶
func (r *SEORepository) UpdateSEORule(ctx context.Context, rule entity.SEORuleDef) error
UpdateSEORule saves rule over the rule with its ID.
func (*SEORepository) UpdateSEORuleWeight ¶
func (r *SEORepository) UpdateSEORuleWeight(ctx context.Context, id, weight int) error
UpdateSEORuleWeight sets only the rule's weight (its place in the order).
type SearchConfigRepository ¶
type SearchConfigRepository struct {
// contains filtered or unexported fields
}
SearchConfigRepository - search_types and search_settings (entity.SearchConfigRepository).
func NewSearchConfigRepository ¶
func NewSearchConfigRepository(db *sql.DB) *SearchConfigRepository
NewSearchConfigRepository - the search settings repository on db.
func (*SearchConfigRepository) SaveSearchSettings ¶
func (r *SearchConfigRepository) SaveSearchSettings(ctx context.Context, s entity.SearchSettings) error
SaveSearchSettings saves s into the search settings row.
func (*SearchConfigRepository) SaveSearchType ¶
func (r *SearchConfigRepository) SaveSearchType(ctx context.Context, t entity.SearchTypeDef) error
SaveSearchType saves a content type's search settings, creating the row if it isn't there.
func (*SearchConfigRepository) SearchSettings ¶
func (r *SearchConfigRepository) SearchSettings(ctx context.Context) (*entity.SearchSettings, error)
SearchSettings - the live search's site-wide settings from their single row.
func (*SearchConfigRepository) SearchTypes ¶
func (r *SearchConfigRepository) SearchTypes(ctx context.Context) (entity.SearchTypeDefs, error)
SearchTypes - see entity.SearchConfigRepository.SearchTypes.
func (*SearchConfigRepository) UpdateSearchTypeWeight ¶
func (r *SearchConfigRepository) UpdateSearchTypeWeight(ctx context.Context, nodeType string, weight int) error
UpdateSearchTypeWeight sets only the searched type's weight (its place in the order).
type SearchRepository ¶
type SearchRepository struct {
// contains filtered or unexported fields
}
SearchRepository runs the live search over the searched node types (entity.SearchTypeDef).
func NewSearchRepository ¶
func NewSearchRepository(client *generated.Client) *SearchRepository
NewSearchRepository creates a new SearchRepository.
func (*SearchRepository) Search ¶
func (r *SearchRepository) Search(ctx context.Context, query string, limit int, types entity.SearchTypeDefs, settings entity.SearchSettings) ([]entity.SearchResult, error)
Search runs the live search for the words of query (searchtext.Query: stemmed in the site's languages, the last one as a beginning), each to be found, in any order, in the search index (search_words):
- per type searching fields (searchesFields; in parallel): nodes with every word in the title or one of its fields, up to the type's Limit;
- one title search over every searched type (limit*2), every word in the title, adding nodes not found yet;
- batch enrichment per type: title/subtitle fields, image field (or its default image, or the placeholder image) in the type's style, badge terms, label;
- grouped by type in weight order, inside a type by titleRankOf, then the newest; cut to limit.
func (*SearchRepository) Snippets ¶
func (r *SearchRepository) Snippets(ctx context.Context, query string, results []entity.SearchResult, types entity.SearchTypeDefs) (map[int]entity.SearchSnippet, error)
Snippets - per result its snippet (searchtext.Query.Snippet, the words stemmed in the item's language): from the first of the fields its type searches (searchFields), in their order, whose text has the query's words; a type searching only the title has none.
type SiteInformationRepository ¶
type SiteInformationRepository struct {
// contains filtered or unexported fields
}
SiteInformationRepository - the site information row. Read on every page, it is kept after the first read until the repository writes it (the site runs one process; app migrate, which writes it too, is followed by a restart).
func NewSiteInformationRepository ¶
func NewSiteInformationRepository(db *sql.DB) *SiteInformationRepository
NewSiteInformationRepository - the site information repository on db.
func (*SiteInformationRepository) Cached ¶
func (r *SiteInformationRepository) Cached() *entity.SiteInformation
Cached - the site information kept in memory, nil when none is (not read since it was written): for a page made without the database (it is gone).
func (*SiteInformationRepository) Get ¶
func (r *SiteInformationRepository) Get(ctx context.Context) (*entity.SiteInformation, error)
Get - the site information; outside a transaction, the one kept since the last write (a copy).
func (*SiteInformationRepository) RenameFrontFeedView ¶
func (r *SiteInformationRepository) RenameFrontFeedView(ctx context.Context, oldName, newName string) error
RenameFrontFeedView - the front page feed's View (FrontFeedView) from display oldName to newName, if it is oldName: the display was renamed.
func (*SiteInformationRepository) SetLanguages ¶
func (r *SiteInformationRepository) SetLanguages(ctx context.Context, languages []entity.SiteLanguage) error
SetLanguages stores the site's languages besides the default one (entity.SiteInformation.Languages).
func (*SiteInformationRepository) SetRobotsExtra ¶
func (r *SiteInformationRepository) SetRobotsExtra(ctx context.Context, rules string) error
SetRobotsExtra stores the site's own robots.txt rules (Access blocking page); Update leaves them as is.
func (*SiteInformationRepository) SetSchemaOrg ¶
func (r *SiteInformationRepository) SetSchemaOrg(ctx context.Context, o entity.SiteSchemaOrg) error
SetSchemaOrg stores who runs the site (entity.SiteInformation.SchemaOrg).
func (*SiteInformationRepository) SetTheme ¶
func (r *SiteInformationRepository) SetTheme(ctx context.Context, theme string) error
SetTheme stores the active theme (Appearance page); Update leaves it as is.
func (*SiteInformationRepository) Update ¶
func (r *SiteInformationRepository) Update(ctx context.Context, s *entity.SiteInformation) error
Update saves the site's name, slogan, e-mail, front page feed, timezone, default language, error pages, base URL, logo and icon; the theme, the robots.txt rules, the languages and the schema.org data have their own setters and stay.
type StatisticsSettingsRepository ¶
type StatisticsSettingsRepository struct {
// contains filtered or unexported fields
}
StatisticsSettingsRepository implements entity.StatisticsSettingsRepository.
func NewStatisticsSettingsRepository ¶
func NewStatisticsSettingsRepository(db *sql.DB) *StatisticsSettingsRepository
NewStatisticsSettingsRepository creates a new StatisticsSettingsRepository.
func (*StatisticsSettingsRepository) Get ¶
func (r *StatisticsSettingsRepository) Get(ctx context.Context) (*entity.StatisticsSettings, error)
Get returns the statistics settings (single row).
func (*StatisticsSettingsRepository) Update ¶
func (r *StatisticsSettingsRepository) Update(ctx context.Context, s *entity.StatisticsSettings) error
Update saves statistics settings.
type TaxonomyRepository ¶
type TaxonomyRepository struct {
// contains filtered or unexported fields
}
TaxonomyRepository provides database access to vocabularies and terms.
func NewTaxonomyRepository ¶
func NewTaxonomyRepository( client *generated.Client, ) *TaxonomyRepository
NewTaxonomyRepository - the vocabulary and term repository on client.
func (TaxonomyRepository) CountNodesByTermID ¶
CountNodesByTermID - see entity.TaxonomyRepository.CountNodesByTermID.
func (TaxonomyRepository) CreateTerm ¶
func (r TaxonomyRepository) CreateTerm(ctx context.Context, vocabularyID int, name, slug string, createdBy int) (*entity.TaxonomyTerm, error)
CreateTerm adds a top-level term to the vocabulary and returns it with its vocabulary.
func (TaxonomyRepository) CreateTermFull ¶
func (r TaxonomyRepository) CreateTermFull(ctx context.Context, vocabularyID int, name, slug, desc string, weight, parentID, createdBy int) (*entity.TaxonomyTerm, error)
CreateTermFull adds a term with all its settings (parentID 0 - a top-level one) and returns it with its vocabulary.
func (TaxonomyRepository) CreateVocabulary ¶
func (r TaxonomyRepository) CreateVocabulary(ctx context.Context, name, slug, termPathPrefix, desc string, publicTermPages bool, weight, createdBy int) (*entity.TaxonomyVocabulary, error)
CreateVocabulary adds a vocabulary and returns it with its ID.
func (TaxonomyRepository) DeleteTerm ¶
func (r TaxonomyRepository) DeleteTerm(ctx context.Context, id int) error
DeleteTerm deletes the term with id; ErrEntityNotFound if there is none.
func (TaxonomyRepository) DeleteVocabulary ¶
func (r TaxonomyRepository) DeleteVocabulary(ctx context.Context, id int) error
DeleteVocabulary deletes the vocabulary with id; ErrEntityNotFound if there is none.
func (TaxonomyRepository) FieldTermIDsForNode ¶
FieldTermIDsForNode - see entity.TaxonomyRepository.FieldTermIDsForNode.
func (TaxonomyRepository) NodeTermsByID ¶
func (r TaxonomyRepository) NodeTermsByID(ctx context.Context, nID int) (entity.TaxonomyTerms, error)
NodeTermsByID - the node's terms (each with its vocabulary) from the terms index, in the order they were indexed.
func (TaxonomyRepository) NodeTermsByIDs ¶
func (r TaxonomyRepository) NodeTermsByIDs(ctx context.Context, nodeIDs []int) (map[int]entity.TaxonomyTerms, error)
NodeTermsByIDs is NodeTermsByID batched over many node IDs in one query - for list pages that need per-item terms.
func (TaxonomyRepository) SearchTermsByName ¶
func (r TaxonomyRepository) SearchTermsByName(ctx context.Context, vocabularyID int, query string, limit int) (entity.TaxonomyTerms, error)
SearchTermsByName - at most limit terms of the vocabulary whose name contains query (letter case aside), by weight, then name.
func (TaxonomyRepository) TermByID ¶
func (r TaxonomyRepository) TermByID(ctx context.Context, id int) (*entity.TaxonomyTerm, error)
TermByID - the term with id, with its vocabulary; ErrEntityNotFound if there is none.
func (TaxonomyRepository) TermBySlug ¶
func (r TaxonomyRepository) TermBySlug(ctx context.Context, slug string) (*entity.TaxonomyTerm, error)
TermBySlug - the term with slug, with its vocabulary; ErrEntityNotFound if there is none.
func (TaxonomyRepository) TermNodeCounts ¶
func (r TaxonomyRepository) TermNodeCounts(ctx context.Context, vocabularyID int) (map[int]int, error)
TermNodeCounts - the published content per term that ctx's visitor may view, out of the trash (schema.LiveNodes: the subquery isn't a node query the interceptor sees).
func (TaxonomyRepository) TermsByIDs ¶
func (r TaxonomyRepository) TermsByIDs(ctx context.Context, ids []int) (map[int]entity.TaxonomyTerm, error)
TermsByIDs is TermByID batched over many term IDs in one query - see entity.TaxonomyRepository's doc comment for why.
func (TaxonomyRepository) TermsByVocabularyID ¶
func (r TaxonomyRepository) TermsByVocabularyID(ctx context.Context, vocabularyID int) (entity.TaxonomyTerms, error)
TermsByVocabularyID - every term of the vocabulary, all levels in one flat list, by weight, then name.
func (TaxonomyRepository) UpdateNodeTerms ¶
UpdateNodeTerms replaces the node's terms index with termIDs, in one transaction (the caller's when ctx carries one): a failure keeps the old index.
func (TaxonomyRepository) UpdateTerm ¶
func (r TaxonomyRepository) UpdateTerm(ctx context.Context, id int, name, slug, desc string, weight, parentID int) (*entity.TaxonomyTerm, error)
UpdateTerm saves the term's name, slug, description, weight and parent (0 - none) and returns it with its vocabulary; ErrEntityNotFound if there is none.
func (TaxonomyRepository) UpdateTermPageTitle ¶
func (r TaxonomyRepository) UpdateTermPageTitle(ctx context.Context, id int, pageTitle string) error
UpdateTermPageTitle sets only the term's page title.
func (TaxonomyRepository) UpdateTermSortOrder ¶
func (r TaxonomyRepository) UpdateTermSortOrder(ctx context.Context, id int, weight, parentID int) error
UpdateTermSortOrder updates only a term's Weight/ParentID (a bulk reorder), never its Name/Slug/Description.
func (TaxonomyRepository) UpdateVocabulary ¶
func (r TaxonomyRepository) UpdateVocabulary(ctx context.Context, id int, name, slug, termPathPrefix, desc string, publicTermPages bool, weight int) (*entity.TaxonomyVocabulary, error)
UpdateVocabulary saves the vocabulary's name, slug, term path prefix, description, public term pages and weight, and returns it; ErrEntityNotFound if there is none.
func (TaxonomyRepository) UpdateVocabularySortOrder ¶
func (r TaxonomyRepository) UpdateVocabularySortOrder(ctx context.Context, id int, weight int) error
UpdateVocabularySortOrder updates only a vocabulary's Weight (the drag-and-drop reordering), never its Name/Slug/Description.
func (TaxonomyRepository) Vocabularies ¶
func (r TaxonomyRepository) Vocabularies(ctx context.Context) (entity.TaxonomyVocabularies, error)
Vocabularies - every vocabulary, by weight, then name.
func (TaxonomyRepository) VocabularyByID ¶
func (r TaxonomyRepository) VocabularyByID(ctx context.Context, id int) (*entity.TaxonomyVocabulary, error)
VocabularyByID - the vocabulary with id; ErrEntityNotFound if there is none.
type TextFormatRepository ¶
type TextFormatRepository struct {
// contains filtered or unexported fields
}
TextFormatRepository is the ent adapter for entity.TextFormatRepository.
func NewTextFormatRepository ¶
func NewTextFormatRepository(client *generated.Client) *TextFormatRepository
NewTextFormatRepository - the text format repository on client.
func (TextFormatRepository) CreateTextFormat ¶
func (r TextFormatRepository) CreateTextFormat(ctx context.Context, f entity.TextFormatDef) (*entity.TextFormatDef, error)
CreateTextFormat adds the text format f and returns it with its ID.
func (TextFormatRepository) DeleteTextFormat ¶
func (r TextFormatRepository) DeleteTextFormat(ctx context.Context, id int) error
DeleteTextFormat doesn't guard against formats still referenced by field_value_text.text_format_id: that content was sanitized at save time and still renders; the edit form just falls back to the field's lowest-weight allowed format.
func (TextFormatRepository) TextFormatByID ¶
func (r TextFormatRepository) TextFormatByID(ctx context.Context, id int) (*entity.TextFormatDef, error)
TextFormatByID - the text format with id; ErrEntityNotFound if there is none.
func (TextFormatRepository) TextFormatByMachineName ¶
func (r TextFormatRepository) TextFormatByMachineName(ctx context.Context, machineName string) (*entity.TextFormatDef, error)
TextFormatByMachineName - the text format named machineName; ErrEntityNotFound if there is none.
func (TextFormatRepository) TextFormats ¶
func (r TextFormatRepository) TextFormats(ctx context.Context) (entity.TextFormatDefs, error)
TextFormats - every text format, by weight.
func (TextFormatRepository) UpdateTextFormat ¶
func (r TextFormatRepository) UpdateTextFormat(ctx context.Context, f entity.TextFormatDef) (*entity.TextFormatDef, error)
UpdateTextFormat never touches MachineName: like other machine names, it is an immutable identity string.
type ThemeSettingsRepository ¶
type ThemeSettingsRepository struct {
// contains filtered or unexported fields
}
ThemeSettingsRepository implements entity.ThemeSettingsRepository.
func NewThemeSettingsRepository ¶
func NewThemeSettingsRepository(db *sql.DB) *ThemeSettingsRepository
NewThemeSettingsRepository creates a new ThemeSettingsRepository.
type TwoFactorRepository ¶
type TwoFactorRepository struct {
// contains filtered or unexported fields
}
TwoFactorRepository - entity.TwoFactorRepository on ent.
func NewTwoFactorRepository ¶
func NewTwoFactorRepository(db *sql.DB) *TwoFactorRepository
NewTwoFactorRepository creates a TwoFactorRepository.
func (*TwoFactorRepository) AcceptStep ¶
AcceptStep - see entity.TwoFactorRepository.AcceptStep.
func (*TwoFactorRepository) Disable ¶
func (r *TwoFactorRepository) Disable(ctx context.Context, userID int) error
Disable - see entity.TwoFactorRepository.Disable.
func (*TwoFactorRepository) Enable ¶
func (r *TwoFactorRepository) Enable(ctx context.Context, userID int, secret string, step int64, codeHashes []string, at time.Time) error
Enable - see entity.TwoFactorRepository.Enable (the secret sealed).
func (*TwoFactorRepository) EnabledAmong ¶
func (r *TwoFactorRepository) EnabledAmong(ctx context.Context, userIDs []int) (map[int]bool, error)
EnabledAmong - see entity.TwoFactorRepository.EnabledAmong.
func (*TwoFactorRepository) ReplaceRecoveryCodes ¶
func (r *TwoFactorRepository) ReplaceRecoveryCodes(ctx context.Context, userID int, codeHashes []string) error
ReplaceRecoveryCodes - see entity.TwoFactorRepository.ReplaceRecoveryCodes.
func (*TwoFactorRepository) UseRecoveryCode ¶
func (r *TwoFactorRepository) UseRecoveryCode(ctx context.Context, userID int, codeHash string) (bool, error)
UseRecoveryCode - see entity.TwoFactorRepository.UseRecoveryCode.
type UploadSettingsRepository ¶
type UploadSettingsRepository struct {
// contains filtered or unexported fields
}
UploadSettingsRepository implements entity.UploadSettingsRepository.
func NewUploadSettingsRepository ¶
func NewUploadSettingsRepository(db *sql.DB) *UploadSettingsRepository
NewUploadSettingsRepository - the upload settings repository on db.
func (*UploadSettingsRepository) Get ¶
func (r *UploadSettingsRepository) Get(ctx context.Context) (*entity.UploadSettings, error)
Get - the upload policy from its single row.
func (*UploadSettingsRepository) Update ¶
func (r *UploadSettingsRepository) Update(ctx context.Context, s *entity.UploadSettings) error
Update saves s into the upload policy row.
type UserAuthTokenRepository ¶
type UserAuthTokenRepository struct {
// contains filtered or unexported fields
}
UserAuthTokenRepository stores hashed one-time login and password-reset tokens.
func NewUserAuthTokenRepository ¶
func NewUserAuthTokenRepository(db *sql.DB) *UserAuthTokenRepository
NewUserAuthTokenRepository - the auth token repository on db.
func (*UserAuthTokenRepository) Consume ¶
func (r *UserAuthTokenRepository) Consume(ctx context.Context, tokenHash, kind string) (userID int, ok bool, err error)
Consume marks the newest matching unused token as used and returns user_id (single-use).
func (*UserAuthTokenRepository) Insert ¶
func (r *UserAuthTokenRepository) Insert(ctx context.Context, userID int, tokenHash, kind string, expiresAt time.Time) error
Insert stores the hash of a token of kind for the user, valid until expiresAt.
func (*UserAuthTokenRepository) InvalidateUserKind ¶
func (r *UserAuthTokenRepository) InvalidateUserKind(ctx context.Context, userID int, kind string) error
InvalidateUserKind removes unused tokens of a kind for a user (e.g. before issuing a new reset).
type UserContentRepository ¶
type UserContentRepository struct {
// contains filtered or unexported fields
}
UserContentRepository implements entity.UserContentRepository - cross-table "everything this user owns" queries that don't belong to any single entity's repository.
func NewUserContentRepository ¶
func NewUserContentRepository(db *sql.DB) *UserContentRepository
NewUserContentRepository creates a new UserContentRepository.
func (*UserContentRepository) DeleteUnreferencedFiles ¶
func (r *UserContentRepository) DeleteUnreferencedFiles(ctx context.Context, fileIDs []int) ([]string, error)
DeleteUnreferencedFiles deletes those of the files no file field, default image or module table uses, and returns the URIs no remaining files row shares (safe to remove from disk).
func (*UserContentRepository) FileIDsByCreator ¶
FileIDsByCreator - see entity.UserContentRepository.FileIDsByCreator.
func (*UserContentRepository) ModuleInstalled ¶
ModuleInstalled - whether the module was installed (its tables exist).
func (*UserContentRepository) NodeFileIDs ¶
NodeFileIDs - the files of the nodes' file fields (their blocks' too: deleted with them) and the ones the modules attach to them.
func (*UserContentRepository) NodesWithFile ¶
NodesWithFile - the content items whose file fields hold the file: a blocks field's item counts as its node.
func (*UserContentRepository) Summary ¶
func (r *UserContentRepository) Summary(ctx context.Context, userID int) (entity.UserContentSummary, error)
Summary - the user's nodes by type (the most first), comments and uploaded files, counted; the modules' content is the caller's.
type UserFieldRepository ¶
type UserFieldRepository struct {
// contains filtered or unexported fields
}
UserFieldRepository - user_fields / user_field_values.
func NewUserFieldRepository ¶
func NewUserFieldRepository(db *sql.DB) *UserFieldRepository
NewUserFieldRepository - the profile field repository on db.
func (*UserFieldRepository) CreateField ¶
func (r *UserFieldRepository) CreateField(ctx context.Context, f entity.UserFieldDef) (int, error)
CreateField adds the profile field f and returns its ID.
func (*UserFieldRepository) DeleteField ¶
func (r *UserFieldRepository) DeleteField(ctx context.Context, id int) error
DeleteField - see entity.UserFieldRepository.DeleteField.
func (*UserFieldRepository) DeleteUserValues ¶
func (r *UserFieldRepository) DeleteUserValues(ctx context.Context, userID int) error
DeleteUserValues deletes every profile field value of the user.
func (*UserFieldRepository) Fields ¶
func (r *UserFieldRepository) Fields(ctx context.Context) (entity.UserFieldDefs, error)
Fields - every profile field, by weight, then ID.
func (*UserFieldRepository) SetValues ¶
func (r *UserFieldRepository) SetValues(ctx context.Context, userID int, values map[int]string) error
SetValues saves the user's values: an empty one deletes the row, the rest are updated or created.
func (*UserFieldRepository) UpdateField ¶
func (r *UserFieldRepository) UpdateField(ctx context.Context, f entity.UserFieldDef) error
UpdateField saves f's label, length limit, weight and whether it is required over the field f.ID (its machine name stays).
type UserFileUsageRepository ¶
type UserFileUsageRepository struct {
// contains filtered or unexported fields
}
UserFileUsageRepository implements entity.UserFileUsageRepository. The text scan reads many tables generically, so it stays hand-written SQL (portable; placeholders through rebind).
func NewUserFileUsageRepository ¶
func NewUserFileUsageRepository(db *sql.DB) *UserFileUsageRepository
NewUserFileUsageRepository - the user file usage repository on db.
func (*UserFileUsageRepository) Describe ¶
func (r *UserFileUsageRepository) Describe(ctx context.Context, usages []entity.UserFileUsage) ([]entity.UserFileRef, error)
Describe gives each usage the title of its text's owner and a link.
func (*UserFileUsageRepository) ScanTextsFor ¶
func (r *UserFileUsageRepository) ScanTextsFor(ctx context.Context, path string, fn func(string, int, string)) error
ScanTextsFor - see entity.UserFileUsageRepository.ScanTextsFor; path is relative to the public files' URL.
type UserOAuthIdentityRepository ¶
type UserOAuthIdentityRepository struct {
// contains filtered or unexported fields
}
UserOAuthIdentityRepository implements entity.UserOAuthIdentityRepository: the provider accounts connected to the users'.
func NewUserOAuthIdentityRepository ¶
func NewUserOAuthIdentityRepository(client *generated.Client) *UserOAuthIdentityRepository
NewUserOAuthIdentityRepository - the connected provider account repository on client.
func (*UserOAuthIdentityRepository) ByUser ¶
func (r *UserOAuthIdentityRepository) ByUser(ctx context.Context, userID int) ([]entity.UserOAuthIdentity, error)
ByUser - see entity.UserOAuthIdentityRepository.ByUser; by provider.
func (*UserOAuthIdentityRepository) Create ¶
func (r *UserOAuthIdentityRepository) Create(ctx context.Context, identity entity.UserOAuthIdentity) (*entity.UserOAuthIdentity, error)
Create stores the connection identity (an empty e-mail address - none) and returns it with its ID.
func (*UserOAuthIdentityRepository) Delete ¶
func (r *UserOAuthIdentityRepository) Delete(ctx context.Context, userID int, provider string) error
Delete - see entity.UserOAuthIdentityRepository.Delete.
func (*UserOAuthIdentityRepository) FindByProviderUser ¶
func (r *UserOAuthIdentityRepository) FindByProviderUser(ctx context.Context, provider, providerUserID string) (*entity.UserOAuthIdentity, error)
FindByProviderUser - the connection of the provider's account providerUserID; apperrors.ErrNotFound if there is none.
func (*UserOAuthIdentityRepository) FindByUserAndProvider ¶
func (r *UserOAuthIdentityRepository) FindByUserAndProvider(ctx context.Context, userID int, provider string) (*entity.UserOAuthIdentity, error)
FindByUserAndProvider - the user's connection to the provider; apperrors.ErrNotFound if there is none.
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository is the ent-backed entity.UserRepository.
func NewUserRepository ¶
func NewUserRepository(client *generated.UserClient, userFields *UserFieldRepository) *UserRepository
NewUserRepository - the user repository on client; userFields (nil - none) holds the users' profile field values, deleted with a user.
func (UserRepository) BumpSessionVersion ¶
BumpSessionVersion - see entity.UserRepository.BumpSessionVersion.
func (UserRepository) ByID ¶
ByID - the user id with its role; outside a transaction, once per request (entity.WithUserMemo).
func (UserRepository) BySlug ¶
BySlug - the user with slug, with the role; ErrEntityNotFound if there is none.
func (UserRepository) ConfirmEmail ¶
func (r UserRepository) ConfirmEmail(ctx context.Context, userID int) error
ConfirmEmail - see entity.UserRepository.ConfirmEmail.
func (UserRepository) CountWithStatus ¶
CountWithStatus - see entity.UserRepository.CountWithStatus.
func (UserRepository) Create ¶
Create adds the user (an empty e-mail address is stored as none) and returns it with its ID.
func (UserRepository) Delete ¶
func (r UserRepository) Delete(ctx context.Context, id int) error
Delete deletes the user with id and the user's profile field values, in one transaction (no key ties the values to the user: a failure between the two would leave them behind).
func (UserRepository) Find ¶
func (r UserRepository) Find(ctx context.Context, filter entity.UserFilter) (*entity.User, error)
Find loads the user with filter.Email (emails are unique, stored in lower case).
func (UserRepository) FindByEmailOrUsername ¶
func (r UserRepository) FindByEmailOrUsername(ctx context.Context, identity string) (*entity.User, error)
FindByEmailOrUsername - see entity.UserRepository.FindByEmailOrUsername; an exact match first, apperrors.ErrNotFound if none matches.
func (UserRepository) FindByUsername ¶
FindByUsername - the user named username, with the role; ErrEntityNotFound if there is none.
func (UserRepository) ListForAdmin ¶
func (r UserRepository) ListForAdmin(ctx context.Context, page int, perPage int, opts entity.AdminPeopleListOpts) (*entity.Users, int, int, error)
ListForAdmin - see entity.UserRepository.ListForAdmin.
func (UserRepository) SearchActiveByName ¶
func (r UserRepository) SearchActiveByName(ctx context.Context, query string, roles []int, limit int) (*entity.Users, error)
SearchActiveByName - see entity.UserRepository.SearchActiveByName; by name, at most limit (0 - 10).
func (UserRepository) SessionStateByID ¶
SessionStateByID - see entity.UserRepository.SessionStateByID.
func (UserRepository) TouchAccessedAtIfStale ¶
func (r UserRepository) TouchAccessedAtIfStale(ctx context.Context, userID int, minInterval time.Duration) error
TouchAccessedAtIfStale - see entity.UserRepository.TouchAccessedAtIfStale.
func (UserRepository) Update ¶
Update saves ct's name, slug, password hash, timezone, signature, status, e-mail address and its confirmation, role and avatar (as AvatarUpdateHint says) over the user ct.ID and returns ct as given.
func (UserRepository) UsersWithRoles ¶
UsersWithRoles - the active users whose role is one of roleIDs, by id (who to tell about what a role does: a module's e-mail to a role).
type ViewRepository ¶
type ViewRepository struct {
// contains filtered or unexported fields
}
ViewRepository is the ent adapter for entity.ViewRepository: View metadata CRUD here, query execution in view_query.go (filters in view_filters.go, sorting in view_sort.go).
func NewViewRepository ¶
func NewViewRepository(client *generated.Client) *ViewRepository
NewViewRepository - the View repository on client.
func (ViewRepository) AttachmentDisplays ¶
func (r ViewRepository) AttachmentDisplays(ctx context.Context) (entity.ViewDisplayDefs, error)
AttachmentDisplays returns every enabled, non-Default attachment display, ordered by AttachWeight (then id); node pages filter them by content type.
func (ViewRepository) CreateFilter ¶
func (r ViewRepository) CreateFilter(ctx context.Context, f entity.ViewFilterDef) (*entity.ViewFilterDef, error)
CreateFilter adds the filter f and returns it with its ID.
func (ViewRepository) CreateSort ¶
func (r ViewRepository) CreateSort(ctx context.Context, s entity.ViewSortDef) (*entity.ViewSortDef, error)
CreateSort adds the sort criterion s and returns it with its ID.
func (ViewRepository) CreateView ¶
func (r ViewRepository) CreateView(ctx context.Context, v entity.ViewDisplayDef) (*entity.ViewDisplayDef, error)
CreateView adds the display v (an empty URLPath stored as none) and returns it with its ID.
func (ViewRepository) CreateViewContainer ¶
func (r ViewRepository) CreateViewContainer(ctx context.Context, v entity.View) (*entity.View, error)
CreateViewContainer is called only from views.DefaultService.CloneDisplay (see entity.ViewRepository.CreateViewContainer).
func (ViewRepository) CreateViewField ¶
func (r ViewRepository) CreateViewField(ctx context.Context, f entity.ViewFieldDef) (*entity.ViewFieldDef, error)
CreateViewField adds the View field f and returns it with its ID.
func (ViewRepository) DefaultDisplayOfView ¶
func (r ViewRepository) DefaultDisplayOfView(ctx context.Context, viewID int) (*entity.ViewDisplayDef, error)
DefaultDisplayOfView - see entity.ViewRepository.DefaultDisplayOfView.
func (ViewRepository) DeleteFilter ¶
func (r ViewRepository) DeleteFilter(ctx context.Context, id int) error
DeleteFilter deletes the filter with id; ErrEntityNotFound if there is none.
func (ViewRepository) DeleteSort ¶
func (r ViewRepository) DeleteSort(ctx context.Context, id int) error
DeleteSort deletes the sort criterion with id; ErrEntityNotFound if there is none.
func (ViewRepository) DeleteView ¶
func (r ViewRepository) DeleteView(ctx context.Context, id int) error
DeleteView deletes the display with id, its filters, sorts and fields with it; ErrEntityNotFound if there is none.
func (ViewRepository) DeleteViewContainer ¶
func (r ViewRepository) DeleteViewContainer(ctx context.Context, id int) error
DeleteViewContainer deletes the View row by id; ON DELETE CASCADE removes its view_displays rows and, in turn, their filters, sorts and fields.
func (ViewRepository) DeleteViewField ¶
func (r ViewRepository) DeleteViewField(ctx context.Context, id int) error
DeleteViewField deletes the View field with id; ErrEntityNotFound if there is none.
func (ViewRepository) DisplaysOfView ¶
func (r ViewRepository) DisplaysOfView(ctx context.Context, viewID int) (entity.ViewDisplayDefs, error)
DisplaysOfView - see entity.ViewRepository.DisplaysOfView; by creation time.
func (ViewRepository) FieldsByViewID ¶
func (r ViewRepository) FieldsByViewID(ctx context.Context, viewID int) (entity.ViewFieldDefs, error)
FieldsByViewID - the fields of the display viewID, by sort order, then ID.
func (ViewRepository) FilterByID ¶
func (r ViewRepository) FilterByID(ctx context.Context, id int) (*entity.ViewFilterDef, error)
FilterByID - the filter with id; ErrEntityNotFound if there is none.
func (ViewRepository) FiltersByViewID ¶
func (r ViewRepository) FiltersByViewID(ctx context.Context, viewID int) (entity.ViewFilterDefs, error)
FiltersByViewID - the filters of the display viewID, by sort order, then ID.
func (ViewRepository) PageDisplaysWithArgument ¶
func (r ViewRepository) PageDisplaysWithArgument(ctx context.Context) (entity.ViewDisplayDefs, error)
PageDisplaysWithArgument - see entity.ViewRepository.
func (ViewRepository) PublicPageViews ¶
func (r ViewRepository) PublicPageViews(ctx context.Context) (entity.ViewDisplayDefs, error)
PublicPageViews - every non-Default page display across all Views, enabled or not (the callers check Status).
func (ViewRepository) SetPublishedSnapshot ¶
func (r ViewRepository) SetPublishedSnapshot(ctx context.Context, id int, snapshot string, publishedAt time.Time) (*entity.ViewDisplayDef, error)
SetPublishedSnapshot is called only from views.DefaultService.PublishDisplay.
func (ViewRepository) SetViewContainerMachineName ¶
func (r ViewRepository) SetViewContainerMachineName(ctx context.Context, id int, machineName string) (*entity.View, error)
SetViewContainerMachineName is called only from views.DefaultService's create-then-rename sequence right after CreateViewContainer.
func (ViewRepository) SetViewMachineName ¶
func (r ViewRepository) SetViewMachineName(ctx context.Context, id int, machineName string) (*entity.ViewDisplayDef, error)
SetViewMachineName is called only from views.DefaultService's create-then-rename sequence right after CreateView.
func (ViewRepository) SortByID ¶
func (r ViewRepository) SortByID(ctx context.Context, id int) (*entity.ViewSortDef, error)
SortByID - the sort criterion with id; ErrEntityNotFound if there is none.
func (ViewRepository) SortsByViewID ¶
func (r ViewRepository) SortsByViewID(ctx context.Context, viewID int) (entity.ViewSortDefs, error)
SortsByViewID - the sort criteria of the display viewID, by sort order, then ID.
func (ViewRepository) TermDisplays ¶
func (r ViewRepository) TermDisplays(ctx context.Context) (entity.ViewDisplayDefs, error)
TermDisplays returns every enabled, non-Default term display, ordered by AttachWeight (then id); term pages filter them by vocabulary.
func (ViewRepository) UpdateFilter ¶
func (r ViewRepository) UpdateFilter(ctx context.Context, f entity.ViewFilterDef) (*entity.ViewFilterDef, error)
UpdateFilter saves f over the filter f.ID (its display stays) and returns it; ErrEntityNotFound if there is none.
func (ViewRepository) UpdateSort ¶
func (r ViewRepository) UpdateSort(ctx context.Context, s entity.ViewSortDef) (*entity.ViewSortDef, error)
UpdateSort never touches FieldStorageID/BuiltinField: a criterion's target is immutable once created; Params are replaced.
func (ViewRepository) UpdateView ¶
func (r ViewRepository) UpdateView(ctx context.Context, v entity.ViewDisplayDef) (*entity.ViewDisplayDef, error)
UpdateView never touches machine_name (see SetViewMachineName), base_entity (immutable after creation) or published_snapshot/ published_at (see SetPublishedSnapshot), so a caller passing a plain entity.ViewDisplayDef can't accidentally wipe them.
func (ViewRepository) UpdateViewField ¶
func (r ViewRepository) UpdateViewField(ctx context.Context, f entity.ViewFieldDef) (*entity.ViewFieldDef, error)
UpdateViewField never touches FieldStorageID/BuiltinField: a field's target is immutable once created.
func (ViewRepository) UserTabDisplays ¶
func (r ViewRepository) UserTabDisplays(ctx context.Context) (entity.ViewDisplayDefs, error)
UserTabDisplays returns every enabled, non-Default user_tab display, ordered by AttachWeight (then id): the user profile's View tabs.
func (ViewRepository) ViewByID ¶
func (r ViewRepository) ViewByID(ctx context.Context, id int) (*entity.ViewDisplayDef, error)
ViewByID - the display with id; ErrEntityNotFound if there is none.
func (ViewRepository) ViewByMachineName ¶
func (r ViewRepository) ViewByMachineName(ctx context.Context, machineName string) (*entity.ViewDisplayDef, error)
ViewByMachineName - the display named machineName; ErrEntityNotFound if there is none.
func (ViewRepository) ViewByURLPath ¶
func (r ViewRepository) ViewByURLPath(ctx context.Context, urlPath string) (*entity.ViewDisplayDef, error)
ViewByURLPath excludes Default displays as defense in depth: their url_path is a placeholder that must never resolve as a page (see entity.ViewDisplayDef.IsDefault).
func (ViewRepository) ViewByURLPathAny ¶
func (r ViewRepository) ViewByURLPathAny(ctx context.Context, urlPath string) (*entity.ViewDisplayDef, error)
ViewByURLPathAny - see entity.ViewRepository.ViewByURLPathAny.
func (ViewRepository) ViewContainerByID ¶
ViewContainerByID - see entity.ViewRepository.ViewContainerByID.
func (ViewRepository) ViewFieldByID ¶
func (r ViewRepository) ViewFieldByID(ctx context.Context, id int) (*entity.ViewFieldDef, error)
ViewFieldByID - the View field with id; ErrEntityNotFound if there is none.
func (ViewRepository) Views ¶
func (r ViewRepository) Views(ctx context.Context) (entity.ViewDisplayDefs, error)
Views returns the admin views list: one row per View, not per display. An ungrouped display shows as itself; a grouped View is represented by its Default display, which always exists and so keeps a stable identity as other displays are added or deleted. Sibling displays are reachable via the tab strip in the edit page.
Source Files
¶
- account_settings.go
- block.go
- blocked_bot.go
- blocked_ip.go
- breadcrumb_rule.go
- captcha_settings.go
- comment.go
- comment_settings.go
- content_changes.go
- content_type.go
- dashboard.go
- date_format.go
- dynamic_content.go
- dynamic_content_blocks.go
- ent_client.go
- entity_rows.go
- field_cardinality.go
- field_def.go
- field_store_block.go
- field_store_date.go
- field_store_file.go
- field_store_link.go
- field_store_list.go
- field_store_number.go
- field_store_reference.go
- field_store_taxonomy.go
- field_store_text.go
- field_store_user.go
- field_stores.go
- field_value_tables.go
- field_values.go
- field_values_batch.go
- file.go
- image_style.go
- image_style_adapter.go
- integration_settings.go
- interface_packs.go
- interface_strings.go
- list_filter.go
- mail_log.go
- mail_settings.go
- mail_template.go
- maintenance.go
- media.go
- menu.go
- module.go
- module_tables.go
- module_uninstall.go
- node.go
- node_counter.go
- node_delete.go
- node_revision.go
- node_row.go
- node_schedule.go
- oauth_settings.go
- preview_link.go
- redirect.go
- role.go
- search.go
- search_config.go
- search_index.go
- search_snippets.go
- secrets.go
- seo.go
- site_information.go
- statistics_settings.go
- taxonomy.go
- text_format.go
- theme_settings.go
- two_factor.go
- uow.go
- upload_settings.go
- user.go
- user_auth_token.go
- user_content.go
- user_field.go
- user_file_usage.go
- user_oauth_identity.go
- view.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package viewquery runs Views on the ent schema (entity.ViewQuery): a display's filters, sorts and pager over nodes or comments, its glossary bar and the "similar content" ranking.
|
Package viewquery runs Views on the ent schema (entity.ViewQuery): a display's filters, sorts and pager over nodes or comments, its glossary bar and the "similar content" ranking. |