query

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDateCriterion added in v0.7.4

func ApplyDateCriterion(query sq.SelectBuilder, field string, criterion *models.DateCriterionInput) sq.SelectBuilder

ApplyDateCriterion applies date criterion (equals, not equals, greater than, less than, is null, not null) Returns the modified query

func ApplyIntCriterion

func ApplyIntCriterion(query sq.SelectBuilder, field string, criterion *models.IntCriterionInput) sq.SelectBuilder

ApplyIntCriterion applies integer criterion (equals, not equals, greater than, less than, is null, not null) Returns the modified query

func ApplyMultiIDCriterion

func ApplyMultiIDCriterion(query *sq.SelectBuilder, tableName, joinTable, fkColumn, joinField string, criterion *models.MultiIDCriterionInput) error

ApplyMultiIDCriterion applies multi-ID criterion (includes/includes_all/excludes) Modifies the query pointer in place tableName: the main table name (e.g., "scenes") joinTable: the join table name (e.g., "scene_performers") fkColumn: the foreign key column in the join table referencing the main table (e.g., "scene_id") joinField: the field in the join table to filter on (e.g., "performer_id")

func ApplyPagination

func ApplyPagination(query sq.SelectBuilder, page, perPage int) sq.SelectBuilder

ApplyPagination applies pagination to a query with default values

func ApplySortParams

func ApplySortParams(query sq.SelectBuilder, tablePrefix string, sort, direction fmt.Stringer, defaultField, defaultDir string) sq.SelectBuilder

ApplySortParams applies sorting to query with optional table prefix If tablePrefix is empty, no prefix is added to the field name

func ApplyStringCriterion

func ApplyStringCriterion(query sq.SelectBuilder, field string, criterion *models.StringCriterionInput) sq.SelectBuilder

ApplyStringCriterion applies string criterion (equals, not equals, is null, not null) Returns the modified query

func ExecuteCount

func ExecuteCount(ctx context.Context, query sq.SelectBuilder, db queries.DBTX, queryName string) (int, error)

ExecuteCount executes a count query and returns the result as an int If queryName is provided, it prepends a sqlc-style comment for better span naming in traces

func ExecuteQuery

func ExecuteQuery[T any, M any](ctx context.Context, query sq.SelectBuilder, db queries.DBTX, converter func(T) M, queryName string) ([]M, error)

ExecuteQuery executes a squirrel query and converts results using a generic converter function If queryName is provided, it prepends a sqlc-style comment for better span naming in traces

Types

This section is empty.

Jump to

Keyboard shortcuts

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