viewquery

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine implements entity.ViewQuery.

func New

func New(client *generated.Client) *Engine

New creates an Engine; a query inside a unit of work runs in its transaction (database.GetClient).

func (*Engine) GlossaryForView

func (e *Engine) GlossaryForView(ctx context.Context, filters entity.ViewFilterDefs, moduleFilters []entity.ViewRunModuleFilter, fieldStorages map[int]entity.FieldStorageDef, glossaryFieldStorageID *int, queryParams map[string]string) (entity.GlossaryData, error)

GlossaryForView implements entity.ViewQuery.GlossaryForView. A nil glossaryFieldStorageID groups by Node.Title, otherwise by that generic text field's value.

func (*Engine) RunCommentView

func (e *Engine) RunCommentView(ctx context.Context, params entity.ViewRunParams) (entity.Comments, int, error)

RunCommentView implements entity.ViewQuery.RunCommentView. Comments have no generic fields, so there is no field_value_* intersection and sorting is always a single builtin criterion (plain SQL ORDER BY + LIMIT/OFFSET). Only the comments on public content (database.CommentOnPublicNode). Eager-loads Node (id/title/slug) and Author.

func (*Engine) RunView

func (e *Engine) RunView(ctx context.Context, params entity.ViewRunParams) (entity.Nodes, int, error)

RunView implements entity.ViewQuery.RunView. Filters are AND-combined: built-in fields go straight into the Node WHERE, generic fields first resolve to a node ID set via their field_value_* table and are intersected. Results are then sorted and paginated.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL