Help us shape the future of Go! Take the 2026 Go Developer Survey

expr

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 17 Imported by: 0

README

Scoped expressions

Choose the adapter matching the declared column family. For a text column, use expr.Value(orm.TextExpr(column)) for a model scope and expr.At(rows.Scope(alias), orm.TextExpr(column)) for an alias. Expression[S,V,P] distinguishes the present comparison value V from the projected value P, including value.Nullable[V].

RowValue[S,V] accepts stored and computed row values. Selected[S,V] accepts selected results and cannot enter row predicates or row arithmetic. Promote row values with expr.AsSelected(row). Use rows.MapSelected to select an aggregate or a computed result into a declared row field. rows.Map retains its existing column-expression signature.

age := expr.Value(orm.NumberExpr(Users.Age))
q := expr.Where(Users.Query(), expr.Gt(expr.Add(age, expr.Param(orm.NumberExpr(Users.Age), 2)), 18))
q = expr.OrderBy(q, expr.Asc(expr.Negate(age)))

Arithmetic preserves the concrete numeric type. Integer division truncates toward zero; database overflow and division-by-zero remain errors. Remainder excludes floating-point inputs. DecimalOf accepts exact integers/decimals and returns decimal.Decimal; FloatOf explicitly returns approximate float64.

Nullable arithmetic requires nullable operands: explicitly widen required values with NullableRow. Nullable calculations keep one nullable result layer; their literal comparisons take present values. Bound parameters use a column's existing codec and are captured when constructed; zero, false and empty values remain supplied values. Param on a nullable column takes the present value; expr.ParamOf(expr.NullableRow(v), value.Null[T]()) constructs an explicitly typed SQL NULL. Computed/selected ParamOf functions take their exact result type.

Equal, ordered comparisons, Like, DistinctFrom and their selected *Value counterparts compare expressions with the same owner and concrete type. Selected comparisons return HavingPredicate, never a row predicate. OrderRow and OrderValue expose literal range comparisons only on ordered types. Stored enum handles do not satisfy GreaterColumn's ordered-column capability.

expr.Count[S]() counts rows, including NULL fields, returning required int64 with zero for empty input. Exists[S]() returns required bool, false for empty input, and exposes no range comparisons. Both use the existing aggregate compiler and preserve the source query's scopes, executor and transaction.

Text, temporal, interval, geographic and JSON functions share these row/selected phases. See the expression guides.

Row and selected phases have different private marker fields, so explicit Go conversions cannot move selected aggregates or HAVING conditions into row WHERE. Internal bridges validate family-specific pointer-backed capabilities; a zero value synthesized through generic inference is rejected before metadata is exposed or applied. The framework passes issued capabilities only to verified concrete owners, so application wrappers cannot capture one through an inferred method signature. Reference-free parameters retain their construction scope and declaration owner. An invalid exemplar stays invalid through ParamOf, including scoped ownership errors. The ownership core merges references as a bounded, stable, deduplicated set, so reusing a calculation does not multiply its retained references.

Use Coalesce(nullable, requiredFallback) to remove one nullable layer. Zero and empty values remain supplied values. CoalesceNullable accepts only nullable inputs and retains one layer. NullIf(a, b) requires matching required inputs and adds one nullable layer; use NullIfNullable for inputs already nullable. The *Value variants accept Selected values and retain the selected phase.

nickname := expr.Value(orm.NullableTextExpr(Users.Nickname))
email := expr.Value(orm.TextExpr(Users.Email))
label := expr.When(expr.IsNull(nickname), email).
    When(expr.Eq(email, ""), expr.Param(orm.TextExpr(Users.Email), "anonymous")).
    Else(expr.Coalesce(nickname, email))

When returns unfinished Case[S,V]. Append matching branches with When, then finish with Else or ElseNull before selecting or comparing it. Else preserves the exact branch type, including nullability. ElseNull adds one nullable layer to required branches; nullable branches need a nullable Else instead. Each branch addition leaves existing CASE values unchanged.

WhenValue returns unfinished ValueCase[S,V], takes HavingPredicate[S] and selected branch values, and finishes as Selected. For example: expr.WhenValue(expr.GtValue(count, 0), expr.AsSelected(count)).Else(expr.AsSelected(expr.ParamOf(count, 0))). Grouped explicitly lifts a row predicate for selected CASE; the shared compiler still requires its columns to be grouped when aggregates are present. Group keys and query HAVING entry points are supplied by rows.GroupBy and rows.Having. All branches and fallbacks retain source ownership, codecs and errors through subsequent composition/ParamOf.

Use Sum/Avg for exact stored numbers: their result is value.Nullable[decimal.Decimal], including integer inputs. SumFloat/AvgFloat return value.Nullable[float64]; SumInterval/AvgInterval preserve temporal.Interval. Min/Max accept ordered stored fields, preserve the field's present type and return one nullable layer. Empty or all-NULL input returns NULL for all these summaries. Ordered field capabilities are sealed: adding a Gt method to an enum wrapper does not make it eligible for summaries or extrema. Ordered input handles have the same aggregate capabilities as their stored kinds: number, time and interval handles, including nullable forms, retain their stored types; text input handles support Min/Max. Aggregates never invoke write transforms. InputEnum, InputJSON, InputColumn and InputBytes remain outside the ordered capability. The private framework marker cannot be supplied by an external method with the same name. expr.ParamOf(aggregate, v) accepts a present value and returns a required row expression, for example expr.CoalesceValue(expr.AsSelected(total), expr.AsSelected(expr.ParamOf(total, decimal.FromInt64(0)))). It preserves the result codec, scope and existing errors. CountField and CountDistinctField skip NULLs and return required int64, zero on empty input. expr.Count includes NULL rows; Exists returns false on empty input. There is no general aggregate DISTINCT operation.

Each field aggregate also has an At constructor, such as expr.SumAt(rows.Scope(alias), Orders.TotalCents), retaining stored-field capabilities and the alias's input scope. expr.Filter(aggregate, exprPredicate...) appends same-scope row conditions with AND for that aggregate only; it retains empty-input semantics. Query WHERE filters every aggregate; HAVING filters completed groups. AggregateExpression[S,V] is the sealed reusable descriptor for relation aggregate slots and ad-hoc values: it retains native aggregate metadata, complete ownership and the typed result codec/scanner. Selected calculations do not implement this interface.

buyer := expr.Value(orm.ColumnExpr(Orders.BuyerID))
total := expr.Sum(orm.NumberExpr(Orders.TotalCents))
q := rows.Select(rows.FromModel(Orders.Query()), Totals,
    rows.Map(Totals.Buyer, buyer), rows.MapSelected(Totals.Amount, expr.AsSelected(total)))
q = rows.GroupBy(q, expr.Group(buyer))
q = rows.Having(q, expr.GtValue(total, decimal.FromInt64(100)))
q = rows.OrderBy(q, expr.DescValue(total), expr.Asc(buyer))

rows.FromModel exposes complete models through the read-only rows boundary and can also supply a projection source. Existing model/row codecs and scopes remain applied. Eager relation requests must be collected explicitly. Row keys use expr.Group(rowValue). Selected keys use expr.Key(selected); these types and selected ordering cannot convert to row keys or model ordering. HavingAnd, HavingOr and expr.HavingNot retain group scope. The compiler rejects ungrouped selected columns, nested aggregates, aggregates in row conditions and invalid group keys.

rows.Distinct(q) removes duplicate complete results. rows.DistinctOn(q, rowKeys...) and rows.DistinctOnValues(q, selectedKeys...) select one result per key combination. Order by the DISTINCT ON keys first, then precedence and a unique tie breaker; without ordering the chosen row is unspecified. These operations replace earlier DISTINCT clauses, preserve result types and remain read-only. PostgreSQL grouping and DISTINCT/order validation still apply. rows.OrderBy accepts row and selected orders, including aggregate results. Use the composition APIs for subqueries and the window functions in this package for typed partitions, ordering and frames.

Relation slots reuse these descriptors through Related(source, computation). Bind the result with Users.OrdersCount.Using(...), then load it through the existing ORM relation APIs. orm.Pivot(relation) selects a joined relation's concrete pivot input. See the typed aggregate slot recipe for ownership, nullability and statement-count contracts.

Raw fragments and project policy

expr.Raw[S,V](sql, args...) produces a selected value. Built-in codecs cover primitive scalars, exact decimals, temporal values, intervals, bytes, model IDs, and nullable forms of the concrete built-in scalar types. Use expr.RawWithCodec[S](codec, sql, args...) for custom results, named nullable values, JSON, or another explicit representation. The caller declares the result type; PostgreSQL checks the SQL's meaning, and the codec validates decoded values. Raw selected values cannot become row predicates or GROUP BY keys.

orm.WhereRaw[M](sql, args...) produces a model predicate for Query.Where and orm.And/orm.Or/orm.Not. Both fragment forms preserve the surrounding query's soft-delete/global scopes, executor and transaction. Names inside SQL are opaque: write the correct table alias yourself. Raw SQL is not automatically requalified.

Use ? for each argument and ?? for a literal question mark (including PostgreSQL JSON operators). The lexer leaves quoted strings/identifiers, dollar quotes and comments untouched; it handles escaped E'...' strings, newline string continuations retaining escape mode, and nested block comments. Ordinary non-E strings containing a backslash are rejected because their interpretation depends on standard_conforming_strings; use an E'...' string or a bound parameter. It rejects numbered/named placeholders, count mismatches, unterminated regions, unbalanced parentheses, NUL bytes and statement separators. Arguments use the standard SQL driver conversion contract and are snapshotted once, including byte buffers. Bindings join the compiler's statement-wide numbering. SQL grammar, identifier existence, SQL types and aggregate semantics remain database checks.

Statements that render a raw fragment are opaque to the N+1 detector: diagnostics contain a keyed fingerprint, never a trusted SQL shape or the fragment text.

Projects can enforce D11 in CI with the existing Foundry CLI:

foundry lint --no-raw ./...

This dependency-free tool is a best-effort source-policy check, not a runtime proof. It loads selected Go packages and their tests with the current build environment. It diagnoses calls to executor Exec/Query/QueryRead/ScanOne, database.ReadQuery/ForEach, orm.Raw, rows.Raw, expr.Raw/RawWithCodec, and orm.WhereRaw. Direct calls resolve framework symbols through generic instantiation and promoted methods. Calls inside framework packages are excluded.

Calls through function values use their complete static signature, including results. A variable, field, parameter or expression such as *(&f) is flagged when its signature is identical to a raw entry point's method-value or function signature, including generic instantiations. Callable type parameters are checked using the function signature fixed by their constraint, including ~func(...), embedded constraints and unions of function types with the same signature. This rule is independent of assignment order and does not track bindings: even an application implementation with the same signature is flagged when called through a value. Direct named application functions still require a framework symbol match. Captures and transfers without calls produce no diagnostic; ordinary typed ORM usage remains allowed.

Interface and type-parameter methods named like raw executor methods are checked against the instantiated constraint's parameter shape, regardless of result type. This includes Runner[R] with Query(context.Context, string, ...any) (R, error) and restated Raw(context.Context, database.Executor, string, ...any) methods. A captured function value with an unresolved generic result type need not match a framework signature; the direct interface method call still matches its parameter contract. Diagnostics contain only file:line. Real package paths ending in .test are checked; only Go-generated test mains are excluded.

Any finding or package loading/type-checking error fails the command. Diagnostics omit SQL and arguments. Dependencies outside the selected patterns are loaded for type information, not linted; select project packages deliberately. Build tags and platforms follow go list, so run the command in each CI build configuration you support. Reflection and raw calls hidden behind unselected dependency code are outside this source policy. Function-value calls whose generic constraints leave the result signature unresolved can remain undiagnosed; this check does not specialize application generic bodies at every instantiation or trace wrappers. Conversely, same-signature application function values are flagged even when their implementations perform no SQL. No suppression comments or automatic edits are used.

Window functions return selected values and compose with rows.MapSelected. Construct a window from an existing scope; it does not copy the source query's ordering, pagination or rows:

amount := expr.Value(orm.NumberExpr(Orders.TotalCents))
w := expr.WindowFor(rows.ModelScope(Orders.Query())).
    PartitionBy(expr.Group(expr.Value(orm.ColumnExpr(Orders.BuyerID)))).
    OrderBy(expr.Asc(amount)).
    RowsBetween(expr.UnboundedPreceding(), expr.CurrentRow())

q := rows.Select(rows.FromModel(Orders.Query()), ReportRows,
    rows.MapSelected(ReportRows.Rank, expr.RowNumber(w)),
    rows.MapSelected(ReportRows.Total, expr.Over(expr.Sum(orm.NumberExpr(Orders.TotalCents)), w)),
    rows.MapSelected(ReportRows.Previous, expr.Lag(expr.AsSelected(amount), 1, w)),
)

RowNumber, Rank and DenseRank return int64; PercentRank and CumeDist return float64; NTile returns int32. Lag, Lead, FirstValue, LastValue and NthValue add one nullable layer because the requested row/frame may be empty. Their nullable variants retain exactly one layer. LagOr/LeadOr retain the input type and capture a fallback once; an existing row containing SQL NULL still returns NULL. Offsets, bucket counts and fallbacks are bound parameters.

expr.Over(aggregate, w) retains the aggregate's codec and empty-frame rules: count returns zero, sum/avg/min/max remain nullable. Apply Filter before Over. PostgreSQL rejects COUNT DISTINCT windows. Windows cannot enter WHERE, row CASE, GROUP BY or HAVING; nested window evaluation at the same SELECT level is invalid. Ordinary aggregate results can supply window inputs, selected partition keys and ordering when the surrounding grouping is valid.

PartitionBy takes row GroupKeys; PartitionByValues takes selected ProjectionKeys. OrderBy accepts row and selected expression orders. Use expr.Asc(expr.Value(orm.TextExpr(column))) for a column order. Final result ordering is separate. Named windows (w.Named("by_buyer")) emit each referenced definition once. PostgreSQL's inheritance rules apply: extending a framed definition, replacing its order or adding a partition fails compilation. Derivation is immutable.

RowsBetween and GroupsBetween accept current/unbounded positions and Preceding(int64)/Following(int64) offsets. RangeBetween accepts only current/unbounded positions. For value distances, build r := expr.NumericRange(w, expr.AsSelected(amount)) and then r.Between(r.Preceding(int64(10)), r.CurrentRow()). Numeric distances retain the order value's exact type. TemporalRange takes temporal.Interval distances; nullable range constructors still require present distances. The range builder establishes exactly one order; preexisting ordering is an error. Negative and non-finite distances, invalid boundary ordering and calendar distances for a clock value fail compilation. Frame exclusions support current row, group, ties and none. A zero Window[S] means OVER (); zero frame/range descriptors are invalid.

These package functions reuse the shared window compiler and existing ownership checks. They add no Query, Table, column or aggregate methods. Scopes and the supplied executor/transaction remain those of the surrounding read. Window results enter wire contracts only through explicitly declared row/DTO fields; this adds no manifest, OpenAPI or TypeScript schema source.

Text, temporal, interval and geographic calculations

Scalar functions use the same SQL compiler and codecs as the shared internal/querycore compiler. Pass expr.Value(orm.TextExpr(column)) (or expr.At(scope, orm.TextExpr(column))) to row functions; promote with expr.AsSelected for rows.MapSelected. The Value suffixed variants accept selected values, including aggregates and windows. They never become WHERE predicates. Use expr.TextValue or expr.TextNullableValue for selected text conditions in rows.Having.

name := expr.Lower(expr.Trim(expr.Value(orm.TextExpr(Users.Email))))
filtered := expr.Where(Users.Query(), expr.TextIContains(name, "example_"))
// Contains/IContains/StartsWith/EndsWith treat wildcards literally;
// Like/ILike accept SQL patterns. Collation belongs to the database.

Text functions include casing, trimming (including character sets), Unicode and byte lengths, strict concatenation, NULL-skipping ConcatWS, replacement and one-based substring positions. SubstringAt requires same-owner integer expressions; literal negative counts fail before execution. Named string inputs produce ordinary strings; nullable variants retain NULL except ConcatWS.

Calendar extraction accepts dates/local timestamps, clock extraction accepts wall times/local timestamps, and epoch functions accept instants. Second, Milliseconds, JulianDay and UnixSeconds return exact decimals; FromUnixMillis requires integers. DateUnit and TimestampUnit are distinct. Select an explicit LoadTimeZone/UTCZone for instant/calendar conversions; ResolveLocal also requires PostgresStandardTime for DST gaps/overlaps.

AddDateInterval returns a local timestamp, while AddDateDays retains a date. Interval calculations preserve months, days and elapsed time separately; ShiftDate, ShiftLocal and ShiftInstant accept interval expressions. IntervalElapsed returns time.Duration; clock shifts require whole microseconds. A calendar day across DST may differ from 24 elapsed hours. TransactionTime(rows.ModelScope(q)) uses the surrounding transaction's start instant and retains that source's ownership. Database overflow remains an error.

NewGeographicPoint validates finite latitude/longitude in degrees. SphericalDistance returns approximate metres on the IUGG mean-radius sphere; it is a surface distance, not a route. Nullable coordinates propagate NULL. Stored coordinates remain the application's responsibility.

These functions add no Query/Table/column methods, bypass no surrounding scopes, and use the supplied executor or transaction. Results affect manifests, OpenAPI and TypeScript only through explicitly declared projection/DTO field codecs. JSON paths and JSON Kind/Length remain in the next slice.

Handwritten JSON paths

JSON paths are ordinary typed declarations beside the model columns. They do not use generated Properties or At accessors:

var Theme = expr.JSONFieldOf(func(p *Preferences) *value.Optional[string] {
    return &p.Theme
})
// During application startup, check Theme.Validate() along with orm.Check tables.

root := expr.JSONRoot(expr.Value(orm.JSONExpr(Documents.Settings)))
path := expr.JSONOptional(expr.JSONProperty(root, Theme))
theme := expr.JSONTextScalar(path, codec.String[string]())
q := expr.Where(Documents.Query(), expr.Eq(theme, "dark"))

JSONFieldOf runs its selector once against a fresh payload and resolves the field's JSON tag with the runtime's existing tag/promotion rules. It rejects ignored, ambiguous, foreign and zero-sized fields, and opaque custom JSON/text encodings. Selectors address fields in that payload, including fields promoted through embedded values; they must not dereference nil embedded pointers. Name and ,string metadata are captured, and the selector is discarded. A failed or zero declaration also fails closed if used without the startup check.

JSONMapKey(path, key) retains the map's exact key type and uses its canonical JSON key codec. String keys are accepted only on string-keyed maps. JSONIndex(path, int32Index) retains a slice's element type; negative indices count from the end. Fixed arrays use JSONFixedArrayOf(func(a *[3]T) *T { return &a[0] }) at startup, then JSONArrayElement(path, declaration, index). Byte slices and custom-encoded collections cannot be traversed as arrays/maps. Declared property names are escaped SQL literals for expression indexes; runtime keys and indices use the statement's normal bind parameters.

JSONOptional, JSONNullable, JSONPointer and JSONDocument explicitly unwrap payload wrappers for traversal. expr.JSONScalar and expr.JSONTextScalar require a codec for the exact resulting payload type. They cannot change the payload type. Compose expr.OrderNullableRow(expr.JSONScalar(...)) for ordered payload comparisons. All path predicates retain the original query owner.

Operation Missing path or SQL-null ancestor Present JSON null
JSON() SQL NULL Present JSON value, if its payload permits null
expr.JSONTypeNullable(path.JSON()) SQL NULL database.JSONNull
expr.IsNotNull(path.JSON()) false true
expr.IsNull(path.JSON()) true false
expr.NullableEq(expr.JSONTypeNullable(path.JSON()), value.Of(database.JSONNull)) does not match true
scalar extraction SQL NULL SQL NULL
expr.JSONLengthNullable(path.JSON()) SQL NULL SQL NULL

Length is also SQL NULL for every non-array kind. Contains accepts a typed payload fragment and does not match a missing path. Whole-document calculations use JSONType, JSONLength, JSONContains and JSONContainedBy; Nullable variants propagate SQL NULL and Value variants preserve selected phase. Use rows.MapSelected for their results. Existing columns, queries and tables acquire no new methods. JSON calculations do not create implicit public DTO, manifest, OpenAPI or TypeScript schemas; those remain explicitly declared.

UUID seeks use UUIDLess, UUIDLessOrEqual, UUIDGreater and UUIDGreaterOrEqual on row expressions, for example expr.UUIDGreater(expr.At(scope, orm.KeyExpr(Files.Key())), after). The UUID's model owner and expression scope remain distinct types. Nullable row expressions use the Nullable variants and compare a present UUID. Ordering is PostgreSQL bytewise UUID ordering, not a guarantee about UUID generation time.

Projection filter adapters

ModelPredicate(orm.EnumEq(Users.State, Active)) retains model declaration ownership in a projection's row phase. Has(UserRelations.Orders, childPredicate) lifts expression predicates through the existing scoped relation EXISTS compiler. A child from another declaration fails validation even when its Go model type matches. The bound relation plan must also match both model types; a promoted target marker from another embedded relation cannot change them.

CompareRow(Value(Users.State)) supplies equality and membership without adding ordered or text operations to enums. CompareNullableRow retains present-value comparisons and adds null tests for nullable fields. Use OrderRow or OrderNullableRow for computed ordered values. Use TextRowValue or TextNullableRowValue for computed text row values, including correlated scalars. They preserve scope, codecs and NULL semantics without applying lower(). Stored text adapters take the column itself: TextRow(Users.Name) and TextNullableRow(Users.Nickname). Their orm.TextExpressionColumn input rejects direct non-text handles; Value erases that static capability and cannot be passed to these adapters. Both adapters validate the retrieved column's own text metadata before granting operations. Nested embedding cannot borrow a text marker from another handle: an invalid adapter retains its error through comparisons, ordering, selection and parameters. String-backed enums cannot acquire text or ordered comparisons through these adapters. Computed text functions already return text comparison handles. Present values remain the inputs for nullable comparisons. The compiler also rejects literal and expression LIKE predicates without a text capability, independently of the codec's string representation.

Or and Not accept only row predicates; HavingOr and expr.HavingNot retain the group phase. Report filters must reject mixed WHERE/HAVING OR/NOT. SQL NOT alone excludes unknown results: null-inclusive report negation uses expr.Or(expr.Not(expr.Eq(note, "Ada")), expr.IsNull(note)). Literal Contains/IContains escape wildcards, while Like deliberately accepts patterns. The datatable request policy continues to require explicit AllowLike and owns mixed-phase validation and null-inclusive negation; its API cutover is a separate slice.

For joined or aliased report columns, use TextRowAt(scope, column) or TextNullableRowAt(scope, column). They retain the column’s actual text capability and its validated scope; promoted markers cannot authorize an enum as text.

Expression filters on relations

Use expr.RelationFilter to adapt a row predicate to an existing relation's .Where method. The relation validates the target model and declaration owner; selected/HAVING predicates and predicates for a different target cannot be passed.

orders := UserRelations.Orders
orders = orders.Where(expr.RelationFilter(orders,
    expr.GreaterColumn(orm.NumberExpr(Orders.Total), orm.NumberExpr(Orders.Paid))))
users, err := orm.All(ctx, db, Users.Query().Where(orm.Has(orders)).With(orders))

The adapter retains correlated references and uses the same owner validation as expr.Has. It also permits JSON operators on a natural primary key through expr.Value(orm.KeyExpr(Policies.Key())), without binding the primary field a second time.

RelatedValue(source, computation) returns a row expression with the aggregate's exact nullability. Use existing OrderBy/Where adapters to rank and filter models, and rows.WithValue to read a complete model alongside the value. See the complete model and computed value recipe.

Computed relation ordering uses relation.OrderBy(expr.RelationOrder(relation, expr.Asc(expr.Negate(expr.Value(orm.NumberExpr(Orders.Total)))))). For pivot fields, use relation.OrderByPivot(expr.RelationPivotOrder(relation, order)). Both adapters validate the relation's actual source/target metadata and the field declaration; pivot ordering additionally validates the bound pivot. These row-phase adapters preserve NULL placement and binding order and reject selected/window orders.

Documentation

Overview

Package expr provides thin, typed SQL expressions in explicit source scopes. Example: expr.At(rows.Scope(members), orm.TextExpr(Members.Name)).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter added in v0.3.0

func Filter[S any, A FilterableAggregate[S, A]](a A, predicates ...Predicate[S]) A

Filter adds same-scope row predicates to one aggregate and retains its concrete result type.

Example: expr.Filter(expr.Count[User](), expr.Eq(age, 18))

func FoundryAggregate

func FoundryAggregate[S, V any](a AggregateExpression[S, V], seal sqlowner.ExpressionSeal) (ormcore.Expression, ormcore.Column[V])

FoundryAggregate supplies validated descriptor metadata and codec to relation loaders.

Example: expr.FoundryAggregate(a, seal)

func FoundryExpression

func FoundryExpression[S, V, P any](e Expression[S, V, P], seal sqlowner.ExpressionSeal) ormcore.Expression

FoundryExpression exposes sealed SQL metadata to rows.

Example: expr.FoundryExpression(e, seal)

func FoundryGroup

func FoundryGroup[S any](key GroupKey[S], seal sqlowner.ExpressionSeal) ormcore.Expression

FoundryGroup supplies validated row-key metadata to rows.

Example: expr.FoundryGroup(key, seal)

func FoundryHaving

func FoundryHaving[S any](p HavingPredicate[S], seal sqlowner.ExpressionSeal) ormcore.Predicate

FoundryHaving supplies validated group-condition metadata to rows.

Example: expr.FoundryHaving(p, seal)

func FoundryKey

func FoundryKey[S any](key ProjectionKey[S], seal sqlowner.ExpressionSeal) ormcore.Expression

FoundryKey supplies validated selected-key metadata to rows.

Example: expr.FoundryKey(key, seal)

func FoundryNullableScopeData

func FoundryNullableScopeData[S, M any](scope NullableScope[S, M], seal sqlowner.ExpressionSeal) ormcore.Scope

FoundryNullableScopeData exposes validated nullable metadata.

Example: expr.FoundryNullableScopeData(scope, seal)

func FoundryOrder

func FoundryOrder[S any](o Order[S], seal sqlowner.ExpressionSeal) ormcore.Order

FoundryOrder exposes sealed ordering to rows.

Example: expr.FoundryOrder(o, seal)

func FoundryPredicate

func FoundryPredicate[S any](p Predicate[S], seal sqlowner.ExpressionSeal) ormcore.Predicate

FoundryPredicate exposes a sealed condition to rows.

Example: expr.FoundryPredicate(p, seal)

func FoundryProjectionOrder

func FoundryProjectionOrder[S any](order ProjectionOrder[S], seal sqlowner.ExpressionSeal) ormcore.Order

FoundryProjectionOrder validates before reading an ordering descriptor.

Example: expr.FoundryProjectionOrder(order, seal)

func FoundryRowValue

func FoundryRowValue[S, V any](e RowValue[S, V], seal sqlowner.ExpressionSeal) ormcore.Expression

FoundryRowValue exposes validated row metadata without admitting selected values.

Example: expr.FoundryRowValue(e, seal)

func FoundryScopeData

func FoundryScopeData[S, M any](s Scope[S, M], seal sqlowner.ExpressionSeal) ormcore.Scope

FoundryScopeData exposes sealed metadata to rows.

Example: expr.FoundryScopeData(s, seal)

func FoundrySelected

func FoundrySelected[S, V any](e Selected[S, V], seal sqlowner.ExpressionSeal) ormcore.Expression

FoundrySelected exposes sealed selected metadata to rows.

Example: expr.FoundrySelected(e, seal)

func FoundrySelectedColumn

func FoundrySelectedColumn[S, V any](e Selected[S, V], seal sqlowner.ExpressionSeal) ormcore.Column[V]

FoundrySelectedColumn retains concrete value codecs across a subquery boundary.

Example: expr.FoundrySelectedColumn(e, seal)

func OrderBy

func OrderBy[M any](q orm.Query[M], orders ...Order[M]) orm.Query[M]

OrderBy applies computed row ordering to an unaliased model query.

Example: expr.OrderBy(q, orders...)

func Related[M, N, V any](source orm.AggregateSource[M, N], computation AggregateExpression[N, V]) orm.AggregateRelation[M, V]

Related computes a typed relation aggregate; bind it with a slot's Using method.

Example: expr.Related(source, computation)

func RelationFilter

func RelationFilter[M, N any](r orm.ExistenceRelation[M, N], p Predicate[N]) orm.Predicate[N]

RelationFilter adapts expression predicates for a relation's typed target.

Example: expr.RelationFilter(r, p)

func RelationOrder

func RelationOrder[M, N any](r orm.ExistenceRelation[M, N], o Order[N]) orm.Order[N]

RelationOrder adapts a computed row order to a relation's actual target.

Example: expr.RelationOrder(r, o)

func RelationPivotOrder

func RelationPivotOrder[M, N, P any](r orm.ThroughRelation[M, N, P], o Order[P]) orm.Order[P]

RelationPivotOrder adapts a computed row order to the relation's actual pivot.

Example: expr.RelationPivotOrder(r, o)

func Where

func Where[M any](q orm.Query[M], predicates ...Predicate[M]) orm.Query[M]

Where applies computed row predicates to an unaliased model query.

Example: expr.Where(q, predicates...)

Types

type Aggregate

type Aggregate[S, V any] = aggregate[*S, V]

Aggregate is an unordered selected aggregate.

Example: expr.Exists[User]()

func Exists

func Exists[S any]() Aggregate[S, bool]

Exists reports whether any input row exists; empty input is false.

Example: expr.Exists[User]()

type AggregateExpression

type AggregateExpression[S, V any] interface {
	// contains filtered or unexported methods
}

AggregateExpression is the reusable, sealed aggregate descriptor for relation slots. It retains the input scope and exact result/codec, including nullable results.

Example: var aggregate expr.AggregateExpression[User, int64] = expr.Count[User]()

type Case

type Case[S, V any] struct {
	// contains filtered or unexported fields
}

Case is unfinished row CASE; Else or ElseNull must finish it before use.

Example: expr.When(expr.Gt(age, 18), name).Else(fallback)

func When

func When[S, V any](condition Predicate[S], result RowValue[S, V]) Case[S, V]

When starts row CASE with a same-owner row condition and result.

Example: expr.When(condition, result)

func (Case[S, V]) Else

func (c Case[S, V]) Else(result RowValue[S, V]) RowExpression[S, V]

Else finishes row CASE with a matching fallback.

Example: choice.Else(name)

func (Case[S, V]) ElseNull

func (c Case[S, V]) ElseNull() RowExpression[S, value.Nullable[V]]

ElseNull finishes required-valued row CASE with one nullable result layer.

Example: expr.When(expr.Gt(age, 18), name).ElseNull()

func (Case[S, V]) When

func (c Case[S, V]) When(condition Predicate[S], result RowValue[S, V]) Case[S, V]

When appends an independent row CASE branch with the exact result type.

Example: choice.When(expr.Gt(age, 65), seniorName)

type CompareFilterAdapter added in v0.3.0

type CompareFilterAdapter[S, V any] struct {
	// contains filtered or unexported fields
}

CompareFilterAdapter adapts a typed row value for datatable equality filters.

Example: expr.CompareFilter(state)

func CompareFilter added in v0.3.0

func CompareFilter[S, V any](e RowValue[S, V]) CompareFilterAdapter[S, V]

CompareFilter adapts any typed row value for datatable equality and membership filters, preserving its exact scope and value type. It grants no ordering or text operations.

Example: datatable.Where(http.BoolQuery[bool](), expr.CompareFilter(expr.JSONContains(settings, wanted)))

func (CompareFilterAdapter[S, V]) Eq added in v0.3.0

func (a CompareFilterAdapter[S, V]) Eq(v V) Predicate[S]

Eq compares equality within the adapter's row scope.

func (CompareFilterAdapter[S, V]) In added in v0.3.0

func (a CompareFilterAdapter[S, V]) In(vs ...V) Predicate[S]

In tests membership within the adapter's row scope.

func (CompareFilterAdapter[S, V]) Ne added in v0.3.0

func (a CompareFilterAdapter[S, V]) Ne(v V) Predicate[S]

Ne compares inequality within the adapter's row scope.

type DateUnit

type DateUnit uint8

DateUnit identifies a calendar boundary. Clock units cannot be supplied to TruncateDate without an explicit invalid conversion.

Example: expr.DateMonth

const (
	DateDay        DateUnit = DateUnit(unitDay)
	DateWeek       DateUnit = DateUnit(unitWeek)
	DateMonth      DateUnit = DateUnit(unitMonth)
	DateQuarter    DateUnit = DateUnit(unitQuarter)
	DateYear       DateUnit = DateUnit(unitYear)
	DateDecade     DateUnit = DateUnit(unitDecade)
	DateCentury    DateUnit = DateUnit(unitCentury)
	DateMillennium DateUnit = DateUnit(unitMillennium)
)

type Expression

type Expression[S, V, P any] = expression[*S, V, P]

Expression keeps a scoped SQL value and its codec closures.

Example: expr.At(scope, orm.KeyExpr(Orders.ID))

func At

func At[S, M, V, P any](scope Scope[S, M], column orm.ExpressionColumn[M, V, P]) Expression[S, V, P]

At re-scopes a model column without erasing its value type.

Example: expr.At(scope, column)

func AtNullable

func AtNullable[S, M, V any](scope NullableScope[S, M], column orm.ExpressionColumn[M, V, V]) Expression[S, V, value.Nullable[V]]

AtNullable widens a required column on an outer join's nullable side.

Example: expr.AtNullable(scope, column)

func AtNullableValue

func AtNullableValue[S, M, V any](scope NullableScope[S, M], column orm.ExpressionColumn[M, V, value.Nullable[V]]) Expression[S, V, value.Nullable[V]]

AtNullableValue preserves one nullable layer for an already nullable column.

Example: expr.AtNullableValue(scope, column)

func Value

func Value[M, V, P any](column orm.ExpressionColumn[M, V, P]) Expression[M, V, P]

Value uses a column in its unaliased model scope.

Example: expr.Value(column)

type FilterableAggregate added in v0.3.0

type FilterableAggregate[S any, A any] interface {
	// contains filtered or unexported methods
}

FilterableAggregate preserves the concrete aggregate type when adding row filters.

Example: var source expr.FilterableAggregate[User, expr.OrderedAggregate[User, int64]] = expr.Count[User]()

type FrameBoundary

type FrameBoundary interface {
	// contains filtered or unexported methods
}

FrameBoundary is a sealed ROWS/GROUPS position or offset.

Example: w.RowsBetween(expr.Preceding(1), expr.CurrentRow())

type FrameOffset

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

FrameOffset counts rows/groups, not RANGE value distance.

Example: expr.Preceding(2)

func Following

func Following(count int64) FrameOffset

Following counts nonnegative rows/groups after the current row.

Example: expr.Following(count)

func Preceding

func Preceding(count int64) FrameOffset

Preceding counts nonnegative rows/groups before the current row.

Example: expr.Preceding(count)

type FramePosition

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

FramePosition is a current/unbounded position, with an invalid zero value.

Example: expr.CurrentRow()

func CurrentRow

func CurrentRow() FramePosition

CurrentRow identifies the current row or peers.

Example: expr.CurrentRow()

func UnboundedFollowing

func UnboundedFollowing() FramePosition

UnboundedFollowing identifies the partition's last row.

Example: expr.UnboundedFollowing()

func UnboundedPreceding

func UnboundedPreceding() FramePosition

UnboundedPreceding identifies the partition's first row.

Example: expr.UnboundedPreceding()

type GeographicPoint

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

GeographicPoint is a validated latitude/longitude pair in degrees. Its zero value is the valid origin (0, 0); construction rejects non-finite/out-of-range input.

Example: expr.NewGeographicPoint(3.14, 101.69)

func NewGeographicPoint

func NewGeographicPoint(latitude, longitude float64) (GeographicPoint, error)

NewGeographicPoint validates latitude and longitude in degrees.

Example: expr.NewGeographicPoint(latitude, longitude)

type GroupKey

type GroupKey[S any] struct {
	// contains filtered or unexported fields
}

GroupKey is a row-phase key for GROUP BY and DISTINCT ON.

Example: expr.Group(expr.Value(orm.TextExpr(Users.Email)))

func Group

func Group[S, V any](v RowValue[S, V]) GroupKey[S]

Group constructs a row key without adding methods to columns.

Example: expr.Group(v)

type HavingPredicate

type HavingPredicate[S any] = havingPredicate[*S]

HavingPredicate is a group condition and cannot enter row WHERE.

Example: expr.GtValue(expr.Count[User](), 0)

func DistinctFromValue

func DistinctFromValue[S any, V any](left, right Selected[S, V]) HavingPredicate[S]

DistinctFromValue is DistinctFrom's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.DistinctFromValue(left, right)

func EqValue added in v0.3.0

func EqValue[S, V any](source ValueOperand[S, V], v V) HavingPredicate[S]

EqValue tests equality in HAVING using the operand's exact comparison type. Nullable operands bind present values without changing their SQL null semantics.

Example: expr.EqValue(expr.Count[User](), int64(1))

func EqualValue

func EqualValue[S any, V any](left, right Selected[S, V]) HavingPredicate[S]

EqualValue is Equal's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.EqualValue(left, right)

func GreaterNullableValue

func GreaterNullableValue[S any, V orderedScalar](left, right Selected[S, value.Nullable[V]]) HavingPredicate[S]

GreaterNullableValue compares nullable selected operands for HAVING.

Example: expr.GreaterNullableValue(left, right)

func GreaterOrEqualNullableValue

func GreaterOrEqualNullableValue[S any, V orderedScalar](left, right Selected[S, value.Nullable[V]]) HavingPredicate[S]

GreaterOrEqualNullableValue compares nullable selected operands for HAVING.

Example: expr.GreaterOrEqualNullableValue(left, right)

func GreaterOrEqualValue

func GreaterOrEqualValue[S any, V orderedScalar](left, right Selected[S, V]) HavingPredicate[S]

GreaterOrEqualValue is GreaterOrEqual's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.GreaterOrEqualValue(left, right)

func GreaterValue

func GreaterValue[S any, V orderedScalar](left, right Selected[S, V]) HavingPredicate[S]

GreaterValue is Greater's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.GreaterValue(left, right)

func Grouped

func Grouped[S any](condition Predicate[S]) HavingPredicate[S]

Grouped lifts a row predicate into the group phase; SQL grouping still applies.

Example: expr.Grouped(condition)

func GtValue added in v0.3.0

func GtValue[S, V any](source OrderedValueOperand[S, V], v V) HavingPredicate[S]

GtValue tests whether a selected value is greater than its bound in HAVING. Nullable operands bind present values without changing their SQL null semantics.

Example: expr.GtValue(expr.Count[User](), int64(1))

func GteValue added in v0.3.0

func GteValue[S, V any](source OrderedValueOperand[S, V], v V) HavingPredicate[S]

GteValue tests whether a selected value is greater than or equal to its bound in HAVING. Nullable operands bind present values without changing their SQL null semantics.

Example: expr.GteValue(expr.Count[User](), int64(1))

func HavingAnd

func HavingAnd[S any](predicates ...HavingPredicate[S]) HavingPredicate[S]

HavingAnd joins group predicates with AND; empty is TRUE.

Example: expr.HavingAnd(predicates...)

func HavingNot added in v0.3.0

func HavingNot[S any](p HavingPredicate[S]) HavingPredicate[S]

HavingNot negates a group predicate without changing its phase or scope.

Example: expr.HavingNot(p)

func HavingOr

func HavingOr[S any](predicates ...HavingPredicate[S]) HavingPredicate[S]

HavingOr joins group predicates with OR; empty is FALSE.

Example: expr.HavingOr(predicates...)

func InValue added in v0.3.0

func InValue[S, V any](source ValueOperand[S, V], vs ...V) HavingPredicate[S]

InValue tests membership in HAVING using the operand's exact comparison type. Nullable operands bind present values without changing their SQL null semantics.

Example: expr.InValue(expr.Count[User](), int64(1))

func IsNotNullValue added in v0.3.0

func IsNotNullValue[S, V any](source NullValueOperand[S, V]) HavingPredicate[S]

IsNotNullValue tests SQL presence in HAVING.

Example: expr.IsNotNullValue(expr.Sum(orm.NumberExpr(Orders.Total)))

func IsNullValue added in v0.3.0

func IsNullValue[S, V any](source NullValueOperand[S, V]) HavingPredicate[S]

IsNullValue tests SQL nullness in HAVING.

Example: expr.IsNullValue(expr.Sum(orm.NumberExpr(Orders.Total)))

func LessNullableValue

func LessNullableValue[S any, V orderedScalar](left, right Selected[S, value.Nullable[V]]) HavingPredicate[S]

LessNullableValue compares nullable selected operands for HAVING.

Example: expr.LessNullableValue(left, right)

func LessOrEqualNullableValue

func LessOrEqualNullableValue[S any, V orderedScalar](left, right Selected[S, value.Nullable[V]]) HavingPredicate[S]

LessOrEqualNullableValue compares nullable selected operands for HAVING.

Example: expr.LessOrEqualNullableValue(left, right)

func LessOrEqualValue

func LessOrEqualValue[S any, V orderedScalar](left, right Selected[S, V]) HavingPredicate[S]

LessOrEqualValue is LessOrEqual's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.LessOrEqualValue(left, right)

func LessValue

func LessValue[S any, V orderedScalar](left, right Selected[S, V]) HavingPredicate[S]

LessValue is Less's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.LessValue(left, right)

func LikeNullableValue

func LikeNullableValue[S any, V ~string](left, right Selected[S, value.Nullable[V]]) HavingPredicate[S]

LikeNullableValue compares nullable selected operands for HAVING.

Example: expr.LikeNullableValue(left, right)

func LikeValue

func LikeValue[S any, V ~string](left, right Selected[S, V]) HavingPredicate[S]

LikeValue is Like's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.LikeValue(left, right)

func LtValue added in v0.3.0

func LtValue[S, V any](source OrderedValueOperand[S, V], v V) HavingPredicate[S]

LtValue tests whether a selected value is less than its bound in HAVING. Nullable operands bind present values without changing their SQL null semantics.

Example: expr.LtValue(expr.Count[User](), int64(1))

func LteValue added in v0.3.0

func LteValue[S, V any](source OrderedValueOperand[S, V], v V) HavingPredicate[S]

LteValue tests whether a selected value is less than or equal to its bound in HAVING. Nullable operands bind present values without changing their SQL null semantics.

Example: expr.LteValue(expr.Count[User](), int64(1))

func NeValue added in v0.3.0

func NeValue[S, V any](source ValueOperand[S, V], v V) HavingPredicate[S]

NeValue tests inequality in HAVING using the operand's exact comparison type. Nullable operands bind present values without changing their SQL null semantics.

Example: expr.NeValue(expr.Count[User](), int64(1))

func NotDistinctFromValue

func NotDistinctFromValue[S any, V any](left, right Selected[S, V]) HavingPredicate[S]

NotDistinctFromValue is NotDistinctFrom's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.NotDistinctFromValue(left, right)

func NotEqualValue

func NotEqualValue[S any, V any](left, right Selected[S, V]) HavingPredicate[S]

NotEqualValue is NotEqual's selected counterpart, producing a HAVING predicate. SQL grouping and window restrictions still apply to both operands.

Example: expr.NotEqualValue(left, right)

func TextContainsValue added in v0.3.0

func TextContainsValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextContainsValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextContainsValue(expr.TextValue(selectedName), "a")

func TextEndsWithValue added in v0.3.0

func TextEndsWithValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextEndsWithValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextEndsWithValue(expr.TextValue(selectedName), "a")

func TextIContainsValue added in v0.3.0

func TextIContainsValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextIContainsValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextIContainsValue(expr.TextValue(selectedName), "a")

func TextIEndsWithValue added in v0.3.0

func TextIEndsWithValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextIEndsWithValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextIEndsWithValue(expr.TextValue(selectedName), "a")

func TextILikeValue added in v0.3.0

func TextILikeValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextILikeValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextILikeValue(expr.TextValue(selectedName), "a")

func TextIStartsWithValue added in v0.3.0

func TextIStartsWithValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextIStartsWithValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextIStartsWithValue(expr.TextValue(selectedName), "a")

func TextLikeValue added in v0.3.0

func TextLikeValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextLikeValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextLikeValue(expr.TextValue(selectedName), "a")

func TextStartsWithValue added in v0.3.0

func TextStartsWithValue[S any, V ~string](source TextValueOperand[S, V], v V) HavingPredicate[S]

TextStartsWithValue compares selected text in HAVING with the database collation. Nullable operands compare present text while preserving SQL null semantics.

Example: expr.TextStartsWithValue(expr.TextValue(selectedName), "a")

type JSONField

type JSONField[P, V any] struct {
	// contains filtered or unexported fields
}

JSONField binds a payload field to its JSON tag.

Example: expr.JSONFieldOf(func(p *Profile) *string {
	return &p.Name
})

Call Validate at startup. Owner and result types are invariant, even under conversion.

func JSONFieldOf

func JSONFieldOf[P, V any](selectField func(*P) *V) JSONField[P, V]

JSONFieldOf resolves a direct pointer selector against a fresh payload at startup. Ignored, ambiguous, foreign, zero-sized and opaque custom-encoded fields fail closed.

Example: expr.JSONFieldOf(func(p *Profile) *string {
	return &p.Name
})

func (JSONField[P, V]) Validate

func (f JSONField[P, V]) Validate() error

Validate reports declaration errors before serving queries.

Example: Theme.Validate()

type JSONFixedArray

type JSONFixedArray[P, V any] struct {
	// contains filtered or unexported fields
}

JSONFixedArray binds a fixed Go array's element type without generated accessors.

Example: JSONFixedArrayOf(func(a *[3]string) *string {
	return &a[0]
})

func JSONFixedArrayOf

func JSONFixedArrayOf[P, V any](selectElement func(*P) *V) JSONFixedArray[P, V]

JSONFixedArrayOf validates an element selector once; query-time indices remain int32.

Example: expr.JSONFixedArrayOf(func(p *[3]int64) *int64 {
	return &p[0]
})

func (JSONFixedArray[P, V]) Validate

func (a JSONFixedArray[P, V]) Validate() error

Validate reports invalid fixed-array declarations.

Example: ThreeNames.Validate()

type JSONPath

type JSONPath[S, P any] struct {
	// contains filtered or unexported fields
}

JSONPath retains its row owner and exact payload without embedded method chains.

Example: expr.JSONProperty(parent, field)

func JSONArrayElement

func JSONArrayElement[S, P, V any](parent JSONPath[S, P], array JSONFixedArray[P, V], index int32) JSONPath[S, V]

JSONArrayElement selects a fixed array element using its validated declaration.

Example: expr.JSONArrayElement(parent, array, index)

func JSONDocument

func JSONDocument[S, P any](path JSONPath[S, value.JSON[P]]) JSONPath[S, P]

JSONDocument unwraps a nested JSON value's payload without changing its SQL node.

Example: expr.JSONDocument(path)

func JSONIndex

func JSONIndex[S any, P ~[]V, V any](parent JSONPath[S, P], index int32) JSONPath[S, V]

JSONIndex selects a typed slice element. Negative int32 indices count from the end.

Example: expr.JSONIndex(parent, index)

func JSONMapKey

func JSONMapKey[S any, P ~map[K]V, K comparable, V any](parent JSONPath[S, P], key K) JSONPath[S, V]

JSONMapKey preserves the map's declared key and element types, including named keys.

Example: expr.JSONMapKey(parent, key)

func JSONNullable

func JSONNullable[S, P any](path JSONPath[S, value.Nullable[P]]) JSONPath[S, P]

JSONNullable unwraps payload nullability; JSON/Kind still distinguish JSON null.

Example: expr.JSONNullable(path)

func JSONNullableRoot

func JSONNullableRoot[S, P any](input RowValue[S, value.Nullable[value.JSON[P]]]) JSONPath[S, P]

JSONNullableRoot preserves a SQL-null document ancestor.

Example: expr.JSONNullableRoot(input)

func JSONOptional

func JSONOptional[S, P any](path JSONPath[S, value.Optional[P]]) JSONPath[S, P]

JSONOptional unwraps property presence into path presence; no SQL cast is added.

Example: expr.JSONOptional(path)

func JSONPointer

func JSONPointer[S, P any](path JSONPath[S, *P]) JSONPath[S, P]

JSONPointer unwraps a pointer payload for typed traversal or scalar extraction.

Example: expr.JSONPointer(path)

func JSONProperty

func JSONProperty[S, P, V any](parent JSONPath[S, P], field JSONField[P, V]) JSONPath[S, V]

JSONProperty applies a startup-validated field declaration. The json tag is a SQL literal for expression-index parity; query-time map keys remain parameters.

Example: expr.JSONProperty(parent, field)

func JSONRoot

func JSONRoot[S, P any](input RowValue[S, value.JSON[P]]) JSONPath[S, P]

JSONRoot starts a row path; selected expressions cannot become path predicates.

Example: expr.JSONRoot(input)

func (JSONPath[S, P]) JSON

func (p JSONPath[S, P]) JSON() RowExpression[S, value.Nullable[value.JSON[P]]]

JSON selects a nullable payload snapshot. Missing/SQL-null ancestors are SQL NULL; present JSON null is decoded through P and can fail if P cannot represent it.

Example: expr.AsSelected(path.JSON())

type LocalResolution

type LocalResolution uint8

LocalResolution explicitly selects PostgreSQL's DST gap/overlap policy.

Example: expr.PostgresStandardTime

type NullValueOperand added in v0.3.0

type NullValueOperand[S, V any] interface {
	ValueOperand[S, V]
	// contains filtered or unexported methods
}

NullValueOperand supplies SQL null tests in HAVING.

Example: var source expr.NullValueOperand[Order, decimal.Decimal] = expr.Sum(orm.NumberExpr(Orders.Total))

type NullableCompareFilterAdapter added in v0.3.0

type NullableCompareFilterAdapter[S, V any] struct {
	// contains filtered or unexported fields
}

NullableCompareFilterAdapter adapts a nullable row value for datatable equality filters.

Example: expr.NullableCompareFilter(state)

func NullableCompareFilter added in v0.3.0

func NullableCompareFilter[S, V any](e RowValue[S, value.Nullable[V]]) NullableCompareFilterAdapter[S, V]

NullableCompareFilter adapts any nullable typed row value for datatable present-value equality, membership and SQL null tests, preserving its exact scope and value type.

Example: datatable.NullableWhere(http.BoolQuery[bool](), expr.NullableCompareFilter(matches))

func (NullableCompareFilterAdapter[S, V]) Eq added in v0.3.0

func (a NullableCompareFilterAdapter[S, V]) Eq(v V) Predicate[S]

Eq compares equality within the adapter's row scope.

func (NullableCompareFilterAdapter[S, V]) In added in v0.3.0

func (a NullableCompareFilterAdapter[S, V]) In(vs ...V) Predicate[S]

In tests membership within the adapter's row scope.

func (NullableCompareFilterAdapter[S, V]) IsNotNull added in v0.3.0

func (a NullableCompareFilterAdapter[S, V]) IsNotNull() Predicate[S]

IsNotNull tests SQL presence within the adapter's row scope.

func (NullableCompareFilterAdapter[S, V]) IsNull added in v0.3.0

func (a NullableCompareFilterAdapter[S, V]) IsNull() Predicate[S]

IsNull tests SQL nullness within the adapter's row scope.

func (NullableCompareFilterAdapter[S, V]) Ne added in v0.3.0

func (a NullableCompareFilterAdapter[S, V]) Ne(v V) Predicate[S]

Ne compares inequality within the adapter's row scope.

type NullableOrderFilterAdapter added in v0.3.0

type NullableOrderFilterAdapter[S any, V orderedScalar] struct {
	// contains filtered or unexported fields
}

NullableOrderFilterAdapter adapts a nullable ordered row expression for datatable filters.

Example: expr.NullableOrderFilter(age)

func NullableOrderFilter added in v0.3.0

func NullableOrderFilter[S any, V orderedScalar](e NullableOrderedRowExpression[S, V]) NullableOrderFilterAdapter[S, V]

NullableOrderFilter adapts NullableOrderedRowExpression for datatable filters.

Example: expr.NullableOrderFilter(e)

func (NullableOrderFilterAdapter[S, V]) Eq added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) Eq(v V) Predicate[S]

Eq compares equality within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) Gt added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) Gt(v V) Predicate[S]

Gt compares greater than within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) Gte added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) Gte(v V) Predicate[S]

Gte compares greater than or equal within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) In added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) In(vs ...V) Predicate[S]

In tests membership within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) IsNotNull added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) IsNotNull() Predicate[S]

IsNotNull tests SQL presence within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) IsNull added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) IsNull() Predicate[S]

IsNull tests SQL nullness within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) Lt added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) Lt(v V) Predicate[S]

Lt compares less than within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) Lte added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) Lte(v V) Predicate[S]

Lte compares less than or equal within the adapter's row scope.

func (NullableOrderFilterAdapter[S, V]) Ne added in v0.3.0

func (a NullableOrderFilterAdapter[S, V]) Ne(v V) Predicate[S]

Ne compares inequality within the adapter's row scope.

type NullableOrderValueFilterAdapter added in v0.3.0

type NullableOrderValueFilterAdapter[S any, V orderedScalar] struct {
	// contains filtered or unexported fields
}

NullableOrderValueFilterAdapter supplies typed HAVING operations to datatable filters.

Example: expr.NullableOrderValueFilter(source)

func NullableOrderValueFilter added in v0.3.0

func NullableOrderValueFilter[S any, V orderedScalar](source interface {
	OrderedValueOperand[S, V]
	NullValueOperand[S, V]
}) NullableOrderValueFilterAdapter[S, V]

NullableOrderValueFilter adapts a selected comparison source without changing scope, value, or phase.

Example: expr.NullableOrderValueFilter(source)

func (NullableOrderValueFilterAdapter[S, V]) Eq added in v0.3.0

Eq compares equality within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) Gt added in v0.3.0

Gt compares greater than within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) Gte added in v0.3.0

Gte compares greater than or equal within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) In added in v0.3.0

func (a NullableOrderValueFilterAdapter[S, V]) In(vs ...V) HavingPredicate[S]

In tests membership within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) IsNotNull added in v0.3.0

func (a NullableOrderValueFilterAdapter[S, V]) IsNotNull() HavingPredicate[S]

IsNotNull tests SQL presence within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) IsNull added in v0.3.0

IsNull tests SQL nullness within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) Lt added in v0.3.0

Lt compares less than within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) Lte added in v0.3.0

Lte compares less than or equal within the adapter's HAVING scope.

func (NullableOrderValueFilterAdapter[S, V]) Ne added in v0.3.0

Ne compares inequality within the adapter's HAVING scope.

type NullableOrderedAggregate

type NullableOrderedAggregate[S any, V orderedScalar] = nullableOrderedAggregate[*S, V]

NullableOrderedAggregate retains a nullable aggregate with present-value comparisons.

Example: expr.GtValue(expr.Sum(orm.NumberExpr(Orders.Total)), decimal.FromInt64(1))

func Avg

func Avg[S any, V interface{ exactNumber }, P any, C orderedColumn[S, V, P]](column C) NullableOrderedAggregate[S, decimal.Decimal]

Avg returns nullable decimal.Decimal; empty/all-NULL input is NULL.

Example: expr.Avg(column)

func AvgAt

func AvgAt[S, M any, V interface{ exactNumber }, P any, C orderedColumn[M, V, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, decimal.Decimal]

AvgAt returns nullable decimal.Decimal; empty/all-NULL input is NULL.

Example: expr.AvgAt(scope, column)

func AvgFloat

func AvgFloat[S any, V interface{ ~float32 | ~float64 }, P any, C orderedColumn[S, V, P]](column C) NullableOrderedAggregate[S, float64]

AvgFloat returns nullable float64; empty/all-NULL input is NULL.

Example: expr.AvgFloat(column)

func AvgFloatAt

func AvgFloatAt[S, M any, V interface{ ~float32 | ~float64 }, P any, C orderedColumn[M, V, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, float64]

AvgFloatAt returns nullable float64; empty/all-NULL input is NULL.

Example: expr.AvgFloatAt(scope, column)

func AvgFloatNullableRow

func AvgFloatNullableRow[S any, V interface{ ~float32 | ~float64 }](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, float64]

AvgFloatNullableRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.AvgFloatNullableRow(input)

func AvgFloatRow

func AvgFloatRow[S any, V interface{ ~float32 | ~float64 }](input RowExpression[S, V]) NullableOrderedAggregate[S, float64]

AvgFloatRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.AvgFloatRow(input)

func AvgInterval

func AvgInterval[S, P any, C orderedColumn[S, temporal.Interval, P]](column C) NullableOrderedAggregate[S, temporal.Interval]

AvgInterval returns nullable temporal.Interval; empty/all-NULL input is NULL.

Example: expr.AvgInterval(column)

func AvgIntervalAt

func AvgIntervalAt[S, M, P any, C orderedColumn[M, temporal.Interval, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, temporal.Interval]

AvgIntervalAt returns nullable temporal.Interval; empty/all-NULL input is NULL.

Example: expr.AvgIntervalAt(scope, column)

func AvgIntervalNullableRow

func AvgIntervalNullableRow[S any, V temporal.Interval](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, temporal.Interval]

AvgIntervalNullableRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.AvgIntervalNullableRow(input)

func AvgIntervalRow

func AvgIntervalRow[S any, V temporal.Interval](input RowExpression[S, V]) NullableOrderedAggregate[S, temporal.Interval]

AvgIntervalRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.AvgIntervalRow(input)

func AvgNullableRow

func AvgNullableRow[S any, V exactNumber](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, decimal.Decimal]

AvgNullableRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.AvgNullableRow(input)

func AvgRow

func AvgRow[S any, V exactNumber](input RowExpression[S, V]) NullableOrderedAggregate[S, decimal.Decimal]

AvgRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.AvgRow(input)

func Max

func Max[S any, V orderedScalar, P any, C orderedColumn[S, V, P]](column C) NullableOrderedAggregate[S, V]

Max returns the nullable input type; empty/all-NULL input is NULL.

Example: expr.Max(column)

func MaxAt

func MaxAt[S, M any, V orderedScalar, P any, C orderedColumn[M, V, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, V]

MaxAt returns the nullable input type; empty/all-NULL input is NULL.

Example: expr.MaxAt(scope, column)

func MaxNullableRow

func MaxNullableRow[S any, V orderedScalar](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, V]

MaxNullableRow retains the input codec with exactly one nullable layer.

Example: expr.MaxNullableRow(input)

func MaxRow

func MaxRow[S any, V orderedScalar](input RowExpression[S, V]) NullableOrderedAggregate[S, V]

MaxRow retains the input codec with exactly one nullable layer.

Example: expr.MaxRow(input)

func Min

func Min[S any, V orderedScalar, P any, C orderedColumn[S, V, P]](column C) NullableOrderedAggregate[S, V]

Min returns the nullable input type; empty/all-NULL input is NULL.

Example: expr.Min(column)

func MinAt

func MinAt[S, M any, V orderedScalar, P any, C orderedColumn[M, V, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, V]

MinAt returns the nullable input type; empty/all-NULL input is NULL.

Example: expr.MinAt(scope, column)

func MinNullableRow

func MinNullableRow[S any, V orderedScalar](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, V]

MinNullableRow retains the input codec with exactly one nullable layer.

Example: expr.MinNullableRow(input)

func MinRow

func MinRow[S any, V orderedScalar](input RowExpression[S, V]) NullableOrderedAggregate[S, V]

MinRow retains the input codec with exactly one nullable layer.

Example: expr.MinRow(input)

func Sum

func Sum[S any, V interface{ exactNumber }, P any, C orderedColumn[S, V, P]](column C) NullableOrderedAggregate[S, decimal.Decimal]

Sum returns nullable decimal.Decimal; empty/all-NULL input is NULL.

Example: expr.Sum(column)

func SumAt

func SumAt[S, M any, V interface{ exactNumber }, P any, C orderedColumn[M, V, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, decimal.Decimal]

SumAt returns nullable decimal.Decimal; empty/all-NULL input is NULL.

Example: expr.SumAt(scope, column)

func SumFloat

func SumFloat[S any, V interface{ ~float32 | ~float64 }, P any, C orderedColumn[S, V, P]](column C) NullableOrderedAggregate[S, float64]

SumFloat returns nullable float64; empty/all-NULL input is NULL.

Example: expr.SumFloat(column)

func SumFloatAt

func SumFloatAt[S, M any, V interface{ ~float32 | ~float64 }, P any, C orderedColumn[M, V, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, float64]

SumFloatAt returns nullable float64; empty/all-NULL input is NULL.

Example: expr.SumFloatAt(scope, column)

func SumFloatNullableRow

func SumFloatNullableRow[S any, V interface{ ~float32 | ~float64 }](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, float64]

SumFloatNullableRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.SumFloatNullableRow(input)

func SumFloatRow

func SumFloatRow[S any, V interface{ ~float32 | ~float64 }](input RowExpression[S, V]) NullableOrderedAggregate[S, float64]

SumFloatRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.SumFloatRow(input)

func SumInterval

func SumInterval[S, P any, C orderedColumn[S, temporal.Interval, P]](column C) NullableOrderedAggregate[S, temporal.Interval]

SumInterval returns nullable temporal.Interval; empty/all-NULL input is NULL.

Example: expr.SumInterval(column)

func SumIntervalAt

func SumIntervalAt[S, M, P any, C orderedColumn[M, temporal.Interval, P]](scope Scope[S, M], column C) NullableOrderedAggregate[S, temporal.Interval]

SumIntervalAt returns nullable temporal.Interval; empty/all-NULL input is NULL.

Example: expr.SumIntervalAt(scope, column)

func SumIntervalNullableRow

func SumIntervalNullableRow[S any, V temporal.Interval](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, temporal.Interval]

SumIntervalNullableRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.SumIntervalNullableRow(input)

func SumIntervalRow

func SumIntervalRow[S any, V temporal.Interval](input RowExpression[S, V]) NullableOrderedAggregate[S, temporal.Interval]

SumIntervalRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.SumIntervalRow(input)

func SumNullableRow

func SumNullableRow[S any, V exactNumber](input RowExpression[S, value.Nullable[V]]) NullableOrderedAggregate[S, decimal.Decimal]

SumNullableRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.SumNullableRow(input)

func SumRow

func SumRow[S any, V exactNumber](input RowExpression[S, V]) NullableOrderedAggregate[S, decimal.Decimal]

SumRow aggregates a declared derived field; empty/all-NULL input remains NULL.

Example: expr.SumRow(input)

type NullableOrderedRowExpression

type NullableOrderedRowExpression[S any, V orderedScalar] = nullableOrderedRowExpression[*S, V]

NullableOrderedRowExpression retains nullable results and present-value comparisons.

Example: expr.NullableGt(expr.AddNullable(a, b), 2)

func AbsNullable

func AbsNullable[S any, V numericValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

AbsNullable propagates SQL NULL and retains the concrete numeric type.

Example: expr.AbsNullable(input)

func AddClockElapsedNullable

func AddClockElapsedNullable[S any](input RowValue[S, value.Nullable[temporal.Time]], duration time.Duration) NullableOrderedRowExpression[S, temporal.Time]

AddClockElapsedNullable adds elapsed time to a time of day, wrapping at midnight. Whole microseconds are required. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.AddClockElapsedNullable(input, duration)

func AddDateDaysNullable

func AddDateDaysNullable[S any](input RowValue[S, value.Nullable[temporal.Date]], days int32) NullableOrderedRowExpression[S, temporal.Date]

AddDateDaysNullable adds signed calendar days and retains the date-only result. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.AddDateDaysNullable(input, days)

func AddDateIntervalNullable

func AddDateIntervalNullable[S any](input RowValue[S, value.Nullable[temporal.Date]], interval temporal.Interval) NullableOrderedRowExpression[S, temporal.LocalDateTime]

AddDateIntervalNullable adds signed calendar and elapsed components. Database overflow and out-of-contract results remain errors. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.AddDateIntervalNullable(input, interval)

func AddInstantIntervalNullable

func AddInstantIntervalNullable[S any, V instantValue](input RowValue[S, value.Nullable[V]], interval temporal.Interval, zone TimeZone) NullableOrderedRowExpression[S, V]

AddInstantIntervalNullable adds signed calendar and elapsed components in the explicit timezone. Database overflow and out-of-contract results remain errors. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.AddInstantIntervalNullable(input, interval, zone)

func AddIntervalsNullable

AddIntervalsNullable adds interval components without conflating calendar and elapsed units. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.AddIntervalsNullable(left, right)

func AddLocalIntervalNullable

AddLocalIntervalNullable adds signed calendar and elapsed components. Database overflow and out-of-contract results remain errors. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.AddLocalIntervalNullable(input, interval)

func AddNullable

func AddNullable[S any, V numericValue](left, right RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

AddNullable propagates SQL NULL. Widen a non-null operand with NullableRow.

Example: expr.AddNullable(left, right)

func CenturyNullable

func CenturyNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

CenturyNullable propagates NULL without changing its input scope.

Example: expr.CenturyNullable(input)

func ClockDifferenceNullable

ClockDifferenceNullable subtracts clock components without wrapping the signed result at midnight. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.ClockDifferenceNullable(left, right)

func CombineDateTimeNullable

CombineDateTimeNullable combines a calendar date and time of day without choosing a timezone. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.CombineDateTimeNullable(date, clock)

func DateDifferenceNullable

func DateDifferenceNullable[S any](left RowValue[S, value.Nullable[temporal.Date]], right RowValue[S, value.Nullable[temporal.Date]]) NullableOrderedRowExpression[S, int64]

DateDifferenceNullable returns the signed number of calendar days from right to left. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.DateDifferenceNullable(left, right)

func DateOfNullable

DateOfNullable selects the calendar date from local wall components. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.DateOfNullable(input)

func DayNullable

func DayNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

DayNullable propagates NULL without changing its input scope.

Example: expr.DayNullable(input)

func DayOfWeekNullable

func DayOfWeekNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

DayOfWeekNullable propagates NULL without changing its input scope.

Example: expr.DayOfWeekNullable(input)

func DayOfYearNullable

func DayOfYearNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

DayOfYearNullable propagates NULL without changing its input scope.

Example: expr.DayOfYearNullable(input)

func DecadeNullable

func DecadeNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

DecadeNullable propagates NULL without changing its input scope.

Example: expr.DecadeNullable(input)

func DecimalNullable

func DecimalNullable[S any, V exactNumber](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, decimal.Decimal]

DecimalNullable converts a nullable row input without removing NULL.

Example: expr.DecimalNullable(input)

func DivideNullable

func DivideNullable[S any, V numericValue](left, right RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

DivideNullable propagates SQL NULL. Widen a non-null operand with NullableRow.

Example: expr.DivideNullable(left, right)

func FloatNullable

func FloatNullable[S any, V numericValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, float64]

FloatNullable converts a nullable row input without removing NULL.

Example: expr.FloatNullable(input)

func FromUnixMillisNullable

func FromUnixMillisNullable[S any, V integerNumber](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, temporal.DateTime]

FromUnixMillisNullable converts exact integer Unix milliseconds to a UTC instant without floating-point epoch rounding. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.FromUnixMillisNullable(input)

func HourNullable

func HourNullable[S any, V clockValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

HourNullable propagates NULL without changing its input scope.

Example: expr.HourNullable(input)

func ISODayOfWeekNullable

func ISODayOfWeekNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

ISODayOfWeekNullable propagates NULL without changing its input scope.

Example: expr.ISODayOfWeekNullable(input)

func ISOWeekNullable

func ISOWeekNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

ISOWeekNullable propagates NULL without changing its input scope.

Example: expr.ISOWeekNullable(input)

func ISOYearNullable

func ISOYearNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

ISOYearNullable propagates NULL without changing its input scope.

Example: expr.ISOYearNullable(input)

func InstantDifferenceNullable

func InstantDifferenceNullable[S any, L, R instantValue](left RowValue[S, value.Nullable[L]], right RowValue[S, value.Nullable[R]]) NullableOrderedRowExpression[S, temporal.Interval]

InstantDifferenceNullable subtracts instants using PostgreSQL's 24-hour-day interval normalization. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.InstantDifferenceNullable(left, right)

func IntervalDaysNullable

func IntervalDaysNullable[S any](input RowValue[S, value.Nullable[temporal.Interval]]) NullableOrderedRowExpression[S, int32]

IntervalDaysNullable returns the signed calendar-day component. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.IntervalDaysNullable(input)

func IntervalElapsedNullable

func IntervalElapsedNullable[S any](input RowValue[S, value.Nullable[temporal.Interval]]) NullableOrderedRowExpression[S, time.Duration]

IntervalElapsedNullable returns the elapsed component as a Go duration, excluding months and days. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.IntervalElapsedNullable(input)

func IntervalMonthsNullable

func IntervalMonthsNullable[S any](input RowValue[S, value.Nullable[temporal.Interval]]) NullableOrderedRowExpression[S, int32]

IntervalMonthsNullable returns the complete signed month component, including whole years. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.IntervalMonthsNullable(input)

func JSONLength

func JSONLength[S, P any](input RowValue[S, value.JSON[P]]) NullableOrderedRowExpression[S, int64]

JSONLength evaluates JSON shape or safe array length in the row phase.

Example: expr.JSONLength(input)

func JSONLengthNullable

func JSONLengthNullable[S, P any](input RowValue[S, value.Nullable[value.JSON[P]]]) NullableOrderedRowExpression[S, int64]

JSONLengthNullable evaluates JSON shape or safe array length in the row phase; SQL NULL propagates.

Example: expr.JSONLengthNullable(input)

func JulianDayNullable

func JulianDayNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, decimal.Decimal]

JulianDayNullable propagates NULL without changing its input scope.

Example: expr.JulianDayNullable(input)

func LengthNullable

func LengthNullable[S any, V ~string](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

LengthNullable counts Unicode characters rather than encoded bytes, propagating SQL NULL.

Example: expr.LengthNullable(input)

func LocalAtNullable

func LocalAtNullable[S any, V instantValue](input RowValue[S, value.Nullable[V]], zone TimeZone) NullableOrderedRowExpression[S, temporal.LocalDateTime]

LocalAtNullable converts an instant to wall components in the explicitly selected zone. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.LocalAtNullable(input, zone)

func LocalDifferenceNullable

LocalDifferenceNullable subtracts local date-times using PostgreSQL's normalized interval result. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.LocalDifferenceNullable(left, right)

func MicrosecondsNullable

func MicrosecondsNullable[S any, V clockValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

MicrosecondsNullable propagates NULL without changing its input scope.

Example: expr.MicrosecondsNullable(input)

func MillenniumNullable

func MillenniumNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

MillenniumNullable propagates NULL without changing its input scope.

Example: expr.MillenniumNullable(input)

func MillisecondsNullable

func MillisecondsNullable[S any, V clockValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, decimal.Decimal]

MillisecondsNullable propagates NULL without changing its input scope.

Example: expr.MillisecondsNullable(input)

func MinuteNullable

func MinuteNullable[S any, V clockValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

MinuteNullable propagates NULL without changing its input scope.

Example: expr.MinuteNullable(input)

func MonthNullable

func MonthNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

MonthNullable propagates NULL without changing its input scope.

Example: expr.MonthNullable(input)

func MultiplyNullable

func MultiplyNullable[S any, V numericValue](left, right RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

MultiplyNullable propagates SQL NULL. Widen a non-null operand with NullableRow.

Example: expr.MultiplyNullable(left, right)

func NegateIntervalNullable

func NegateIntervalNullable[S any](input RowValue[S, value.Nullable[temporal.Interval]]) NullableOrderedRowExpression[S, temporal.Interval]

NegateIntervalNullable negates all interval components; database overflow remains an execution error. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.NegateIntervalNullable(input)

func NegateNullable

func NegateNullable[S any, V numericValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

NegateNullable propagates SQL NULL and retains the concrete numeric type.

Example: expr.NegateNullable(input)

func OctetLengthNullable

func OctetLengthNullable[S any, V ~string](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

OctetLengthNullable counts encoded bytes, propagating SQL NULL.

Example: expr.OctetLengthNullable(input)

func OrderNullableRow

func OrderNullableRow[S any, V orderedScalar](v RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

OrderNullableRow exposes present-value comparisons.

Example: expr.OrderNullableRow(v)

func QuarterNullable

func QuarterNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

QuarterNullable propagates NULL without changing its input scope.

Example: expr.QuarterNullable(input)

func RemainderNullable

func RemainderNullable[S any, V exactNumber](left, right RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

RemainderNullable propagates SQL NULL. Widen a non-null operand with NullableRow.

Example: expr.RemainderNullable(left, right)

func ResolveLocalNullable

ResolveLocalNullable uses the explicitly selected PostgreSQL DST resolution policy. It differs from the uniqueness checks in temporal.LocalDateTime.In. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.ResolveLocalNullable(input, zone, policy)

func SecondNullable

func SecondNullable[S any, V clockValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, decimal.Decimal]

SecondNullable propagates NULL without changing its input scope.

Example: expr.SecondNullable(input)

func ShiftDateNullable

ShiftDateNullable adds a typed interval expression to a date, returning local date-time components. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.ShiftDateNullable(input, interval)

func ShiftInstantNullable

func ShiftInstantNullable[S any, V instantValue](input RowValue[S, value.Nullable[V]], interval RowValue[S, value.Nullable[temporal.Interval]], zone TimeZone) NullableOrderedRowExpression[S, V]

ShiftInstantNullable adds a typed interval expression in an explicit timezone, preserving the instant's Go type. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.ShiftInstantNullable(input, interval, zone)

func ShiftLocalNullable

ShiftLocalNullable adds a typed interval expression to local date-time components. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.ShiftLocalNullable(input, interval)

func SphericalDistanceNullable

func SphericalDistanceNullable[S any, V numericValue](latitude, longitude RowValue[S, value.Nullable[V]], origin GeographicPoint) NullableOrderedRowExpression[S, float64]

SphericalDistanceNullable propagates NULL when either stored coordinate is absent.

Example: expr.SphericalDistanceNullable(latitude, longitude, origin)

func SubtractClockElapsedNullable

func SubtractClockElapsedNullable[S any](input RowValue[S, value.Nullable[temporal.Time]], duration time.Duration) NullableOrderedRowExpression[S, temporal.Time]

SubtractClockElapsedNullable subtracts elapsed time from a time of day, wrapping at midnight. Whole microseconds are required. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.SubtractClockElapsedNullable(input, duration)

func SubtractDateIntervalNullable

func SubtractDateIntervalNullable[S any](input RowValue[S, value.Nullable[temporal.Date]], interval temporal.Interval) NullableOrderedRowExpression[S, temporal.LocalDateTime]

SubtractDateIntervalNullable subtracts signed calendar and elapsed components. Database overflow and out-of-contract results remain errors. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.SubtractDateIntervalNullable(input, interval)

func SubtractInstantIntervalNullable

func SubtractInstantIntervalNullable[S any, V instantValue](input RowValue[S, value.Nullable[V]], interval temporal.Interval, zone TimeZone) NullableOrderedRowExpression[S, V]

SubtractInstantIntervalNullable subtracts signed calendar and elapsed components in the explicit timezone. Database overflow and out-of-contract results remain errors. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.SubtractInstantIntervalNullable(input, interval, zone)

func SubtractIntervalsNullable

SubtractIntervalsNullable subtracts interval components without conflating calendar and elapsed units. SQL NULL propagates; widen non-null inputs explicitly.

Example: expr.SubtractIntervalsNullable(left, right)

func SubtractLocalIntervalNullable

func SubtractLocalIntervalNullable[S any](input RowValue[S, value.Nullable[temporal.LocalDateTime]], interval temporal.Interval) NullableOrderedRowExpression[S, temporal.LocalDateTime]

SubtractLocalIntervalNullable subtracts signed calendar and elapsed components. Database overflow and out-of-contract results remain errors. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.SubtractLocalIntervalNullable(input, interval)

func SubtractNullable

func SubtractNullable[S any, V numericValue](left, right RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, V]

SubtractNullable propagates SQL NULL. Widen a non-null operand with NullableRow.

Example: expr.SubtractNullable(left, right)

func TimeOfNullable

TimeOfNullable selects the time of day from local wall components. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.TimeOfNullable(input)

func TruncateDateNullable

func TruncateDateNullable[S any](input RowValue[S, value.Nullable[temporal.Date]], unit DateUnit) NullableOrderedRowExpression[S, temporal.Date]

TruncateDateNullable truncates a calendar date without introducing a timezone. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.TruncateDateNullable(input, unit)

func TruncateInstantNullable

func TruncateInstantNullable[S any, V instantValue](input RowValue[S, value.Nullable[V]], unit TimestampUnit, zone TimeZone) NullableOrderedRowExpression[S, V]

TruncateInstantNullable truncates an instant in the explicit zone while preserving its Go type. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.TruncateInstantNullable(input, unit, zone)

func TruncateLocalNullable

TruncateLocalNullable truncates local wall components without interpreting them as an instant. SQL NULL propagates; widen non-null operands explicitly.

Example: expr.TruncateLocalNullable(input, unit)

func UnixMillisecondsNullable

func UnixMillisecondsNullable[S any, V instantValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

UnixMillisecondsNullable propagates NULL without changing its input scope.

Example: expr.UnixMillisecondsNullable(input)

func UnixSecondsNullable

func UnixSecondsNullable[S any, V instantValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, decimal.Decimal]

UnixSecondsNullable propagates NULL without changing its input scope.

Example: expr.UnixSecondsNullable(input)

func YearNullable

func YearNullable[S any, V calendarValue](input RowValue[S, value.Nullable[V]]) NullableOrderedRowExpression[S, int64]

YearNullable propagates NULL without changing its input scope.

Example: expr.YearNullable(input)

type NullableOrderedValueComparison

type NullableOrderedValueComparison[S any, V orderedScalar] = nullableOrderedValueComparison[*S, V]

NullableOrderedValueComparison retains nullable results with present-value comparisons.

Example: expr.GtValue(expr.OrderNullableValue(selected), value)

func OrderNullableValue

func OrderNullableValue[S any, V orderedScalar](v Selected[S, value.Nullable[V]]) NullableOrderedValueComparison[S, V]

OrderNullableValue compares nullable selected results with present values.

Example: expr.OrderNullableValue(v)

type NullableRowComparison

type NullableRowComparison[S, V any] = nullableRowComparison[*S, V]

NullableRowComparison retains present-value equality and SQL null tests.

Example: expr.NullableEq(expr.CompareNullableRow(expr.Value(orm.NullableEnumExpr(Users.OptionalState))), Active)

func CompareNullableRow

func CompareNullableRow[S, V any](e Expression[S, V, value.Nullable[V]]) NullableRowComparison[S, V]

CompareNullableRow preserves nullable equality without granting enum ordering or text operations.

Example: expr.CompareNullableRow(e)

type NullableScope

type NullableScope[S, M any] struct {
	// contains filtered or unexported fields
}

NullableScope identifies a possibly absent model in an outer join.

Example: rows.NullableRightScope(joined, rows.Scope(orders))

func FoundryNullableScope

func FoundryNullableScope[S, M any](core ormcore.Scope, seal sqlowner.ExpressionSeal) NullableScope[S, M]

FoundryNullableScope constructs a validated nullable scope.

Example: expr.FoundryNullableScope[User, User](core, seal)

type NullableTextFilterAdapter added in v0.3.0

type NullableTextFilterAdapter[S any, V ~string] struct {
	// contains filtered or unexported fields
}

NullableTextFilterAdapter adapts a nullable text row expression for datatable filters.

Example: expr.NullableTextFilter(nickname)

func NullableTextFilter added in v0.3.0

func NullableTextFilter[S any, V ~string](e NullableTextRowExpression[S, V]) NullableTextFilterAdapter[S, V]

NullableTextFilter adapts NullableTextRowExpression for datatable filters.

Example: expr.NullableTextFilter(e)

func (NullableTextFilterAdapter[S, V]) Contains added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Contains(v V) Predicate[S]

Contains tests a text substring within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) Eq added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Eq(v V) Predicate[S]

Eq compares equality within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) Gt added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Gt(v V) Predicate[S]

Gt compares greater than within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) Gte added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Gte(v V) Predicate[S]

Gte compares greater than or equal within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) IContains added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) IContains(v V) Predicate[S]

IContains tests a text substring without case sensitivity within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) In added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) In(vs ...V) Predicate[S]

In tests membership within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) IsNotNull added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) IsNotNull() Predicate[S]

IsNotNull tests SQL presence within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) IsNull added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) IsNull() Predicate[S]

IsNull tests SQL nullness within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) Like added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Like(v V) Predicate[S]

Like tests a SQL text pattern within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) Lt added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Lt(v V) Predicate[S]

Lt compares less than within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) Lte added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Lte(v V) Predicate[S]

Lte compares less than or equal within the adapter's row scope.

func (NullableTextFilterAdapter[S, V]) Ne added in v0.3.0

func (a NullableTextFilterAdapter[S, V]) Ne(v V) Predicate[S]

Ne compares inequality within the adapter's row scope.

type NullableTextRowExpression

type NullableTextRowExpression[S any, V ~string] = nullableTextRowExpression[*S, V]

NullableTextRowExpression preserves NULL and compares present text values.

Example: expr.NullableTextLike(expr.LowerNullable(name), "a%")

func ConcatNullable

func ConcatNullable[S any, V, W ~string](input RowValue[S, value.Nullable[V]], other RowValue[S, value.Nullable[W]]) NullableTextRowExpression[S, string]

ConcatNullable concatenates text with SQL's strict NULL semantics, propagating SQL NULL.

Example: expr.ConcatNullable(input, other)

func JSONTextScalar

func JSONTextScalar[S any, P ~string](path JSONPath[S, P], c codec.Codec[P]) NullableTextRowExpression[S, P]

JSONTextScalar adds pattern predicates only for string payloads.

Example: expr.JSONTextScalar(path, c)

func LowerNullable

func LowerNullable[S any, V ~string](input RowValue[S, value.Nullable[V]]) NullableTextRowExpression[S, string]

LowerNullable lowercases text using the database collation, propagating SQL NULL.

Example: expr.LowerNullable(input)

func ReplaceNullable

func ReplaceNullable[S any, V, W, X ~string](input RowValue[S, value.Nullable[V]], other RowValue[S, value.Nullable[W]], replacement RowValue[S, value.Nullable[X]]) NullableTextRowExpression[S, string]

ReplaceNullable replaces literal occurrences of its second argument with its third, propagating SQL NULL.

Example: expr.ReplaceNullable(input, other, replacement)

func SubstringAtNullable

func SubstringAtNullable[S any, V ~string, I integerNumber](input RowValue[S, value.Nullable[V]], start, count RowValue[S, I]) NullableTextRowExpression[S, string]

SubstringAtNullable uses typed integer expressions as positions. Database negative-count and SQL-integer overflow errors remain runtime errors. Positions are non-null.

Example: expr.SubstringAtNullable(input, start, count)

func SubstringFromNullable

func SubstringFromNullable[S any, V ~string](input RowValue[S, value.Nullable[V]], start int32) NullableTextRowExpression[S, string]

SubstringFromNullable selects characters using PostgreSQL's one-based positions. Zero/negative starts follow SQL semantics. It selects through the end.

Example: expr.SubstringFromNullable(input, start)

func SubstringNullable

func SubstringNullable[S any, V ~string](input RowValue[S, value.Nullable[V]], start int32, count int32) NullableTextRowExpression[S, string]

SubstringNullable selects characters using PostgreSQL's one-based positions. Zero/negative starts follow SQL semantics. A negative count is rejected before execution.

Example: expr.SubstringNullable(input, start, count)

func TextNullableRow

func TextNullableRow[S any, V ~string](column orm.TextExpressionColumn[S, V, value.Nullable[V]]) NullableTextRowExpression[S, V]

TextNullableRow preserves a nullable text column capability.

Example: expr.TextNullableRow(column)

func TextNullableRowAt

func TextNullableRowAt[S, M any, V ~string](scope Scope[S, M], column orm.TextExpressionColumn[M, V, value.Nullable[V]]) NullableTextRowExpression[S, V]

TextNullableRowAt preserves nullable text in a joined or aliased scope.

Example: expr.TextNullableRowAt(scope, column)

func TextNullableRowValue added in v0.4.0

func TextNullableRowValue[S any, V ~string](v RowValue[S, value.Nullable[V]]) NullableTextRowExpression[S, V]

TextNullableRowValue exposes present-value text comparisons on a nullable row value.

Example: expr.NullableTextIContains(expr.TextNullableRowValue(v), "name")

func TrimCharsNullable

func TrimCharsNullable[S any, V, W ~string](input RowValue[S, value.Nullable[V]], other RowValue[S, value.Nullable[W]]) NullableTextRowExpression[S, string]

TrimCharsNullable removes characters in the second argument from both ends, propagating SQL NULL.

Example: expr.TrimCharsNullable(input, other)

func TrimLeftCharsNullable

func TrimLeftCharsNullable[S any, V, W ~string](input RowValue[S, value.Nullable[V]], other RowValue[S, value.Nullable[W]]) NullableTextRowExpression[S, string]

TrimLeftCharsNullable removes characters in the second argument from the start, propagating SQL NULL.

Example: expr.TrimLeftCharsNullable(input, other)

func TrimLeftNullable

func TrimLeftNullable[S any, V ~string](input RowValue[S, value.Nullable[V]]) NullableTextRowExpression[S, string]

TrimLeftNullable removes ordinary spaces from the start, propagating SQL NULL.

Example: expr.TrimLeftNullable(input)

func TrimNullable

func TrimNullable[S any, V ~string](input RowValue[S, value.Nullable[V]]) NullableTextRowExpression[S, string]

TrimNullable removes ordinary spaces from both ends, propagating SQL NULL.

Example: expr.TrimNullable(input)

func TrimRightCharsNullable

func TrimRightCharsNullable[S any, V, W ~string](input RowValue[S, value.Nullable[V]], other RowValue[S, value.Nullable[W]]) NullableTextRowExpression[S, string]

TrimRightCharsNullable removes characters in the second argument from the end, propagating SQL NULL.

Example: expr.TrimRightCharsNullable(input, other)

func TrimRightNullable

func TrimRightNullable[S any, V ~string](input RowValue[S, value.Nullable[V]]) NullableTextRowExpression[S, string]

TrimRightNullable removes ordinary spaces from the end, propagating SQL NULL.

Example: expr.TrimRightNullable(input)

func UpperNullable

func UpperNullable[S any, V ~string](input RowValue[S, value.Nullable[V]]) NullableTextRowExpression[S, string]

UpperNullable uppercases text using the database collation, propagating SQL NULL.

Example: expr.UpperNullable(input)

type NullableTextValueComparison

type NullableTextValueComparison[S any, V ~string] = nullableTextValueComparison[*S, V]

NullableTextValueComparison retains NULL and compares present text in HAVING.

Example: expr.TextNullableValue(selectedName)

func TextNullableValue

func TextNullableValue[S any, V ~string](v Selected[S, value.Nullable[V]]) NullableTextValueComparison[S, V]

TextNullableValue exposes nullable selected text comparisons.

Example: expr.TextNullableValue(v)

type NullableTextValueFilterAdapter added in v0.3.0

type NullableTextValueFilterAdapter[S any, V ~string] struct {
	// contains filtered or unexported fields
}

NullableTextValueFilterAdapter supplies typed HAVING operations to datatable filters.

Example: expr.NullableTextValueFilter(source)

func NullableTextValueFilter added in v0.3.0

func NullableTextValueFilter[S any, V ~string](source interface {
	TextValueOperand[S, V]
	NullValueOperand[S, V]
}) NullableTextValueFilterAdapter[S, V]

NullableTextValueFilter adapts a selected comparison source without changing scope, value, or phase.

Example: expr.NullableTextValueFilter(source)

func (NullableTextValueFilterAdapter[S, V]) Contains added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) Contains(v V) HavingPredicate[S]

Contains tests a text substring within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) Eq added in v0.3.0

Eq compares equality within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) Gt added in v0.3.0

Gt compares greater than within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) Gte added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) Gte(v V) HavingPredicate[S]

Gte compares greater than or equal within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) IContains added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) IContains(v V) HavingPredicate[S]

IContains tests a text substring without case sensitivity within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) In added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) In(vs ...V) HavingPredicate[S]

In tests membership within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) IsNotNull added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) IsNotNull() HavingPredicate[S]

IsNotNull tests SQL presence within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) IsNull added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) IsNull() HavingPredicate[S]

IsNull tests SQL nullness within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) Like added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) Like(v V) HavingPredicate[S]

Like tests a SQL text pattern within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) Lt added in v0.3.0

Lt compares less than within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) Lte added in v0.3.0

func (a NullableTextValueFilterAdapter[S, V]) Lte(v V) HavingPredicate[S]

Lte compares less than or equal within the adapter's HAVING scope.

func (NullableTextValueFilterAdapter[S, V]) Ne added in v0.3.0

Ne compares inequality within the adapter's HAVING scope.

type NullableValueFilterAdapter added in v0.3.0

type NullableValueFilterAdapter[S any, V any] struct {
	// contains filtered or unexported fields
}

NullableValueFilterAdapter supplies typed HAVING operations to datatable filters.

Example: expr.NullableValueFilter(source)

func NullableValueFilter added in v0.3.0

func NullableValueFilter[S any, V any](source interface {
	ValueOperand[S, V]
	NullValueOperand[S, V]
}) NullableValueFilterAdapter[S, V]

NullableValueFilter adapts a selected comparison source without changing scope, value, or phase.

Example: expr.NullableValueFilter(source)

func (NullableValueFilterAdapter[S, V]) Eq added in v0.3.0

func (a NullableValueFilterAdapter[S, V]) Eq(v V) HavingPredicate[S]

Eq compares equality within the adapter's HAVING scope.

func (NullableValueFilterAdapter[S, V]) In added in v0.3.0

func (a NullableValueFilterAdapter[S, V]) In(vs ...V) HavingPredicate[S]

In tests membership within the adapter's HAVING scope.

func (NullableValueFilterAdapter[S, V]) IsNotNull added in v0.3.0

func (a NullableValueFilterAdapter[S, V]) IsNotNull() HavingPredicate[S]

IsNotNull tests SQL presence within the adapter's HAVING scope.

func (NullableValueFilterAdapter[S, V]) IsNull added in v0.3.0

func (a NullableValueFilterAdapter[S, V]) IsNull() HavingPredicate[S]

IsNull tests SQL nullness within the adapter's HAVING scope.

func (NullableValueFilterAdapter[S, V]) Ne added in v0.3.0

func (a NullableValueFilterAdapter[S, V]) Ne(v V) HavingPredicate[S]

Ne compares inequality within the adapter's HAVING scope.

type Order

type Order[S any] struct {
	// contains filtered or unexported fields
}

Order keeps source ownership on ordering.

Example: expr.Asc(id)

func Asc added in v0.3.0

func Asc[S, V any](e RowValue[S, V]) Order[S]

Asc orders a scoped value ascending.

Example: expr.Asc(e)

func Desc added in v0.3.0

func Desc[S, V any](e RowValue[S, V]) Order[S]

Desc orders a scoped value descending.

Example: expr.Desc(e)

func (Order[S]) NullsFirst

func (o Order[S]) NullsFirst() Order[S]

NullsFirst explicitly sorts SQL NULL before values.

Example: expr.Asc(name).NullsFirst()

func (Order[S]) NullsLast

func (o Order[S]) NullsLast() Order[S]

NullsLast explicitly sorts SQL NULL after values.

Example: expr.Asc(name).NullsLast()

type OrderFilterAdapter added in v0.3.0

type OrderFilterAdapter[S any, V orderedScalar] struct {
	// contains filtered or unexported fields
}

OrderFilterAdapter adapts an ordered row expression for datatable filters.

Example: expr.OrderFilter(age)

func OrderFilter added in v0.3.0

func OrderFilter[S any, V orderedScalar](e OrderedRowExpression[S, V]) OrderFilterAdapter[S, V]

OrderFilter adapts OrderedRowExpression for datatable filters.

Example: expr.OrderFilter(e)

func (OrderFilterAdapter[S, V]) Eq added in v0.3.0

func (a OrderFilterAdapter[S, V]) Eq(v V) Predicate[S]

Eq compares equality within the adapter's row scope.

func (OrderFilterAdapter[S, V]) Gt added in v0.3.0

func (a OrderFilterAdapter[S, V]) Gt(v V) Predicate[S]

Gt compares greater than within the adapter's row scope.

func (OrderFilterAdapter[S, V]) Gte added in v0.3.0

func (a OrderFilterAdapter[S, V]) Gte(v V) Predicate[S]

Gte compares greater than or equal within the adapter's row scope.

func (OrderFilterAdapter[S, V]) In added in v0.3.0

func (a OrderFilterAdapter[S, V]) In(vs ...V) Predicate[S]

In tests membership within the adapter's row scope.

func (OrderFilterAdapter[S, V]) Lt added in v0.3.0

func (a OrderFilterAdapter[S, V]) Lt(v V) Predicate[S]

Lt compares less than within the adapter's row scope.

func (OrderFilterAdapter[S, V]) Lte added in v0.3.0

func (a OrderFilterAdapter[S, V]) Lte(v V) Predicate[S]

Lte compares less than or equal within the adapter's row scope.

func (OrderFilterAdapter[S, V]) Ne added in v0.3.0

func (a OrderFilterAdapter[S, V]) Ne(v V) Predicate[S]

Ne compares inequality within the adapter's row scope.

type OrderValueFilterAdapter added in v0.3.0

type OrderValueFilterAdapter[S any, V orderedScalar] struct {
	// contains filtered or unexported fields
}

OrderValueFilterAdapter supplies typed HAVING operations to datatable filters.

Example: expr.OrderValueFilter(source)

func OrderValueFilter added in v0.3.0

func OrderValueFilter[S any, V orderedScalar](source OrderedValueOperand[S, V]) OrderValueFilterAdapter[S, V]

OrderValueFilter adapts a selected comparison source without changing scope, value, or phase.

Example: expr.OrderValueFilter(source)

func (OrderValueFilterAdapter[S, V]) Eq added in v0.3.0

func (a OrderValueFilterAdapter[S, V]) Eq(v V) HavingPredicate[S]

Eq compares equality within the adapter's HAVING scope.

func (OrderValueFilterAdapter[S, V]) Gt added in v0.3.0

func (a OrderValueFilterAdapter[S, V]) Gt(v V) HavingPredicate[S]

Gt compares greater than within the adapter's HAVING scope.

func (OrderValueFilterAdapter[S, V]) Gte added in v0.3.0

func (a OrderValueFilterAdapter[S, V]) Gte(v V) HavingPredicate[S]

Gte compares greater than or equal within the adapter's HAVING scope.

func (OrderValueFilterAdapter[S, V]) In added in v0.3.0

func (a OrderValueFilterAdapter[S, V]) In(vs ...V) HavingPredicate[S]

In tests membership within the adapter's HAVING scope.

func (OrderValueFilterAdapter[S, V]) Lt added in v0.3.0

func (a OrderValueFilterAdapter[S, V]) Lt(v V) HavingPredicate[S]

Lt compares less than within the adapter's HAVING scope.

func (OrderValueFilterAdapter[S, V]) Lte added in v0.3.0

func (a OrderValueFilterAdapter[S, V]) Lte(v V) HavingPredicate[S]

Lte compares less than or equal within the adapter's HAVING scope.

func (OrderValueFilterAdapter[S, V]) Ne added in v0.3.0

func (a OrderValueFilterAdapter[S, V]) Ne(v V) HavingPredicate[S]

Ne compares inequality within the adapter's HAVING scope.

type OrderedAggregate

type OrderedAggregate[S any, V orderedScalar] = orderedAggregate[*S, V]

OrderedAggregate is an ordered selected aggregate.

Example: expr.GtValue(expr.Count[User](), 1)

func Count

func Count[S any]() OrderedAggregate[S, int64]

Count counts rows including NULL fields; empty input returns zero.

Example: expr.Count[User]()

func CountDistinctField

func CountDistinctField[S any, V, P any](column orm.ExpressionColumn[S, V, P]) OrderedAggregate[S, int64]

CountDistinctField counts non-NULL stored values; empty input is zero.

Example: expr.CountDistinctField(column)

func CountDistinctFieldAt

func CountDistinctFieldAt[S, M any, V, P any](scope Scope[S, M], column orm.ExpressionColumn[M, V, P]) OrderedAggregate[S, int64]

CountDistinctFieldAt counts non-NULL stored values; empty input is zero.

Example: expr.CountDistinctFieldAt(scope, column)

func CountDistinctRow

func CountDistinctRow[S, V any](input RowExpression[S, V]) OrderedAggregate[S, int64]

CountDistinctRow counts non-NULL derived field values, returning zero for empty input.

Example: expr.CountDistinctRow(input)

func CountField

func CountField[S any, V, P any](column orm.ExpressionColumn[S, V, P]) OrderedAggregate[S, int64]

CountField counts non-NULL stored values; empty input is zero.

Example: expr.CountField(column)

func CountFieldAt

func CountFieldAt[S, M any, V, P any](scope Scope[S, M], column orm.ExpressionColumn[M, V, P]) OrderedAggregate[S, int64]

CountFieldAt counts non-NULL stored values; empty input is zero.

Example: expr.CountFieldAt(scope, column)

func CountRow

func CountRow[S, V any](input RowExpression[S, V]) OrderedAggregate[S, int64]

CountRow counts non-NULL derived field values, returning zero for empty input.

Example: expr.CountRow(input)

type OrderedRowExpression

type OrderedRowExpression[S any, V orderedScalar] = orderedRowExpression[*S, V]

OrderedRowExpression is an ordered computed row value.

Example: expr.Gt(expr.Add(a, b), 2)

func Abs

func Abs[S any, V numericValue](input RowValue[S, V]) OrderedRowExpression[S, V]

Abs applies a numeric unary operation to a row value without changing its Go type.

Example: expr.Abs(input)

func Add

func Add[S any, V numericValue](left, right RowValue[S, V]) OrderedRowExpression[S, V]

Add adds two row values with the same owner and concrete numeric type. Arithmetic uses the codec's SQL representation; division by zero and numeric overflow are database errors. Integer division truncates toward zero.

Example: expr.Add(left, right)

func AddClockElapsed

func AddClockElapsed[S any](input RowValue[S, temporal.Time], duration time.Duration) OrderedRowExpression[S, temporal.Time]

AddClockElapsed adds elapsed time to a time of day, wrapping at midnight. Whole microseconds are required.

Example: expr.AddClockElapsed(input, duration)

func AddDateDays

func AddDateDays[S any](input RowValue[S, temporal.Date], days int32) OrderedRowExpression[S, temporal.Date]

AddDateDays adds signed calendar days and retains the date-only result.

Example: expr.AddDateDays(input, days)

func AddDateInterval

func AddDateInterval[S any](input RowValue[S, temporal.Date], interval temporal.Interval) OrderedRowExpression[S, temporal.LocalDateTime]

AddDateInterval adds signed calendar and elapsed components. Database overflow and out-of-contract results remain errors.

Example: expr.AddDateInterval(input, interval)

func AddInstantInterval

func AddInstantInterval[S any, V instantValue](input RowValue[S, V], interval temporal.Interval, zone TimeZone) OrderedRowExpression[S, V]

AddInstantInterval adds signed calendar and elapsed components in the explicit timezone. Database overflow and out-of-contract results remain errors.

Example: expr.AddInstantInterval(input, interval, zone)

func AddIntervals

AddIntervals adds interval components without conflating calendar and elapsed units.

Example: expr.AddIntervals(left, right)

func AddLocalInterval

func AddLocalInterval[S any](input RowValue[S, temporal.LocalDateTime], interval temporal.Interval) OrderedRowExpression[S, temporal.LocalDateTime]

AddLocalInterval adds signed calendar and elapsed components. Database overflow and out-of-contract results remain errors.

Example: expr.AddLocalInterval(input, interval)

func Century

func Century[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Century extracts century from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.Century(input)

func ClockDifference

func ClockDifference[S any](left RowValue[S, temporal.Time], right RowValue[S, temporal.Time]) OrderedRowExpression[S, temporal.Interval]

ClockDifference subtracts clock components without wrapping the signed result at midnight.

Example: expr.ClockDifference(left, right)

func CombineDateTime

func CombineDateTime[S any](date RowValue[S, temporal.Date], clock RowValue[S, temporal.Time]) OrderedRowExpression[S, temporal.LocalDateTime]

CombineDateTime combines a calendar date and time of day without choosing a timezone.

Example: expr.CombineDateTime(date, clock)

func DateDifference

func DateDifference[S any](left RowValue[S, temporal.Date], right RowValue[S, temporal.Date]) OrderedRowExpression[S, int64]

DateDifference returns the signed number of calendar days from right to left.

Example: expr.DateDifference(left, right)

func DateOf

DateOf selects the calendar date from local wall components.

Example: expr.DateOf(input)

func Day

func Day[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Day extracts day from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.Day(input)

func DayOfWeek

func DayOfWeek[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

DayOfWeek extracts dow from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.DayOfWeek(input)

func DayOfYear

func DayOfYear[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

DayOfYear extracts doy from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.DayOfYear(input)

func Decade

func Decade[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Decade extracts decade from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.Decade(input)

func DecimalOf

func DecimalOf[S any, V exactNumber](input RowValue[S, V]) OrderedRowExpression[S, decimal.Decimal]

DecimalOf converts an exact integer/decimal input to SQL numeric; floating input is excluded.

Example: expr.DecimalOf(input)

func Divide

func Divide[S any, V numericValue](left, right RowValue[S, V]) OrderedRowExpression[S, V]

Divide divides two row values with the same owner and concrete numeric type. Arithmetic uses the codec's SQL representation; division by zero and numeric overflow are database errors. Integer division truncates toward zero.

Example: expr.Divide(left, right)

func FloatOf

func FloatOf[S any, V numericValue](input RowValue[S, V]) OrderedRowExpression[S, float64]

FloatOf explicitly converts a numeric input to approximate double precision.

Example: expr.FloatOf(input)

func FromUnixMillis

func FromUnixMillis[S any, V integerNumber](input RowValue[S, V]) OrderedRowExpression[S, temporal.DateTime]

FromUnixMillis converts exact integer Unix milliseconds to a UTC instant without floating-point epoch rounding.

Example: expr.FromUnixMillis(input)

func Hour

func Hour[S any, V clockValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Hour extracts the hour from a time or local date-time. Use LocalAt to select an instant's timezone first.

Example: expr.Hour(input)

func ISODayOfWeek

func ISODayOfWeek[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

ISODayOfWeek extracts isodow from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.ISODayOfWeek(input)

func ISOWeek

func ISOWeek[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

ISOWeek extracts week from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.ISOWeek(input)

func ISOYear

func ISOYear[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

ISOYear extracts isoyear from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.ISOYear(input)

func InstantDifference

func InstantDifference[S any, L, R instantValue](left RowValue[S, L], right RowValue[S, R]) OrderedRowExpression[S, temporal.Interval]

InstantDifference subtracts instants using PostgreSQL's 24-hour-day interval normalization.

Example: expr.InstantDifference(left, right)

func IntervalDays

func IntervalDays[S any](input RowValue[S, temporal.Interval]) OrderedRowExpression[S, int32]

IntervalDays returns the signed calendar-day component.

Example: expr.IntervalDays(input)

func IntervalElapsed

func IntervalElapsed[S any](input RowValue[S, temporal.Interval]) OrderedRowExpression[S, time.Duration]

IntervalElapsed returns the elapsed component as a Go duration, excluding months and days.

Example: expr.IntervalElapsed(input)

func IntervalMonths

func IntervalMonths[S any](input RowValue[S, temporal.Interval]) OrderedRowExpression[S, int32]

IntervalMonths returns the complete signed month component, including whole years.

Example: expr.IntervalMonths(input)

func JulianDay

func JulianDay[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, decimal.Decimal]

JulianDay returns the Julian day, including a fractional day for local date-times. Use LocalAt to select an instant's timezone first.

Example: expr.JulianDay(input)

func Length

func Length[S any, V ~string](input RowValue[S, V]) OrderedRowExpression[S, int64]

Length counts Unicode characters rather than encoded bytes.

Example: expr.Length(input)

func LocalAt

func LocalAt[S any, V instantValue](input RowValue[S, V], zone TimeZone) OrderedRowExpression[S, temporal.LocalDateTime]

LocalAt converts an instant to wall components in the explicitly selected zone.

Example: expr.LocalAt(input, zone)

func LocalDifference

LocalDifference subtracts local date-times using PostgreSQL's normalized interval result.

Example: expr.LocalDifference(left, right)

func Microseconds

func Microseconds[S any, V clockValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Microseconds returns the whole seconds component multiplied by 1000000 plus its fractional microseconds. Use LocalAt to select an instant's timezone first.

Example: expr.Microseconds(input)

func Millennium

func Millennium[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Millennium extracts millennium from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.Millennium(input)

func Milliseconds

func Milliseconds[S any, V clockValue](input RowValue[S, V]) OrderedRowExpression[S, decimal.Decimal]

Milliseconds returns the seconds component multiplied by 1000, including fractional milliseconds. Use LocalAt to select an instant's timezone first.

Example: expr.Milliseconds(input)

func Minute

func Minute[S any, V clockValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Minute extracts the minute from a time or local date-time. Use LocalAt to select an instant's timezone first.

Example: expr.Minute(input)

func Month

func Month[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Month extracts month from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.Month(input)

func Multiply

func Multiply[S any, V numericValue](left, right RowValue[S, V]) OrderedRowExpression[S, V]

Multiply multiplies two row values with the same owner and concrete numeric type. Arithmetic uses the codec's SQL representation; division by zero and numeric overflow are database errors. Integer division truncates toward zero.

Example: expr.Multiply(left, right)

func Negate

func Negate[S any, V numericValue](input RowValue[S, V]) OrderedRowExpression[S, V]

Negate applies a numeric unary operation to a row value without changing its Go type.

Example: expr.Negate(input)

func NegateInterval

func NegateInterval[S any](input RowValue[S, temporal.Interval]) OrderedRowExpression[S, temporal.Interval]

NegateInterval negates all interval components; database overflow remains an execution error.

Example: expr.NegateInterval(input)

func OctetLength

func OctetLength[S any, V ~string](input RowValue[S, V]) OrderedRowExpression[S, int64]

OctetLength counts encoded bytes.

Example: expr.OctetLength(input)

func OrderRow

func OrderRow[S any, V orderedScalar](v RowValue[S, V]) OrderedRowExpression[S, V]

OrderRow exposes ordered comparisons on a row value.

Example: expr.OrderRow(v)

func Quarter

func Quarter[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Quarter extracts quarter from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.Quarter(input)

func Remainder

func Remainder[S any, V exactNumber](left, right RowValue[S, V]) OrderedRowExpression[S, V]

Remainder takes the remainder of two row values with the same owner and concrete numeric type. Arithmetic uses the codec's SQL representation; division by zero and numeric overflow are database errors. Integer division truncates toward zero.

Example: expr.Remainder(left, right)

func ResolveLocal

ResolveLocal uses the explicitly selected PostgreSQL DST resolution policy. It differs from the uniqueness checks in temporal.LocalDateTime.In.

Example: expr.ResolveLocal(input, zone, policy)

func Second

func Second[S any, V clockValue](input RowValue[S, V]) OrderedRowExpression[S, decimal.Decimal]

Second returns the exact seconds component, including fractional seconds, from a time or local date-time. Use LocalAt to select an instant's timezone first.

Example: expr.Second(input)

func ShiftDate

ShiftDate adds a typed interval expression to a date, returning local date-time components.

Example: expr.ShiftDate(input, interval)

func ShiftInstant

func ShiftInstant[S any, V instantValue](input RowValue[S, V], interval RowValue[S, temporal.Interval], zone TimeZone) OrderedRowExpression[S, V]

ShiftInstant adds a typed interval expression in an explicit timezone, preserving the instant's Go type.

Example: expr.ShiftInstant(input, interval, zone)

func ShiftLocal

ShiftLocal adds a typed interval expression to local date-time components.

Example: expr.ShiftLocal(input, interval)

func SphericalDistance

func SphericalDistance[S any, V numericValue](latitude, longitude RowValue[S, V], origin GeographicPoint) OrderedRowExpression[S, float64]

SphericalDistance returns great-circle metres on the IUGG mean-radius sphere (6371008.8 m). Stored coordinates must be valid degrees. This is straight-line surface distance, not a route estimate. The expression retains its row owner.

Example: expr.SphericalDistance(latitude, longitude, origin)

func Subtract

func Subtract[S any, V numericValue](left, right RowValue[S, V]) OrderedRowExpression[S, V]

Subtract subtracts two row values with the same owner and concrete numeric type. Arithmetic uses the codec's SQL representation; division by zero and numeric overflow are database errors. Integer division truncates toward zero.

Example: expr.Subtract(left, right)

func SubtractClockElapsed

func SubtractClockElapsed[S any](input RowValue[S, temporal.Time], duration time.Duration) OrderedRowExpression[S, temporal.Time]

SubtractClockElapsed subtracts elapsed time from a time of day, wrapping at midnight. Whole microseconds are required.

Example: expr.SubtractClockElapsed(input, duration)

func SubtractDateInterval

func SubtractDateInterval[S any](input RowValue[S, temporal.Date], interval temporal.Interval) OrderedRowExpression[S, temporal.LocalDateTime]

SubtractDateInterval subtracts signed calendar and elapsed components. Database overflow and out-of-contract results remain errors.

Example: expr.SubtractDateInterval(input, interval)

func SubtractInstantInterval

func SubtractInstantInterval[S any, V instantValue](input RowValue[S, V], interval temporal.Interval, zone TimeZone) OrderedRowExpression[S, V]

SubtractInstantInterval subtracts signed calendar and elapsed components in the explicit timezone. Database overflow and out-of-contract results remain errors.

Example: expr.SubtractInstantInterval(input, interval, zone)

func SubtractIntervals

func SubtractIntervals[S any](left RowValue[S, temporal.Interval], right RowValue[S, temporal.Interval]) OrderedRowExpression[S, temporal.Interval]

SubtractIntervals subtracts interval components without conflating calendar and elapsed units.

Example: expr.SubtractIntervals(left, right)

func SubtractLocalInterval

func SubtractLocalInterval[S any](input RowValue[S, temporal.LocalDateTime], interval temporal.Interval) OrderedRowExpression[S, temporal.LocalDateTime]

SubtractLocalInterval subtracts signed calendar and elapsed components. Database overflow and out-of-contract results remain errors.

Example: expr.SubtractLocalInterval(input, interval)

func TimeOf

TimeOf selects the time of day from local wall components.

Example: expr.TimeOf(input)

func TransactionTime

func TransactionTime[S, M any](scope Scope[S, M]) OrderedRowExpression[S, temporal.DateTime]

TransactionTime returns PostgreSQL's transaction start instant. It is stable throughout a transaction and does not use the application's test clock.

Example: expr.TransactionTime(scope)

func TruncateDate

func TruncateDate[S any](input RowValue[S, temporal.Date], unit DateUnit) OrderedRowExpression[S, temporal.Date]

TruncateDate truncates a calendar date without introducing a timezone.

Example: expr.TruncateDate(input, unit)

func TruncateInstant

func TruncateInstant[S any, V instantValue](input RowValue[S, V], unit TimestampUnit, zone TimeZone) OrderedRowExpression[S, V]

TruncateInstant truncates an instant in the explicit zone while preserving its Go type.

Example: expr.TruncateInstant(input, unit, zone)

func TruncateLocal

TruncateLocal truncates local wall components without interpreting them as an instant.

Example: expr.TruncateLocal(input, unit)

func UnixMilliseconds

func UnixMilliseconds[S any, V instantValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

UnixMilliseconds returns integer milliseconds since the Unix epoch. Fractional milliseconds round down, matching time.Time.UnixMilli before epoch.

Example: expr.UnixMilliseconds(input)

func UnixSeconds

func UnixSeconds[S any, V instantValue](input RowValue[S, V]) OrderedRowExpression[S, decimal.Decimal]

UnixSeconds returns exact decimal seconds since the Unix epoch for an instant.

Example: expr.UnixSeconds(input)

func Year

func Year[S any, V calendarValue](input RowValue[S, V]) OrderedRowExpression[S, int64]

Year extracts year from a typed row value. Calendar and clock components require a date/local value; use LocalAt for an instant's zone.

Example: expr.Year(input)

type OrderedRowValue added in v0.3.0

type OrderedRowValue[S, V any] interface {
	RowValue[S, V]
	// contains filtered or unexported methods
}

OrderedRowValue is a sealed row value with ordered comparison capability. Use OrderRow or OrderNullableRow to opt a general row value into this capability.

Example: var operand expr.OrderedRowValue[User, int64] = expr.OrderRow(age)

type OrderedScalar

type OrderedScalar interface {
	// contains filtered or unexported methods
}

OrderedScalar is the shared ordered row-value constraint.

Example: func less[V expr.OrderedScalar](v V) V { return v }

type OrderedValueComparison

type OrderedValueComparison[S any, V orderedScalar] = orderedValueComparison[*S, V]

OrderedValueComparison compares ordered selected values.

Example: expr.GtValue(expr.OrderValue(selected), value)

func OrderValue

func OrderValue[S any, V orderedScalar](v Selected[S, V]) OrderedValueComparison[S, V]

OrderValue exposes ordered comparisons for a selected value.

Example: expr.OrderValue(v)

type OrderedValueOperand added in v0.3.0

type OrderedValueOperand[S, V any] interface {
	ValueOperand[S, V]
	// contains filtered or unexported methods
}

OrderedValueOperand supplies ordered literal comparisons in HAVING.

Example: var source expr.OrderedValueOperand[User, int64] = expr.Count[User]()

type ParamSource added in v0.3.0

type ParamSource[S, V any] interface {
	// contains filtered or unexported methods
}

ParamSource supplies a scoped codec for an exact parameter type.

Example: var source expr.ParamSource[User, int64] = expr.Count[User]()

type Predicate

type Predicate[S any] = predicate[*S]

Predicate keeps source ownership on a SQL condition.

Example: expr.Eq(tenant, 7)

func And

func And[S any](ps ...Predicate[S]) Predicate[S]

And combines conditions within one source scope.

Example: expr.And(ps...)

func DistinctFrom

func DistinctFrom[S any, V any](left, right RowValue[S, V]) Predicate[S]

DistinctFrom compares unequal values while treating NULL as a comparable value. Both row operands retain the same scope and Go type, including nullability.

Example: expr.DistinctFrom(left, right)

func Eq added in v0.3.0

func Eq[S, V any](e RowValue[S, V], v V) Predicate[S]

Eq compares a row value.

Example: expr.Eq(e, v)

func Equal

func Equal[S any, V any](left, right RowValue[S, V]) Predicate[S]

Equal compares equal SQL values; NULL makes the condition unknown. Both row operands retain the same scope and Go type, including nullability.

Example: expr.Equal(left, right)

func FoundryPredicateValue

func FoundryPredicateValue[S any](core ormcore.Predicate, seal sqlowner.ExpressionSeal) Predicate[S]

FoundryPredicateValue constructs a validated scoped SQL condition.

Example: expr.FoundryPredicateValue[User](core, seal)

func Greater

func Greater[S any, V orderedScalar](left, right RowValue[S, V]) Predicate[S]

Greater compares ordered SQL values using >. Both row operands retain the same scope and Go type, including nullability.

Example: expr.Greater(left, right)

func GreaterColumn

func GreaterColumn[M, V, P any, L orderedColumn[M, V, P], R orderedColumn[M, V, P]](left L, right R) Predicate[M]

GreaterColumn compares same-owner ordered stored columns; enums lack this capability.

Example: expr.GreaterColumn(left, right)

func GreaterNullable

func GreaterNullable[S any, V orderedScalar](left, right RowValue[S, value.Nullable[V]]) Predicate[S]

GreaterNullable compares nullable operands without removing SQL NULL. Widen non-null inputs explicitly with NullableRow.

Example: expr.GreaterNullable(left, right)

func GreaterOrEqual

func GreaterOrEqual[S any, V orderedScalar](left, right RowValue[S, V]) Predicate[S]

GreaterOrEqual compares ordered SQL values using >=. Both row operands retain the same scope and Go type, including nullability.

Example: expr.GreaterOrEqual(left, right)

func GreaterOrEqualNullable

func GreaterOrEqualNullable[S any, V orderedScalar](left, right RowValue[S, value.Nullable[V]]) Predicate[S]

GreaterOrEqualNullable compares nullable operands without removing SQL NULL. Widen non-null inputs explicitly with NullableRow.

Example: expr.GreaterOrEqualNullable(left, right)

func Gt added in v0.3.0

func Gt[S any, V orderedScalar](e OrderedRowValue[S, V], v V) Predicate[S]

Gt compares row values before grouping.

Example: expr.Gt(e, v)

func Gte added in v0.3.0

func Gte[S any, V orderedScalar](e OrderedRowValue[S, V], v V) Predicate[S]

Gte compares row values before grouping.

Example: expr.Gte(e, v)

func Has

func Has[M, N any](r orm.ExistenceRelation[M, N], ps ...Predicate[N]) Predicate[M]

Has lifts row filters through a scoped relation EXISTS.

Example: expr.Has(r, ps...)

func In added in v0.3.0

func In[S, V any](e RowValue[S, V], vs ...V) Predicate[S]

In tests membership.

Example: expr.In(e, vs...)

func IsNotNull added in v0.3.0

func IsNotNull[S, V any](e RowValue[S, V]) Predicate[S]

IsNotNull tests SQL presence on a nullable expression.

Example: expr.IsNotNull(e)

func IsNull added in v0.3.0

func IsNull[S, V any](e RowValue[S, V]) Predicate[S]

IsNull tests SQL nullness on a nullable expression.

Example: expr.IsNull(e)

func Less

func Less[S any, V orderedScalar](left, right RowValue[S, V]) Predicate[S]

Less compares ordered SQL values using <. Both row operands retain the same scope and Go type, including nullability.

Example: expr.Less(left, right)

func LessNullable

func LessNullable[S any, V orderedScalar](left, right RowValue[S, value.Nullable[V]]) Predicate[S]

LessNullable compares nullable operands without removing SQL NULL. Widen non-null inputs explicitly with NullableRow.

Example: expr.LessNullable(left, right)

func LessOrEqual

func LessOrEqual[S any, V orderedScalar](left, right RowValue[S, V]) Predicate[S]

LessOrEqual compares ordered SQL values using <=. Both row operands retain the same scope and Go type, including nullability.

Example: expr.LessOrEqual(left, right)

func LessOrEqualNullable

func LessOrEqualNullable[S any, V orderedScalar](left, right RowValue[S, value.Nullable[V]]) Predicate[S]

LessOrEqualNullable compares nullable operands without removing SQL NULL. Widen non-null inputs explicitly with NullableRow.

Example: expr.LessOrEqualNullable(left, right)

func Like

func Like[S any, V ~string](left, right RowValue[S, V]) Predicate[S]

Like matches a typed SQL LIKE pattern; wildcard characters are intentional. Both row operands retain the same scope and Go type, including nullability.

Example: expr.Like(left, right)

func LikeNullable

func LikeNullable[S any, V ~string](left, right RowValue[S, value.Nullable[V]]) Predicate[S]

LikeNullable compares nullable operands without removing SQL NULL. Widen non-null inputs explicitly with NullableRow.

Example: expr.LikeNullable(left, right)

func Lt added in v0.3.0

func Lt[S any, V orderedScalar](e OrderedRowValue[S, V], v V) Predicate[S]

Lt compares row values before grouping.

Example: expr.Lt(e, v)

func Lte added in v0.3.0

func Lte[S any, V orderedScalar](e OrderedRowValue[S, V], v V) Predicate[S]

Lte compares row values before grouping.

Example: expr.Lte(e, v)

func ModelPredicate

func ModelPredicate[M any](p orm.Predicate[M]) Predicate[M]

ModelPredicate adapts a model condition without discarding its declaration owner.

Example: expr.ModelPredicate(p)

func Ne added in v0.3.0

func Ne[S, V any](e RowValue[S, V], v V) Predicate[S]

Ne excludes a row value.

Example: expr.Ne(e, v)

func Not

func Not[S any](p Predicate[S]) Predicate[S]

Not negates a row condition while preserving SQL NULL semantics.

Example: expr.Not(p)

func NotDistinctFrom

func NotDistinctFrom[S any, V any](left, right RowValue[S, V]) Predicate[S]

NotDistinctFrom compares equal values while treating NULL as a comparable value. Both row operands retain the same scope and Go type, including nullability.

Example: expr.NotDistinctFrom(left, right)

func NotEqual

func NotEqual[S any, V any](left, right RowValue[S, V]) Predicate[S]

NotEqual compares unequal SQL values; NULL makes the condition unknown. Both row operands retain the same scope and Go type, including nullability.

Example: expr.NotEqual(left, right)

func NullableEq added in v0.3.0

func NullableEq[S, V any](e RowValue[S, value.Nullable[V]], v V) Predicate[S]

NullableEq compares a nullable row value with a present value.

Example: expr.NullableEq(e, v)

func NullableGt added in v0.3.0

func NullableGt[S any, V orderedScalar](e OrderedRowValue[S, value.Nullable[V]], v V) Predicate[S]

NullableGt compares nullable row values with a present value.

Example: expr.NullableGt(e, v)

func NullableGte added in v0.3.0

func NullableGte[S any, V orderedScalar](e OrderedRowValue[S, value.Nullable[V]], v V) Predicate[S]

NullableGte compares nullable row values with a present value.

Example: expr.NullableGte(e, v)

func NullableIn added in v0.3.0

func NullableIn[S, V any](e RowValue[S, value.Nullable[V]], vs ...V) Predicate[S]

NullableIn tests membership of a present value in a nullable row value.

Example: expr.NullableIn(e, vs...)

func NullableLt added in v0.3.0

func NullableLt[S any, V orderedScalar](e OrderedRowValue[S, value.Nullable[V]], v V) Predicate[S]

NullableLt compares nullable row values with a present value.

Example: expr.NullableLt(e, v)

func NullableLte added in v0.3.0

func NullableLte[S any, V orderedScalar](e OrderedRowValue[S, value.Nullable[V]], v V) Predicate[S]

NullableLte compares nullable row values with a present value.

Example: expr.NullableLte(e, v)

func NullableNe added in v0.3.0

func NullableNe[S, V any](e RowValue[S, value.Nullable[V]], v V) Predicate[S]

NullableNe excludes a present value from a nullable row value.

Example: expr.NullableNe(e, v)

func NullableTextContains added in v0.3.0

func NullableTextContains[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextContains compares nullable text using the database collation.

Example: expr.NullableTextContains(e, v)

func NullableTextEndsWith added in v0.3.0

func NullableTextEndsWith[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextEndsWith compares nullable text using the database collation.

Example: expr.NullableTextEndsWith(e, v)

func NullableTextIContains added in v0.3.0

func NullableTextIContains[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextIContains compares nullable text using the database collation.

Example: expr.NullableTextIContains(e, v)

func NullableTextIEndsWith added in v0.3.0

func NullableTextIEndsWith[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextIEndsWith compares nullable text using the database collation.

Example: expr.NullableTextIEndsWith(e, v)

func NullableTextILike added in v0.3.0

func NullableTextILike[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextILike compares nullable text using the database collation.

Example: expr.NullableTextILike(e, v)

func NullableTextIStartsWith added in v0.3.0

func NullableTextIStartsWith[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextIStartsWith compares nullable text using the database collation.

Example: expr.NullableTextIStartsWith(e, v)

func NullableTextLike added in v0.3.0

func NullableTextLike[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextLike compares nullable text using the database collation.

Example: expr.NullableTextLike(e, v)

func NullableTextStartsWith added in v0.3.0

func NullableTextStartsWith[S any, V ~string](e NullableTextRowExpression[S, V], v V) Predicate[S]

NullableTextStartsWith compares nullable text using the database collation.

Example: expr.NullableTextStartsWith(e, v)

func Or

func Or[S any](ps ...Predicate[S]) Predicate[S]

Or combines row conditions without admitting HAVING predicates.

Example: expr.Or(ps...)

func TextContains added in v0.3.0

func TextContains[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextContains compares typed text using the database collation.

Example: expr.TextContains(e, v)

func TextEndsWith added in v0.3.0

func TextEndsWith[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextEndsWith compares typed text using the database collation.

Example: expr.TextEndsWith(e, v)

func TextIContains added in v0.3.0

func TextIContains[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextIContains compares typed text using the database collation.

Example: expr.TextIContains(e, v)

func TextIEndsWith added in v0.3.0

func TextIEndsWith[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextIEndsWith compares typed text using the database collation.

Example: expr.TextIEndsWith(e, v)

func TextILike added in v0.3.0

func TextILike[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextILike compares typed text using the database collation.

Example: expr.TextILike(e, v)

func TextIStartsWith added in v0.3.0

func TextIStartsWith[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextIStartsWith compares typed text using the database collation.

Example: expr.TextIStartsWith(e, v)

func TextLike added in v0.3.0

func TextLike[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextLike compares typed text using the database collation.

Example: expr.TextLike(e, v)

func TextStartsWith added in v0.3.0

func TextStartsWith[S any, V ~string](e TextRowExpression[S, V], v V) Predicate[S]

TextStartsWith compares typed text using the database collation.

Example: expr.TextStartsWith(e, v)

func UUIDGreater

func UUIDGreater[S, T any](input RowValue[S, model.ID[T]], v model.ID[T]) Predicate[S]

UUIDGreater retains expression scope and UUID ownership.

Example: expr.UUIDGreater(input, v)

func UUIDGreaterNullable

func UUIDGreaterNullable[S, T any](input RowValue[S, value.Nullable[model.ID[T]]], v model.ID[T]) Predicate[S]

UUIDGreaterNullable compares a present UUID, leaving SQL NULL unmatched.

Example: expr.UUIDGreaterNullable(input, v)

func UUIDGreaterOrEqual

func UUIDGreaterOrEqual[S, T any](input RowValue[S, model.ID[T]], v model.ID[T]) Predicate[S]

UUIDGreaterOrEqual retains expression scope and UUID ownership.

Example: expr.UUIDGreaterOrEqual(input, v)

func UUIDGreaterOrEqualNullable

func UUIDGreaterOrEqualNullable[S, T any](input RowValue[S, value.Nullable[model.ID[T]]], v model.ID[T]) Predicate[S]

UUIDGreaterOrEqualNullable compares a present UUID, leaving SQL NULL unmatched.

Example: expr.UUIDGreaterOrEqualNullable(input, v)

func UUIDLess

func UUIDLess[S, T any](input RowValue[S, model.ID[T]], v model.ID[T]) Predicate[S]

UUIDLess retains expression scope and UUID ownership.

Example: expr.UUIDLess(input, v)

func UUIDLessNullable

func UUIDLessNullable[S, T any](input RowValue[S, value.Nullable[model.ID[T]]], v model.ID[T]) Predicate[S]

UUIDLessNullable compares a present UUID, leaving SQL NULL unmatched.

Example: expr.UUIDLessNullable(input, v)

func UUIDLessOrEqual

func UUIDLessOrEqual[S, T any](input RowValue[S, model.ID[T]], v model.ID[T]) Predicate[S]

UUIDLessOrEqual retains expression scope and UUID ownership.

Example: expr.UUIDLessOrEqual(input, v)

func UUIDLessOrEqualNullable

func UUIDLessOrEqualNullable[S, T any](input RowValue[S, value.Nullable[model.ID[T]]], v model.ID[T]) Predicate[S]

UUIDLessOrEqualNullable compares a present UUID, leaving SQL NULL unmatched.

Example: expr.UUIDLessOrEqualNullable(input, v)

type ProjectionKey

type ProjectionKey[S any] = projectionKey[*S]

ProjectionKey is a selected-phase key; it cannot enter GROUP BY.

Example: expr.Key(expr.AsSelected(expr.Count[User]()))

func Key added in v0.3.0

func Key[S, V any](e Selected[S, V]) ProjectionKey[S]

Key constructs a selected key while preserving source ownership.

Example: expr.Key(expr.AsSelected(expr.Count[User]()))

type ProjectionOrder

type ProjectionOrder[S any] interface {
	// contains filtered or unexported methods
}

ProjectionOrder accepts row or selected ordering in a read-only rows query.

Example: rows.OrderBy(q, expr.DescValue(count))

type RangeBoundary

type RangeBoundary[S, D any] struct {
	// contains filtered or unexported fields
}

RangeBoundary retains scope and distance type.

Example: r.Preceding(2)

type RangeWindow

type RangeWindow[S, D any] struct {
	// contains filtered or unexported fields
}

RangeWindow fixes one order value and its typed distance.

Example: expr.NumericRange(w, expr.AsSelected(expr.Row(amount)))

func NullableNumericRange

func NullableNumericRange[S any, V numericValue](w Window[S], input Selected[S, value.Nullable[V]]) RangeWindow[S, V]

NullableNumericRange orders nullable values using present distances.

Example: expr.NullableNumericRange(w, input)

func NullableTemporalRange

func NullableTemporalRange[S any, V rangeTemporal](w Window[S], input Selected[S, value.Nullable[V]]) RangeWindow[S, temporal.Interval]

NullableTemporalRange keeps nullable ordering and present interval distances.

Example: expr.NullableTemporalRange(w, input)

func NumericRange

func NumericRange[S any, V numericValue](w Window[S], input Selected[S, V]) RangeWindow[S, V]

NumericRange uses the order value's exact numeric type for distances.

Example: expr.NumericRange(w, input)

func TemporalRange

func TemporalRange[S any, V rangeTemporal](w Window[S], input Selected[S, V]) RangeWindow[S, temporal.Interval]

TemporalRange uses calendar/elapsed intervals for temporal distances.

Example: expr.TemporalRange(w, input)

func (RangeWindow[S, D]) Asc

func (r RangeWindow[S, D]) Asc() RangeWindow[S, D]

Asc orders RANGE values ascending.

Example: r.Asc()

func (RangeWindow[S, D]) Between

func (r RangeWindow[S, D]) Between(start, end RangeBoundary[S, D]) Window[S]

Between completes the frame; preexisting window ordering is invalid.

Example: r.Between(r.Preceding(2), r.CurrentRow())

func (RangeWindow[S, D]) CurrentRow

func (r RangeWindow[S, D]) CurrentRow() RangeBoundary[S, D]

CurrentRow identifies the current peers.

Example: r.CurrentRow()

func (RangeWindow[S, D]) Desc

func (r RangeWindow[S, D]) Desc() RangeWindow[S, D]

Desc orders RANGE values descending.

Example: r.Desc()

func (RangeWindow[S, D]) Following

func (r RangeWindow[S, D]) Following(v D) RangeBoundary[S, D]

Following captures a nonnegative finite distance once.

Example: r.Following(2)

func (RangeWindow[S, D]) Preceding

func (r RangeWindow[S, D]) Preceding(v D) RangeBoundary[S, D]

Preceding captures a nonnegative finite distance once.

Example: r.Preceding(2)

func (RangeWindow[S, D]) UnboundedFollowing

func (r RangeWindow[S, D]) UnboundedFollowing() RangeBoundary[S, D]

UnboundedFollowing identifies the last partition row.

Example: r.UnboundedFollowing()

func (RangeWindow[S, D]) UnboundedPreceding

func (r RangeWindow[S, D]) UnboundedPreceding() RangeBoundary[S, D]

UnboundedPreceding identifies the first partition row.

Example: r.UnboundedPreceding()

type RowComparison

type RowComparison[S, V any] = rowComparison[*S, V]

RowComparison exposes only equality and membership, including for enums.

Example: expr.In(expr.CompareRow(expr.Value(orm.EnumExpr(Users.State))), Active, Pending)

func CompareRow

func CompareRow[S, V any](e Expression[S, V, V]) RowComparison[S, V]

CompareRow preserves a required column expression without adding ordered or text capabilities.

Example: expr.CompareRow(e)

type RowExpression

type RowExpression[S, V any] = rowExpression[*S, V]

RowExpression is a computed row value with exact owner and result types.

Example: expr.Param(orm.NumberExpr(Users.Age), 2)

func Coalesce

func Coalesce[S, V any](first RowValue[S, value.Nullable[V]], fallback RowValue[S, V]) RowExpression[S, V]

Coalesce removes nullability with a required fallback of the same owner/type.

Example: expr.Coalesce(first, fallback)

func CoalesceNullable

func CoalesceNullable[S, V any](first RowValue[S, value.Nullable[V]], rest ...RowValue[S, value.Nullable[V]]) RowExpression[S, value.Nullable[V]]

CoalesceNullable retains one nullable layer when all inputs may be NULL.

Example: expr.CoalesceNullable(first, rest...)

func Constant

func Constant[S, V any](c codec.Codec[V], v V) RowExpression[S, V]

Constant snapshots a bound value using its explicit codec, without an exemplar column.

Example: expr.Constant[User](c, v)

func FoundryRowExpression

func FoundryRowExpression[S, V any](core ormcore.Expression, column ormcore.Column[V], seal sqlowner.ExpressionSeal) RowExpression[S, V]

FoundryRowExpression constructs a validated row-phase SQL value.

Example: expr.FoundryRowExpression[User](core, column, seal)

func JSONContainedBy

func JSONContainedBy[S, P any](left, right RowValue[S, value.JSON[P]]) RowExpression[S, bool]

JSONContainedBy evaluates JSON containment between identical payloads in the row phase.

Example: expr.JSONContainedBy(left, right)

func JSONContainedByNullable

func JSONContainedByNullable[S, P any](left, right RowValue[S, value.Nullable[value.JSON[P]]]) RowExpression[S, value.Nullable[bool]]

JSONContainedByNullable evaluates JSON containment between identical payloads in the row phase; SQL NULL propagates.

Example: expr.JSONContainedByNullable(left, right)

func JSONContains

func JSONContains[S, P any](left, right RowValue[S, value.JSON[P]]) RowExpression[S, bool]

JSONContains evaluates JSON containment between identical payloads in the row phase.

Example: expr.JSONContains(left, right)

func JSONContainsNullable

func JSONContainsNullable[S, P any](left, right RowValue[S, value.Nullable[value.JSON[P]]]) RowExpression[S, value.Nullable[bool]]

JSONContainsNullable evaluates JSON containment between identical payloads in the row phase; SQL NULL propagates.

Example: expr.JSONContainsNullable(left, right)

func JSONScalar

func JSONScalar[S, P any](path JSONPath[S, P], c codec.Codec[P]) RowExpression[S, value.Nullable[P]]

JSONScalar uses the exact payload codec. Missing paths and JSON null become SQL NULL.

Example: expr.JSONScalar(path, c)

func JSONType

func JSONType[S, P any](input RowValue[S, value.JSON[P]]) RowExpression[S, database.JSONKind]

JSONType evaluates JSON shape or safe array length in the row phase.

Example: expr.JSONType(input)

func JSONTypeNullable

func JSONTypeNullable[S, P any](input RowValue[S, value.Nullable[value.JSON[P]]]) RowExpression[S, value.Nullable[database.JSONKind]]

JSONTypeNullable evaluates JSON shape or safe array length in the row phase; SQL NULL propagates.

Example: expr.JSONTypeNullable(input)

func NullIf

func NullIf[S, V any](first, second RowValue[S, V]) RowExpression[S, value.Nullable[V]]

NullIf adds one nullable layer to matching required row values.

Example: expr.NullIf(first, second)

func NullIfNullable

func NullIfNullable[S, V any](first, second RowValue[S, value.Nullable[V]]) RowExpression[S, value.Nullable[V]]

NullIfNullable compares nullable row values while retaining one nullable layer.

Example: expr.NullIfNullable(first, second)

func NullableRow

func NullableRow[S, V any](v RowValue[S, V]) RowExpression[S, value.Nullable[V]]

NullableRow explicitly widens a row value by one nullable layer.

Example: expr.NullableRow(v)

func Param

func Param[S, V, P any](column orm.ExpressionColumn[S, V, P], v V) RowExpression[S, V]

Param snapshots a bound non-null value using a column's comparison codec.

Example: expr.Param(column, v)

func ParamOf added in v0.3.0

func ParamOf[S, V any](source ParamSource[S, V], v V) RowExpression[S, V]

ParamOf snapshots a bound value using a scoped expression's codec without evaluating it. A nullable aggregate supplies its present-value codec for fallback parameters.

Example: expr.ParamOf(expr.Count[User](), int64(0))

func RelatedValue

func RelatedValue[M, N, V any](source orm.AggregateSource[M, N], computation AggregateExpression[N, V]) RowExpression[M, V]

RelatedValue computes a relation aggregate per parent without a model slot. The aggregate keeps its own nullability: COUNT is present, an empty SUM is NULL.

Example: expr.RelatedValue(source, computation)

func Row

func Row[S, V any](v RowValue[S, V]) RowExpression[S, V]

Row adapts a row-phase value without changing its scope or projection type.

Example: expr.Row(v)

type RowValue

type RowValue[S, V any] interface {
	// contains filtered or unexported methods
}

RowValue is a sealed value evaluated before grouping.

Example: expr.Add(expr.Value(orm.NumberExpr(Users.Age)), expr.Value(orm.NumberExpr(Users.Age)))

type Scope

type Scope[S, M any] struct {
	// contains filtered or unexported fields
}

Scope keeps a model M inside source S.

Example: rows.Scope(members)

func FoundryScope

func FoundryScope[S, M any](core ormcore.Scope, seal sqlowner.ExpressionSeal) Scope[S, M]

FoundryScope constructs a sealed scope for rows.

Example: expr.FoundryScope[User, User](core, seal)

type SelectSource added in v0.3.0

type SelectSource[S, V any] interface {
	// contains filtered or unexported methods
}

SelectSource is a sealed row or aggregate value that can enter the selected phase.

Example: var source expr.SelectSource[User, int64] = expr.Count[User]()

type Selected

type Selected[S, V any] = selected[*S, V]

Selected is a selected-phase value; it cannot become a row predicate.

Example: expr.AsSelected(expr.Count[User]())

func AbsNullableValue

func AbsNullableValue[S any, V numericValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

AbsNullableValue applies Abs to a selected nullable value.

Example: expr.AbsNullableValue(input)

func AbsValue

func AbsValue[S any, V numericValue](input Selected[S, V]) Selected[S, V]

AbsValue applies Abs to a selected numeric value.

Example: expr.AbsValue(input)

func AddClockElapsedNullableValue

func AddClockElapsedNullableValue[S any](input Selected[S, value.Nullable[temporal.Time]], duration time.Duration) Selected[S, value.Nullable[temporal.Time]]

AddClockElapsedNullableValue retains the selected aggregate/window phase.

Example: expr.AddClockElapsedNullableValue(input, duration)

func AddClockElapsedValue

func AddClockElapsedValue[S any](input Selected[S, temporal.Time], duration time.Duration) Selected[S, temporal.Time]

AddClockElapsedValue retains the selected aggregate/window phase.

Example: expr.AddClockElapsedValue(input, duration)

func AddDateDaysNullableValue

func AddDateDaysNullableValue[S any](input Selected[S, value.Nullable[temporal.Date]], days int32) Selected[S, value.Nullable[temporal.Date]]

AddDateDaysNullableValue retains the selected aggregate/window phase.

Example: expr.AddDateDaysNullableValue(input, days)

func AddDateDaysValue

func AddDateDaysValue[S any](input Selected[S, temporal.Date], days int32) Selected[S, temporal.Date]

AddDateDaysValue retains the selected aggregate/window phase.

Example: expr.AddDateDaysValue(input, days)

func AddDateIntervalNullableValue

func AddDateIntervalNullableValue[S any](input Selected[S, value.Nullable[temporal.Date]], interval temporal.Interval) Selected[S, value.Nullable[temporal.LocalDateTime]]

AddDateIntervalNullableValue retains the selected aggregate/window phase.

Example: expr.AddDateIntervalNullableValue(input, interval)

func AddDateIntervalValue

func AddDateIntervalValue[S any](input Selected[S, temporal.Date], interval temporal.Interval) Selected[S, temporal.LocalDateTime]

AddDateIntervalValue retains the selected aggregate/window phase.

Example: expr.AddDateIntervalValue(input, interval)

func AddInstantIntervalNullableValue

func AddInstantIntervalNullableValue[S any, V instantValue](input Selected[S, value.Nullable[V]], interval temporal.Interval, zone TimeZone) Selected[S, value.Nullable[V]]

AddInstantIntervalNullableValue retains the selected aggregate/window phase.

Example: expr.AddInstantIntervalNullableValue(input, interval, zone)

func AddInstantIntervalValue

func AddInstantIntervalValue[S any, V instantValue](input Selected[S, V], interval temporal.Interval, zone TimeZone) Selected[S, V]

AddInstantIntervalValue retains the selected aggregate/window phase.

Example: expr.AddInstantIntervalValue(input, interval, zone)

func AddIntervalsNullableValue

func AddIntervalsNullableValue[S any](left Selected[S, value.Nullable[temporal.Interval]], right Selected[S, value.Nullable[temporal.Interval]]) Selected[S, value.Nullable[temporal.Interval]]

AddIntervalsNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.AddIntervalsNullableValue(left, right)

func AddIntervalsValue

func AddIntervalsValue[S any](left Selected[S, temporal.Interval], right Selected[S, temporal.Interval]) Selected[S, temporal.Interval]

AddIntervalsValue retains selected aggregate/window phases and input ownership.

Example: expr.AddIntervalsValue(left, right)

func AddLocalIntervalNullableValue

func AddLocalIntervalNullableValue[S any](input Selected[S, value.Nullable[temporal.LocalDateTime]], interval temporal.Interval) Selected[S, value.Nullable[temporal.LocalDateTime]]

AddLocalIntervalNullableValue retains the selected aggregate/window phase.

Example: expr.AddLocalIntervalNullableValue(input, interval)

func AddLocalIntervalValue

func AddLocalIntervalValue[S any](input Selected[S, temporal.LocalDateTime], interval temporal.Interval) Selected[S, temporal.LocalDateTime]

AddLocalIntervalValue retains the selected aggregate/window phase.

Example: expr.AddLocalIntervalValue(input, interval)

func AddNullableValue

func AddNullableValue[S any, V numericValue](left, right Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

AddNullableValue composes selected nullable numeric values.

Example: expr.AddNullableValue(left, right)

func AddValue

func AddValue[S any, V numericValue](left, right Selected[S, V]) Selected[S, V]

AddValue is Add's selected-value counterpart for aggregate/window composition.

Example: expr.AddValue(left, right)

func AsSelected added in v0.3.0

func AsSelected[S, V any](source SelectSource[S, V]) Selected[S, V]

AsSelected promotes a row or aggregate result to the selected phase, preserving nullability.

Example: expr.AsSelected(expr.Count[User]())

func CenturyNullableValue

func CenturyNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

CenturyNullableValue is the nullable selected-value counterpart.

Example: expr.CenturyNullableValue(input)

func CenturyValue

func CenturyValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

CenturyValue retains the selected aggregate/window phase.

Example: expr.CenturyValue(input)

func ClockDifferenceNullableValue

func ClockDifferenceNullableValue[S any](left Selected[S, value.Nullable[temporal.Time]], right Selected[S, value.Nullable[temporal.Time]]) Selected[S, value.Nullable[temporal.Interval]]

ClockDifferenceNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.ClockDifferenceNullableValue(left, right)

func ClockDifferenceValue

func ClockDifferenceValue[S any](left Selected[S, temporal.Time], right Selected[S, temporal.Time]) Selected[S, temporal.Interval]

ClockDifferenceValue retains selected aggregate/window phases and input ownership.

Example: expr.ClockDifferenceValue(left, right)

func CoalesceNullableValue

func CoalesceNullableValue[S, V any](first Selected[S, value.Nullable[V]], rest ...Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

CoalesceNullableValue combines selected nullable inputs without nesting wrappers.

Example: expr.CoalesceNullableValue(first, rest...)

func CoalesceValue

func CoalesceValue[S, V any](first Selected[S, value.Nullable[V]], fallback Selected[S, V]) Selected[S, V]

CoalesceValue composes selected values with a required fallback.

Example: expr.CoalesceValue(first, fallback)

func CombineDateTimeNullableValue

func CombineDateTimeNullableValue[S any](date Selected[S, value.Nullable[temporal.Date]], clock Selected[S, value.Nullable[temporal.Time]]) Selected[S, value.Nullable[temporal.LocalDateTime]]

CombineDateTimeNullableValue retains the selected aggregate/window phase.

Example: expr.CombineDateTimeNullableValue(date, clock)

func CombineDateTimeValue

func CombineDateTimeValue[S any](date Selected[S, temporal.Date], clock Selected[S, temporal.Time]) Selected[S, temporal.LocalDateTime]

CombineDateTimeValue retains the selected aggregate/window phase.

Example: expr.CombineDateTimeValue(date, clock)

func ConcatNullableValue

func ConcatNullableValue[S any, V, W ~string](input Selected[S, value.Nullable[V]], other Selected[S, value.Nullable[W]]) Selected[S, value.Nullable[string]]

ConcatNullableValue applies ConcatNullable to selected expressions, including aggregates/windows.

Example: expr.ConcatNullableValue(input, other)

func ConcatValue

func ConcatValue[S any, V, W ~string](input Selected[S, V], other Selected[S, W]) Selected[S, string]

ConcatValue applies Concat to selected expressions, including aggregates/windows.

Example: expr.ConcatValue(input, other)

func ConcatWSNullableValue

func ConcatWSNullableValue[S any, V ~string](separator string, first Selected[S, value.Nullable[V]], rest ...Selected[S, value.Nullable[V]]) Selected[S, string]

ConcatWSNullableValue accepts selected text values and returns a non-null string.

Example: expr.ConcatWSNullableValue(separator, first, rest...)

func ConcatWSValue

func ConcatWSValue[S any, V ~string](separator string, first Selected[S, V], rest ...Selected[S, V]) Selected[S, string]

ConcatWSValue accepts selected text values and returns a non-null string.

Example: expr.ConcatWSValue(separator, first, rest...)

func CumeDist

func CumeDist[S any](w Window[S]) Selected[S, float64]

CumeDist returns the cumulative partition fraction.

Example: expr.CumeDist(w)

func DateDifferenceNullableValue

func DateDifferenceNullableValue[S any](left Selected[S, value.Nullable[temporal.Date]], right Selected[S, value.Nullable[temporal.Date]]) Selected[S, value.Nullable[int64]]

DateDifferenceNullableValue retains the selected aggregate/window phase.

Example: expr.DateDifferenceNullableValue(left, right)

func DateDifferenceValue

func DateDifferenceValue[S any](left Selected[S, temporal.Date], right Selected[S, temporal.Date]) Selected[S, int64]

DateDifferenceValue retains the selected aggregate/window phase.

Example: expr.DateDifferenceValue(left, right)

func DateOfNullableValue

func DateOfNullableValue[S any](input Selected[S, value.Nullable[temporal.LocalDateTime]]) Selected[S, value.Nullable[temporal.Date]]

DateOfNullableValue retains the selected aggregate/window phase.

Example: expr.DateOfNullableValue(input)

func DateOfValue

func DateOfValue[S any](input Selected[S, temporal.LocalDateTime]) Selected[S, temporal.Date]

DateOfValue retains the selected aggregate/window phase.

Example: expr.DateOfValue(input)

func DayNullableValue

func DayNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

DayNullableValue is the nullable selected-value counterpart.

Example: expr.DayNullableValue(input)

func DayOfWeekNullableValue

func DayOfWeekNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

DayOfWeekNullableValue is the nullable selected-value counterpart.

Example: expr.DayOfWeekNullableValue(input)

func DayOfWeekValue

func DayOfWeekValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

DayOfWeekValue retains the selected aggregate/window phase.

Example: expr.DayOfWeekValue(input)

func DayOfYearNullableValue

func DayOfYearNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

DayOfYearNullableValue is the nullable selected-value counterpart.

Example: expr.DayOfYearNullableValue(input)

func DayOfYearValue

func DayOfYearValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

DayOfYearValue retains the selected aggregate/window phase.

Example: expr.DayOfYearValue(input)

func DayValue

func DayValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

DayValue retains the selected aggregate/window phase.

Example: expr.DayValue(input)

func DecadeNullableValue

func DecadeNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

DecadeNullableValue is the nullable selected-value counterpart.

Example: expr.DecadeNullableValue(input)

func DecadeValue

func DecadeValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

DecadeValue retains the selected aggregate/window phase.

Example: expr.DecadeValue(input)

func DecimalNullableValue

func DecimalNullableValue[S any, V exactNumber](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[decimal.Decimal]]

DecimalNullableValue converts a selected nullable input without removing NULL.

Example: expr.DecimalNullableValue(input)

func DecimalValue

func DecimalValue[S any, V exactNumber](input Selected[S, V]) Selected[S, decimal.Decimal]

DecimalValue is the selected-value counterpart of DecimalOf.

Example: expr.DecimalValue(input)

func DenseRank

func DenseRank[S any](w Window[S]) Selected[S, int64]

DenseRank ranks peers equally without gaps.

Example: expr.DenseRank(w)

func DivideNullableValue

func DivideNullableValue[S any, V numericValue](left, right Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

DivideNullableValue composes selected nullable numeric values.

Example: expr.DivideNullableValue(left, right)

func DivideValue

func DivideValue[S any, V numericValue](left, right Selected[S, V]) Selected[S, V]

DivideValue is Divide's selected-value counterpart for aggregate/window composition.

Example: expr.DivideValue(left, right)

func FirstNullableValue

func FirstNullableValue[S, V any](input Selected[S, value.Nullable[V]], w Window[S]) Selected[S, value.Nullable[V]]

FirstNullableValue preserves one nullable layer.

Example: expr.FirstNullableValue(input, w)

func FirstValue

func FirstValue[S, V any](input Selected[S, V], w Window[S]) Selected[S, value.Nullable[V]]

FirstValue returns a frame value, or NULL when absent.

Example: expr.FirstValue(input, w)

func FloatNullableValue

func FloatNullableValue[S any, V numericValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[float64]]

FloatNullableValue converts a selected nullable input without removing NULL.

Example: expr.FloatNullableValue(input)

func FloatValue

func FloatValue[S any, V numericValue](input Selected[S, V]) Selected[S, float64]

FloatValue is the selected-value counterpart of FloatOf.

Example: expr.FloatValue(input)

func FoundrySelectedValue

func FoundrySelectedValue[S, V any](core ormcore.Expression, column ormcore.Column[V], seal sqlowner.ExpressionSeal) Selected[S, V]

FoundrySelectedValue constructs a validated selected-phase SQL value.

Example: expr.FoundrySelectedValue[User](core, column, seal)

func FromUnixMillisNullableValue

func FromUnixMillisNullableValue[S any, V integerNumber](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[temporal.DateTime]]

FromUnixMillisNullableValue retains the selected aggregate/window phase.

Example: expr.FromUnixMillisNullableValue(input)

func FromUnixMillisValue

func FromUnixMillisValue[S any, V integerNumber](input Selected[S, V]) Selected[S, temporal.DateTime]

FromUnixMillisValue retains the selected aggregate/window phase.

Example: expr.FromUnixMillisValue(input)

func HourNullableValue

func HourNullableValue[S any, V clockValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

HourNullableValue is the nullable selected-value counterpart.

Example: expr.HourNullableValue(input)

func HourValue

func HourValue[S any, V clockValue](input Selected[S, V]) Selected[S, int64]

HourValue retains the selected aggregate/window phase.

Example: expr.HourValue(input)

func ISODayOfWeekNullableValue

func ISODayOfWeekNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

ISODayOfWeekNullableValue is the nullable selected-value counterpart.

Example: expr.ISODayOfWeekNullableValue(input)

func ISODayOfWeekValue

func ISODayOfWeekValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

ISODayOfWeekValue retains the selected aggregate/window phase.

Example: expr.ISODayOfWeekValue(input)

func ISOWeekNullableValue

func ISOWeekNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

ISOWeekNullableValue is the nullable selected-value counterpart.

Example: expr.ISOWeekNullableValue(input)

func ISOWeekValue

func ISOWeekValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

ISOWeekValue retains the selected aggregate/window phase.

Example: expr.ISOWeekValue(input)

func ISOYearNullableValue

func ISOYearNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

ISOYearNullableValue is the nullable selected-value counterpart.

Example: expr.ISOYearNullableValue(input)

func ISOYearValue

func ISOYearValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

ISOYearValue retains the selected aggregate/window phase.

Example: expr.ISOYearValue(input)

func InstantDifferenceNullableValue

func InstantDifferenceNullableValue[S any, L, R instantValue](left Selected[S, value.Nullable[L]], right Selected[S, value.Nullable[R]]) Selected[S, value.Nullable[temporal.Interval]]

InstantDifferenceNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.InstantDifferenceNullableValue(left, right)

func InstantDifferenceValue

func InstantDifferenceValue[S any, L, R instantValue](left Selected[S, L], right Selected[S, R]) Selected[S, temporal.Interval]

InstantDifferenceValue retains selected aggregate/window phases and input ownership.

Example: expr.InstantDifferenceValue(left, right)

func IntervalDaysNullableValue

func IntervalDaysNullableValue[S any](input Selected[S, value.Nullable[temporal.Interval]]) Selected[S, value.Nullable[int32]]

IntervalDaysNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.IntervalDaysNullableValue(input)

func IntervalDaysValue

func IntervalDaysValue[S any](input Selected[S, temporal.Interval]) Selected[S, int32]

IntervalDaysValue retains selected aggregate/window phases and input ownership.

Example: expr.IntervalDaysValue(input)

func IntervalElapsedNullableValue

func IntervalElapsedNullableValue[S any](input Selected[S, value.Nullable[temporal.Interval]]) Selected[S, value.Nullable[time.Duration]]

IntervalElapsedNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.IntervalElapsedNullableValue(input)

func IntervalElapsedValue

func IntervalElapsedValue[S any](input Selected[S, temporal.Interval]) Selected[S, time.Duration]

IntervalElapsedValue retains selected aggregate/window phases and input ownership.

Example: expr.IntervalElapsedValue(input)

func IntervalMonthsNullableValue

func IntervalMonthsNullableValue[S any](input Selected[S, value.Nullable[temporal.Interval]]) Selected[S, value.Nullable[int32]]

IntervalMonthsNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.IntervalMonthsNullableValue(input)

func IntervalMonthsValue

func IntervalMonthsValue[S any](input Selected[S, temporal.Interval]) Selected[S, int32]

IntervalMonthsValue retains selected aggregate/window phases and input ownership.

Example: expr.IntervalMonthsValue(input)

func JSONContainedByNullableValue

func JSONContainedByNullableValue[S, P any](left, right Selected[S, value.Nullable[value.JSON[P]]]) Selected[S, value.Nullable[bool]]

JSONContainedByNullableValue preserves selected phase, including aggregates and windows.

Example: expr.JSONContainedByNullableValue(left, right)

func JSONContainedByValue

func JSONContainedByValue[S, P any](left, right Selected[S, value.JSON[P]]) Selected[S, bool]

JSONContainedByValue preserves selected phase, including aggregates and windows.

Example: expr.JSONContainedByValue(left, right)

func JSONContainsNullableValue

func JSONContainsNullableValue[S, P any](left, right Selected[S, value.Nullable[value.JSON[P]]]) Selected[S, value.Nullable[bool]]

JSONContainsNullableValue preserves selected phase, including aggregates and windows.

Example: expr.JSONContainsNullableValue(left, right)

func JSONContainsValue

func JSONContainsValue[S, P any](left, right Selected[S, value.JSON[P]]) Selected[S, bool]

JSONContainsValue preserves selected phase, including aggregates and windows.

Example: expr.JSONContainsValue(left, right)

func JSONLengthNullableValue

func JSONLengthNullableValue[S, P any](input Selected[S, value.Nullable[value.JSON[P]]]) Selected[S, value.Nullable[int64]]

JSONLengthNullableValue preserves selected phase, including aggregates and windows.

Example: expr.JSONLengthNullableValue(input)

func JSONLengthValue

func JSONLengthValue[S, P any](input Selected[S, value.JSON[P]]) Selected[S, value.Nullable[int64]]

JSONLengthValue preserves selected phase, including aggregates and windows.

Example: expr.JSONLengthValue(input)

func JSONTypeNullableValue

func JSONTypeNullableValue[S, P any](input Selected[S, value.Nullable[value.JSON[P]]]) Selected[S, value.Nullable[database.JSONKind]]

JSONTypeNullableValue preserves selected phase, including aggregates and windows.

Example: expr.JSONTypeNullableValue(input)

func JSONTypeValue

func JSONTypeValue[S, P any](input Selected[S, value.JSON[P]]) Selected[S, database.JSONKind]

JSONTypeValue preserves selected phase, including aggregates and windows.

Example: expr.JSONTypeValue(input)

func JulianDayNullableValue

func JulianDayNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[decimal.Decimal]]

JulianDayNullableValue is the nullable selected-value counterpart.

Example: expr.JulianDayNullableValue(input)

func JulianDayValue

func JulianDayValue[S any, V calendarValue](input Selected[S, V]) Selected[S, decimal.Decimal]

JulianDayValue retains the selected aggregate/window phase.

Example: expr.JulianDayValue(input)

func Lag

func Lag[S, V any](input Selected[S, V], offset int32, w Window[S]) Selected[S, value.Nullable[V]]

Lag returns the offset value or NULL when absent; negative offsets reverse direction.

Example: expr.Lag(input, offset, w)

func LagNullable

func LagNullable[S, V any](input Selected[S, value.Nullable[V]], offset int32, w Window[S]) Selected[S, value.Nullable[V]]

LagNullable preserves exactly one nullable layer.

Example: expr.LagNullable(input, offset, w)

func LagOr

func LagOr[S, V any](input Selected[S, V], offset int32, fallback V, w Window[S]) Selected[S, V]

LagOr uses a captured typed fallback only when the offset row is absent. NULL in an existing row remains NULL.

Example: expr.LagOr(input, offset, fallback, w)

func LastNullableValue

func LastNullableValue[S, V any](input Selected[S, value.Nullable[V]], w Window[S]) Selected[S, value.Nullable[V]]

LastNullableValue preserves one nullable layer.

Example: expr.LastNullableValue(input, w)

func LastValue

func LastValue[S, V any](input Selected[S, V], w Window[S]) Selected[S, value.Nullable[V]]

LastValue returns a frame value, or NULL when absent.

Example: expr.LastValue(input, w)

func Lead

func Lead[S, V any](input Selected[S, V], offset int32, w Window[S]) Selected[S, value.Nullable[V]]

Lead returns the offset value or NULL when absent; negative offsets reverse direction.

Example: expr.Lead(input, offset, w)

func LeadNullable

func LeadNullable[S, V any](input Selected[S, value.Nullable[V]], offset int32, w Window[S]) Selected[S, value.Nullable[V]]

LeadNullable preserves exactly one nullable layer.

Example: expr.LeadNullable(input, offset, w)

func LeadOr

func LeadOr[S, V any](input Selected[S, V], offset int32, fallback V, w Window[S]) Selected[S, V]

LeadOr uses a captured typed fallback only when the offset row is absent. NULL in an existing row remains NULL.

Example: expr.LeadOr(input, offset, fallback, w)

func LengthNullableValue

func LengthNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

LengthNullableValue applies LengthNullable to selected expressions, including aggregates/windows.

Example: expr.LengthNullableValue(input)

func LengthValue

func LengthValue[S any, V ~string](input Selected[S, V]) Selected[S, int64]

LengthValue applies Length to selected expressions, including aggregates/windows.

Example: expr.LengthValue(input)

func LocalAtNullableValue

func LocalAtNullableValue[S any, V instantValue](input Selected[S, value.Nullable[V]], zone TimeZone) Selected[S, value.Nullable[temporal.LocalDateTime]]

LocalAtNullableValue retains the selected aggregate/window phase.

Example: expr.LocalAtNullableValue(input, zone)

func LocalAtValue

func LocalAtValue[S any, V instantValue](input Selected[S, V], zone TimeZone) Selected[S, temporal.LocalDateTime]

LocalAtValue retains the selected aggregate/window phase.

Example: expr.LocalAtValue(input, zone)

func LocalDifferenceNullableValue

LocalDifferenceNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.LocalDifferenceNullableValue(left, right)

func LocalDifferenceValue

func LocalDifferenceValue[S any](left Selected[S, temporal.LocalDateTime], right Selected[S, temporal.LocalDateTime]) Selected[S, temporal.Interval]

LocalDifferenceValue retains selected aggregate/window phases and input ownership.

Example: expr.LocalDifferenceValue(left, right)

func LowerNullableValue

func LowerNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[string]]

LowerNullableValue applies LowerNullable to selected expressions, including aggregates/windows.

Example: expr.LowerNullableValue(input)

func LowerValue

func LowerValue[S any, V ~string](input Selected[S, V]) Selected[S, string]

LowerValue applies Lower to selected expressions, including aggregates/windows.

Example: expr.LowerValue(input)

func MicrosecondsNullableValue

func MicrosecondsNullableValue[S any, V clockValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

MicrosecondsNullableValue is the nullable selected-value counterpart.

Example: expr.MicrosecondsNullableValue(input)

func MicrosecondsValue

func MicrosecondsValue[S any, V clockValue](input Selected[S, V]) Selected[S, int64]

MicrosecondsValue retains the selected aggregate/window phase.

Example: expr.MicrosecondsValue(input)

func MillenniumNullableValue

func MillenniumNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

MillenniumNullableValue is the nullable selected-value counterpart.

Example: expr.MillenniumNullableValue(input)

func MillenniumValue

func MillenniumValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

MillenniumValue retains the selected aggregate/window phase.

Example: expr.MillenniumValue(input)

func MillisecondsNullableValue

func MillisecondsNullableValue[S any, V clockValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[decimal.Decimal]]

MillisecondsNullableValue is the nullable selected-value counterpart.

Example: expr.MillisecondsNullableValue(input)

func MillisecondsValue

func MillisecondsValue[S any, V clockValue](input Selected[S, V]) Selected[S, decimal.Decimal]

MillisecondsValue retains the selected aggregate/window phase.

Example: expr.MillisecondsValue(input)

func MinuteNullableValue

func MinuteNullableValue[S any, V clockValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

MinuteNullableValue is the nullable selected-value counterpart.

Example: expr.MinuteNullableValue(input)

func MinuteValue

func MinuteValue[S any, V clockValue](input Selected[S, V]) Selected[S, int64]

MinuteValue retains the selected aggregate/window phase.

Example: expr.MinuteValue(input)

func MonthNullableValue

func MonthNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

MonthNullableValue is the nullable selected-value counterpart.

Example: expr.MonthNullableValue(input)

func MonthValue

func MonthValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

MonthValue retains the selected aggregate/window phase.

Example: expr.MonthValue(input)

func MultiplyNullableValue

func MultiplyNullableValue[S any, V numericValue](left, right Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

MultiplyNullableValue composes selected nullable numeric values.

Example: expr.MultiplyNullableValue(left, right)

func MultiplyValue

func MultiplyValue[S any, V numericValue](left, right Selected[S, V]) Selected[S, V]

MultiplyValue is Multiply's selected-value counterpart for aggregate/window composition.

Example: expr.MultiplyValue(left, right)

func NTile

func NTile[S any](buckets int32, w Window[S]) Selected[S, int32]

NTile assigns rows to a positive number of buckets.

Example: expr.NTile(buckets, w)

func NegateIntervalNullableValue

func NegateIntervalNullableValue[S any](input Selected[S, value.Nullable[temporal.Interval]]) Selected[S, value.Nullable[temporal.Interval]]

NegateIntervalNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.NegateIntervalNullableValue(input)

func NegateIntervalValue

func NegateIntervalValue[S any](input Selected[S, temporal.Interval]) Selected[S, temporal.Interval]

NegateIntervalValue retains selected aggregate/window phases and input ownership.

Example: expr.NegateIntervalValue(input)

func NegateNullableValue

func NegateNullableValue[S any, V numericValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

NegateNullableValue applies Negate to a selected nullable value.

Example: expr.NegateNullableValue(input)

func NegateValue

func NegateValue[S any, V numericValue](input Selected[S, V]) Selected[S, V]

NegateValue applies Negate to a selected numeric value.

Example: expr.NegateValue(input)

func NthNullableValue

func NthNullableValue[S, V any](input Selected[S, value.Nullable[V]], n int32, w Window[S]) Selected[S, value.Nullable[V]]

NthNullableValue preserves one nullable layer.

Example: expr.NthNullableValue(input, n, w)

func NthValue

func NthValue[S, V any](input Selected[S, V], n int32, w Window[S]) Selected[S, value.Nullable[V]]

NthValue returns a frame value, or NULL when absent.

Example: expr.NthValue(input, n, w)

func NullIfNullableValue

func NullIfNullableValue[S, V any](first, second Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

NullIfNullableValue compares selected nullable values without nesting wrappers.

Example: expr.NullIfNullableValue(first, second)

func NullIfValue

func NullIfValue[S, V any](first, second Selected[S, V]) Selected[S, value.Nullable[V]]

NullIfValue adds one nullable layer to matching required selected values.

Example: expr.NullIfValue(first, second)

func Nullable

func Nullable[S, V any](e Selected[S, V]) Selected[S, value.Nullable[V]]

Nullable widens a selected value by one nullable layer without changing its phase.

Example: expr.Nullable(e)

func OctetLengthNullableValue

func OctetLengthNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

OctetLengthNullableValue applies OctetLengthNullable to selected expressions, including aggregates/windows.

Example: expr.OctetLengthNullableValue(input)

func OctetLengthValue

func OctetLengthValue[S any, V ~string](input Selected[S, V]) Selected[S, int64]

OctetLengthValue applies OctetLength to selected expressions, including aggregates/windows.

Example: expr.OctetLengthValue(input)

func Over

func Over[S, V any](aggregate AggregateExpression[S, V], w Window[S]) Selected[S, V]

Over applies a frame to an aggregate, retaining its codec and nullability. FILTER must precede Over; COUNT DISTINCT windows are invalid.

Example: expr.Over(aggregate, w)

func PercentRank

func PercentRank[S any](w Window[S]) Selected[S, float64]

PercentRank returns the relative rank in [0,1].

Example: expr.PercentRank(w)

func QuarterNullableValue

func QuarterNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

QuarterNullableValue is the nullable selected-value counterpart.

Example: expr.QuarterNullableValue(input)

func QuarterValue

func QuarterValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

QuarterValue retains the selected aggregate/window phase.

Example: expr.QuarterValue(input)

func Rank

func Rank[S any](w Window[S]) Selected[S, int64]

Rank ranks peers equally, leaving gaps.

Example: expr.Rank(w)

func Raw

func Raw[S, V any](sql string, args ...any) Selected[S, V]

Raw declares a selected-phase SQL fragment with a built-in result codec. Use ? for bound arguments and ?? for a literal question mark. The caller owns SQL semantics and result type; scopes and transactions belong to the query.

Example: expr.Raw[User, string](sql, args...)

func RawWithCodec

func RawWithCodec[S, V any](c codec.Codec[V], sql string, args ...any) Selected[S, V]

RawWithCodec supplies an explicit result codec, including custom/nullable types.

Example: expr.RawWithCodec[User](c, sql, args...)

func RemainderNullableValue

func RemainderNullableValue[S any, V exactNumber](left, right Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

RemainderNullableValue composes selected nullable numeric values.

Example: expr.RemainderNullableValue(left, right)

func RemainderValue

func RemainderValue[S any, V exactNumber](left, right Selected[S, V]) Selected[S, V]

RemainderValue is Remainder's selected-value counterpart for aggregate/window composition.

Example: expr.RemainderValue(left, right)

func ReplaceNullableValue

func ReplaceNullableValue[S any, V, W, X ~string](input Selected[S, value.Nullable[V]], other Selected[S, value.Nullable[W]], replacement Selected[S, value.Nullable[X]]) Selected[S, value.Nullable[string]]

ReplaceNullableValue applies ReplaceNullable to selected expressions, including aggregates/windows.

Example: expr.ReplaceNullableValue(input, other, replacement)

func ReplaceValue

func ReplaceValue[S any, V, W, X ~string](input Selected[S, V], other Selected[S, W], replacement Selected[S, X]) Selected[S, string]

ReplaceValue applies Replace to selected expressions, including aggregates/windows.

Example: expr.ReplaceValue(input, other, replacement)

func ResolveLocalNullableValue

func ResolveLocalNullableValue[S any](input Selected[S, value.Nullable[temporal.LocalDateTime]], zone TimeZone, policy LocalResolution) Selected[S, value.Nullable[temporal.DateTime]]

ResolveLocalNullableValue retains the selected aggregate/window phase.

Example: expr.ResolveLocalNullableValue(input, zone, policy)

func ResolveLocalValue

func ResolveLocalValue[S any](input Selected[S, temporal.LocalDateTime], zone TimeZone, policy LocalResolution) Selected[S, temporal.DateTime]

ResolveLocalValue retains the selected aggregate/window phase.

Example: expr.ResolveLocalValue(input, zone, policy)

func RowNumber

func RowNumber[S any](w Window[S]) Selected[S, int64]

RowNumber numbers partition rows from one.

Example: expr.RowNumber(w)

func SecondNullableValue

func SecondNullableValue[S any, V clockValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[decimal.Decimal]]

SecondNullableValue is the nullable selected-value counterpart.

Example: expr.SecondNullableValue(input)

func SecondValue

func SecondValue[S any, V clockValue](input Selected[S, V]) Selected[S, decimal.Decimal]

SecondValue retains the selected aggregate/window phase.

Example: expr.SecondValue(input)

func ShiftDateNullableValue

func ShiftDateNullableValue[S any](input Selected[S, value.Nullable[temporal.Date]], interval Selected[S, value.Nullable[temporal.Interval]]) Selected[S, value.Nullable[temporal.LocalDateTime]]

ShiftDateNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.ShiftDateNullableValue(input, interval)

func ShiftDateValue

func ShiftDateValue[S any](input Selected[S, temporal.Date], interval Selected[S, temporal.Interval]) Selected[S, temporal.LocalDateTime]

ShiftDateValue retains selected aggregate/window phases and input ownership.

Example: expr.ShiftDateValue(input, interval)

func ShiftInstantNullableValue

func ShiftInstantNullableValue[S any, V instantValue](input Selected[S, value.Nullable[V]], interval Selected[S, value.Nullable[temporal.Interval]], zone TimeZone) Selected[S, value.Nullable[V]]

ShiftInstantNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.ShiftInstantNullableValue(input, interval, zone)

func ShiftInstantValue

func ShiftInstantValue[S any, V instantValue](input Selected[S, V], interval Selected[S, temporal.Interval], zone TimeZone) Selected[S, V]

ShiftInstantValue retains selected aggregate/window phases and input ownership.

Example: expr.ShiftInstantValue(input, interval, zone)

func ShiftLocalNullableValue

ShiftLocalNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.ShiftLocalNullableValue(input, interval)

func ShiftLocalValue

func ShiftLocalValue[S any](input Selected[S, temporal.LocalDateTime], interval Selected[S, temporal.Interval]) Selected[S, temporal.LocalDateTime]

ShiftLocalValue retains selected aggregate/window phases and input ownership.

Example: expr.ShiftLocalValue(input, interval)

func SphericalDistanceNullableValue

func SphericalDistanceNullableValue[S any](latitude, longitude Selected[S, value.Nullable[float64]], origin GeographicPoint) Selected[S, value.Nullable[float64]]

SphericalDistanceNullableValue is the selected nullable counterpart.

Example: expr.SphericalDistanceNullableValue(latitude, longitude, origin)

func SphericalDistanceValue

func SphericalDistanceValue[S any](latitude, longitude Selected[S, float64], origin GeographicPoint) Selected[S, float64]

SphericalDistanceValue composes selected floating coordinates.

Example: expr.SphericalDistanceValue(latitude, longitude, origin)

func SubstringAtNullableValue

func SubstringAtNullableValue[S any, V ~string, I integerNumber](input Selected[S, value.Nullable[V]], start, count Selected[S, I]) Selected[S, value.Nullable[string]]

SubstringAtNullableValue retains selected text/integer scopes for dynamic positions.

Example: expr.SubstringAtNullableValue(input, start, count)

func SubstringAtValue

func SubstringAtValue[S any, V ~string, I integerNumber](input Selected[S, V], start, count Selected[S, I]) Selected[S, string]

SubstringAtValue retains selected text/integer scopes for dynamic positions.

Example: expr.SubstringAtValue(input, start, count)

func SubstringFromNullableValue

func SubstringFromNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]], start int32) Selected[S, value.Nullable[string]]

SubstringFromNullableValue accepts a selected text value and bound character positions.

Example: expr.SubstringFromNullableValue(input, start)

func SubstringFromValue

func SubstringFromValue[S any, V ~string](input Selected[S, V], start int32) Selected[S, string]

SubstringFromValue accepts a selected text value and bound character positions.

Example: expr.SubstringFromValue(input, start)

func SubstringNullableValue

func SubstringNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]], start int32, count int32) Selected[S, value.Nullable[string]]

SubstringNullableValue accepts a selected text value and bound character positions.

Example: expr.SubstringNullableValue(input, start, count)

func SubstringValue

func SubstringValue[S any, V ~string](input Selected[S, V], start int32, count int32) Selected[S, string]

SubstringValue accepts a selected text value and bound character positions.

Example: expr.SubstringValue(input, start, count)

func SubtractClockElapsedNullableValue

func SubtractClockElapsedNullableValue[S any](input Selected[S, value.Nullable[temporal.Time]], duration time.Duration) Selected[S, value.Nullable[temporal.Time]]

SubtractClockElapsedNullableValue retains the selected aggregate/window phase.

Example: expr.SubtractClockElapsedNullableValue(input, duration)

func SubtractClockElapsedValue

func SubtractClockElapsedValue[S any](input Selected[S, temporal.Time], duration time.Duration) Selected[S, temporal.Time]

SubtractClockElapsedValue retains the selected aggregate/window phase.

Example: expr.SubtractClockElapsedValue(input, duration)

func SubtractDateIntervalNullableValue

func SubtractDateIntervalNullableValue[S any](input Selected[S, value.Nullable[temporal.Date]], interval temporal.Interval) Selected[S, value.Nullable[temporal.LocalDateTime]]

SubtractDateIntervalNullableValue retains the selected aggregate/window phase.

Example: expr.SubtractDateIntervalNullableValue(input, interval)

func SubtractDateIntervalValue

func SubtractDateIntervalValue[S any](input Selected[S, temporal.Date], interval temporal.Interval) Selected[S, temporal.LocalDateTime]

SubtractDateIntervalValue retains the selected aggregate/window phase.

Example: expr.SubtractDateIntervalValue(input, interval)

func SubtractInstantIntervalNullableValue

func SubtractInstantIntervalNullableValue[S any, V instantValue](input Selected[S, value.Nullable[V]], interval temporal.Interval, zone TimeZone) Selected[S, value.Nullable[V]]

SubtractInstantIntervalNullableValue retains the selected aggregate/window phase.

Example: expr.SubtractInstantIntervalNullableValue(input, interval, zone)

func SubtractInstantIntervalValue

func SubtractInstantIntervalValue[S any, V instantValue](input Selected[S, V], interval temporal.Interval, zone TimeZone) Selected[S, V]

SubtractInstantIntervalValue retains the selected aggregate/window phase.

Example: expr.SubtractInstantIntervalValue(input, interval, zone)

func SubtractIntervalsNullableValue

func SubtractIntervalsNullableValue[S any](left Selected[S, value.Nullable[temporal.Interval]], right Selected[S, value.Nullable[temporal.Interval]]) Selected[S, value.Nullable[temporal.Interval]]

SubtractIntervalsNullableValue retains selected aggregate/window phases and input ownership.

Example: expr.SubtractIntervalsNullableValue(left, right)

func SubtractIntervalsValue

func SubtractIntervalsValue[S any](left Selected[S, temporal.Interval], right Selected[S, temporal.Interval]) Selected[S, temporal.Interval]

SubtractIntervalsValue retains selected aggregate/window phases and input ownership.

Example: expr.SubtractIntervalsValue(left, right)

func SubtractLocalIntervalNullableValue

func SubtractLocalIntervalNullableValue[S any](input Selected[S, value.Nullable[temporal.LocalDateTime]], interval temporal.Interval) Selected[S, value.Nullable[temporal.LocalDateTime]]

SubtractLocalIntervalNullableValue retains the selected aggregate/window phase.

Example: expr.SubtractLocalIntervalNullableValue(input, interval)

func SubtractLocalIntervalValue

func SubtractLocalIntervalValue[S any](input Selected[S, temporal.LocalDateTime], interval temporal.Interval) Selected[S, temporal.LocalDateTime]

SubtractLocalIntervalValue retains the selected aggregate/window phase.

Example: expr.SubtractLocalIntervalValue(input, interval)

func SubtractNullableValue

func SubtractNullableValue[S any, V numericValue](left, right Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[V]]

SubtractNullableValue composes selected nullable numeric values.

Example: expr.SubtractNullableValue(left, right)

func SubtractValue

func SubtractValue[S any, V numericValue](left, right Selected[S, V]) Selected[S, V]

SubtractValue is Subtract's selected-value counterpart for aggregate/window composition.

Example: expr.SubtractValue(left, right)

func TimeOfNullableValue

func TimeOfNullableValue[S any](input Selected[S, value.Nullable[temporal.LocalDateTime]]) Selected[S, value.Nullable[temporal.Time]]

TimeOfNullableValue retains the selected aggregate/window phase.

Example: expr.TimeOfNullableValue(input)

func TimeOfValue

func TimeOfValue[S any](input Selected[S, temporal.LocalDateTime]) Selected[S, temporal.Time]

TimeOfValue retains the selected aggregate/window phase.

Example: expr.TimeOfValue(input)

func TrimCharsNullableValue

func TrimCharsNullableValue[S any, V, W ~string](input Selected[S, value.Nullable[V]], other Selected[S, value.Nullable[W]]) Selected[S, value.Nullable[string]]

TrimCharsNullableValue applies TrimCharsNullable to selected expressions, including aggregates/windows.

Example: expr.TrimCharsNullableValue(input, other)

func TrimCharsValue

func TrimCharsValue[S any, V, W ~string](input Selected[S, V], other Selected[S, W]) Selected[S, string]

TrimCharsValue applies TrimChars to selected expressions, including aggregates/windows.

Example: expr.TrimCharsValue(input, other)

func TrimLeftCharsNullableValue

func TrimLeftCharsNullableValue[S any, V, W ~string](input Selected[S, value.Nullable[V]], other Selected[S, value.Nullable[W]]) Selected[S, value.Nullable[string]]

TrimLeftCharsNullableValue applies TrimLeftCharsNullable to selected expressions, including aggregates/windows.

Example: expr.TrimLeftCharsNullableValue(input, other)

func TrimLeftCharsValue

func TrimLeftCharsValue[S any, V, W ~string](input Selected[S, V], other Selected[S, W]) Selected[S, string]

TrimLeftCharsValue applies TrimLeftChars to selected expressions, including aggregates/windows.

Example: expr.TrimLeftCharsValue(input, other)

func TrimLeftNullableValue

func TrimLeftNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[string]]

TrimLeftNullableValue applies TrimLeftNullable to selected expressions, including aggregates/windows.

Example: expr.TrimLeftNullableValue(input)

func TrimLeftValue

func TrimLeftValue[S any, V ~string](input Selected[S, V]) Selected[S, string]

TrimLeftValue applies TrimLeft to selected expressions, including aggregates/windows.

Example: expr.TrimLeftValue(input)

func TrimNullableValue

func TrimNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[string]]

TrimNullableValue applies TrimNullable to selected expressions, including aggregates/windows.

Example: expr.TrimNullableValue(input)

func TrimRightCharsNullableValue

func TrimRightCharsNullableValue[S any, V, W ~string](input Selected[S, value.Nullable[V]], other Selected[S, value.Nullable[W]]) Selected[S, value.Nullable[string]]

TrimRightCharsNullableValue applies TrimRightCharsNullable to selected expressions, including aggregates/windows.

Example: expr.TrimRightCharsNullableValue(input, other)

func TrimRightCharsValue

func TrimRightCharsValue[S any, V, W ~string](input Selected[S, V], other Selected[S, W]) Selected[S, string]

TrimRightCharsValue applies TrimRightChars to selected expressions, including aggregates/windows.

Example: expr.TrimRightCharsValue(input, other)

func TrimRightNullableValue

func TrimRightNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[string]]

TrimRightNullableValue applies TrimRightNullable to selected expressions, including aggregates/windows.

Example: expr.TrimRightNullableValue(input)

func TrimRightValue

func TrimRightValue[S any, V ~string](input Selected[S, V]) Selected[S, string]

TrimRightValue applies TrimRight to selected expressions, including aggregates/windows.

Example: expr.TrimRightValue(input)

func TrimValue

func TrimValue[S any, V ~string](input Selected[S, V]) Selected[S, string]

TrimValue applies Trim to selected expressions, including aggregates/windows.

Example: expr.TrimValue(input)

func TruncateDateNullableValue

func TruncateDateNullableValue[S any](input Selected[S, value.Nullable[temporal.Date]], unit DateUnit) Selected[S, value.Nullable[temporal.Date]]

TruncateDateNullableValue retains the selected aggregate/window phase.

Example: expr.TruncateDateNullableValue(input, unit)

func TruncateDateValue

func TruncateDateValue[S any](input Selected[S, temporal.Date], unit DateUnit) Selected[S, temporal.Date]

TruncateDateValue retains the selected aggregate/window phase.

Example: expr.TruncateDateValue(input, unit)

func TruncateInstantNullableValue

func TruncateInstantNullableValue[S any, V instantValue](input Selected[S, value.Nullable[V]], unit TimestampUnit, zone TimeZone) Selected[S, value.Nullable[V]]

TruncateInstantNullableValue retains the selected aggregate/window phase.

Example: expr.TruncateInstantNullableValue(input, unit, zone)

func TruncateInstantValue

func TruncateInstantValue[S any, V instantValue](input Selected[S, V], unit TimestampUnit, zone TimeZone) Selected[S, V]

TruncateInstantValue retains the selected aggregate/window phase.

Example: expr.TruncateInstantValue(input, unit, zone)

func TruncateLocalNullableValue

func TruncateLocalNullableValue[S any](input Selected[S, value.Nullable[temporal.LocalDateTime]], unit TimestampUnit) Selected[S, value.Nullable[temporal.LocalDateTime]]

TruncateLocalNullableValue retains the selected aggregate/window phase.

Example: expr.TruncateLocalNullableValue(input, unit)

func TruncateLocalValue

func TruncateLocalValue[S any](input Selected[S, temporal.LocalDateTime], unit TimestampUnit) Selected[S, temporal.LocalDateTime]

TruncateLocalValue retains the selected aggregate/window phase.

Example: expr.TruncateLocalValue(input, unit)

func UnixMillisecondsNullableValue

func UnixMillisecondsNullableValue[S any, V instantValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

UnixMillisecondsNullableValue is the nullable selected-value counterpart.

Example: expr.UnixMillisecondsNullableValue(input)

func UnixMillisecondsValue

func UnixMillisecondsValue[S any, V instantValue](input Selected[S, V]) Selected[S, int64]

UnixMillisecondsValue retains the selected aggregate/window phase.

Example: expr.UnixMillisecondsValue(input)

func UnixSecondsNullableValue

func UnixSecondsNullableValue[S any, V instantValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[decimal.Decimal]]

UnixSecondsNullableValue is the nullable selected-value counterpart.

Example: expr.UnixSecondsNullableValue(input)

func UnixSecondsValue

func UnixSecondsValue[S any, V instantValue](input Selected[S, V]) Selected[S, decimal.Decimal]

UnixSecondsValue retains the selected aggregate/window phase.

Example: expr.UnixSecondsValue(input)

func UpperNullableValue

func UpperNullableValue[S any, V ~string](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[string]]

UpperNullableValue applies UpperNullable to selected expressions, including aggregates/windows.

Example: expr.UpperNullableValue(input)

func UpperValue

func UpperValue[S any, V ~string](input Selected[S, V]) Selected[S, string]

UpperValue applies Upper to selected expressions, including aggregates/windows.

Example: expr.UpperValue(input)

func YearNullableValue

func YearNullableValue[S any, V calendarValue](input Selected[S, value.Nullable[V]]) Selected[S, value.Nullable[int64]]

YearNullableValue is the nullable selected-value counterpart.

Example: expr.YearNullableValue(input)

func YearValue

func YearValue[S any, V calendarValue](input Selected[S, V]) Selected[S, int64]

YearValue retains the selected aggregate/window phase.

Example: expr.YearValue(input)

type SelectedOrder

type SelectedOrder[S any] struct {
	// contains filtered or unexported fields
}

SelectedOrder orders selected values through rows, never model queries.

Example: expr.DescValue(count)

func AscValue added in v0.3.0

func AscValue[S, V any](source ValueOrderSource[S, V]) SelectedOrder[S]

AscValue orders a selected or aggregate value ascending in a rows query.

Example: expr.AscValue(expr.Count[User]()).NullsFirst()

func DescValue added in v0.3.0

func DescValue[S, V any](source ValueOrderSource[S, V]) SelectedOrder[S]

DescValue orders a selected or aggregate value descending in a rows query.

Example: expr.DescValue(expr.Count[User]()).NullsLast()

func (SelectedOrder[S]) NullsFirst

func (o SelectedOrder[S]) NullsFirst() SelectedOrder[S]

NullsFirst places SQL NULL first.

Example: expr.DescValue(count).NullsFirst()

func (SelectedOrder[S]) NullsLast

func (o SelectedOrder[S]) NullsLast() SelectedOrder[S]

NullsLast places SQL NULL last.

Example: expr.DescValue(count).NullsLast()

type TextFilterAdapter added in v0.3.0

type TextFilterAdapter[S any, V ~string] struct {
	// contains filtered or unexported fields
}

TextFilterAdapter adapts a text row expression for datatable filters.

Example: expr.TextFilter(name)

func TextFilter added in v0.3.0

func TextFilter[S any, V ~string](e TextRowExpression[S, V]) TextFilterAdapter[S, V]

TextFilter adapts TextRowExpression for datatable filters.

Example: expr.TextFilter(e)

func (TextFilterAdapter[S, V]) Contains added in v0.3.0

func (a TextFilterAdapter[S, V]) Contains(v V) Predicate[S]

Contains tests a text substring within the adapter's row scope.

func (TextFilterAdapter[S, V]) Eq added in v0.3.0

func (a TextFilterAdapter[S, V]) Eq(v V) Predicate[S]

Eq compares equality within the adapter's row scope.

func (TextFilterAdapter[S, V]) Gt added in v0.3.0

func (a TextFilterAdapter[S, V]) Gt(v V) Predicate[S]

Gt compares greater than within the adapter's row scope.

func (TextFilterAdapter[S, V]) Gte added in v0.3.0

func (a TextFilterAdapter[S, V]) Gte(v V) Predicate[S]

Gte compares greater than or equal within the adapter's row scope.

func (TextFilterAdapter[S, V]) IContains added in v0.3.0

func (a TextFilterAdapter[S, V]) IContains(v V) Predicate[S]

IContains tests a text substring without case sensitivity within the adapter's row scope.

func (TextFilterAdapter[S, V]) In added in v0.3.0

func (a TextFilterAdapter[S, V]) In(vs ...V) Predicate[S]

In tests membership within the adapter's row scope.

func (TextFilterAdapter[S, V]) Like added in v0.3.0

func (a TextFilterAdapter[S, V]) Like(v V) Predicate[S]

Like tests a SQL text pattern within the adapter's row scope.

func (TextFilterAdapter[S, V]) Lt added in v0.3.0

func (a TextFilterAdapter[S, V]) Lt(v V) Predicate[S]

Lt compares less than within the adapter's row scope.

func (TextFilterAdapter[S, V]) Lte added in v0.3.0

func (a TextFilterAdapter[S, V]) Lte(v V) Predicate[S]

Lte compares less than or equal within the adapter's row scope.

func (TextFilterAdapter[S, V]) Ne added in v0.3.0

func (a TextFilterAdapter[S, V]) Ne(v V) Predicate[S]

Ne compares inequality within the adapter's row scope.

type TextRowExpression

type TextRowExpression[S any, V ~string] = textRowExpression[*S, V]

TextRowExpression is a row text calculation with typed comparisons.

Example: expr.TextLike(expr.Lower(name), "a%")

func Concat

func Concat[S any, V, W ~string](input RowValue[S, V], other RowValue[S, W]) TextRowExpression[S, string]

Concat concatenates text with SQL's strict NULL semantics.

Example: expr.Concat(input, other)

func ConcatWS

func ConcatWS[S any, V ~string](separator string, first RowValue[S, V], rest ...RowValue[S, V]) TextRowExpression[S, string]

ConcatWS joins text with a bound, non-null separator. SQL NULL inputs are skipped; empty strings are retained. The result is always a non-null string.

Example: expr.ConcatWS(separator, first, rest...)

func ConcatWSNullable

func ConcatWSNullable[S any, V ~string](separator string, first RowValue[S, value.Nullable[V]], rest ...RowValue[S, value.Nullable[V]]) TextRowExpression[S, string]

ConcatWSNullable joins text with a bound, non-null separator. SQL NULL inputs are skipped; empty strings are retained. The result is always a non-null string.

Example: expr.ConcatWSNullable(separator, first, rest...)

func Lower

func Lower[S any, V ~string](input RowValue[S, V]) TextRowExpression[S, string]

Text calculations return ordinary strings, preserving query scope and NULL separately from the input's named/domain string type and validation rules. Lower lowercases text using the database collation.

Example: expr.Lower(input)

func Replace

func Replace[S any, V, W, X ~string](input RowValue[S, V], other RowValue[S, W], replacement RowValue[S, X]) TextRowExpression[S, string]

Replace replaces literal occurrences of its second argument with its third.

Example: expr.Replace(input, other, replacement)

func Substring

func Substring[S any, V ~string](input RowValue[S, V], start int32, count int32) TextRowExpression[S, string]

Substring selects characters using PostgreSQL's one-based positions. Zero/negative starts follow SQL semantics. A negative count is rejected before execution.

Example: expr.Substring(input, start, count)

func SubstringAt

func SubstringAt[S any, V ~string, I integerNumber](input RowValue[S, V], start, count RowValue[S, I]) TextRowExpression[S, string]

SubstringAt uses typed integer expressions as positions. Database negative-count and SQL-integer overflow errors remain runtime errors. Positions are non-null.

Example: expr.SubstringAt(input, start, count)

func SubstringFrom

func SubstringFrom[S any, V ~string](input RowValue[S, V], start int32) TextRowExpression[S, string]

SubstringFrom selects characters using PostgreSQL's one-based positions. Zero/negative starts follow SQL semantics. It selects through the end.

Example: expr.SubstringFrom(input, start)

func TextRow

func TextRow[S any, V ~string](column orm.TextExpressionColumn[S, V, V]) TextRowExpression[S, V]

TextRow preserves a required text column capability.

Example: expr.TextRow(column)

func TextRowAt

func TextRowAt[S, M any, V ~string](scope Scope[S, M], column orm.TextExpressionColumn[M, V, V]) TextRowExpression[S, V]

TextRowAt preserves a required text column in a joined or aliased scope.

Example: expr.TextRowAt(scope, column)

func TextRowValue added in v0.4.0

func TextRowValue[S any, V ~string](v RowValue[S, V]) TextRowExpression[S, V]

TextRowValue exposes text comparisons on a computed row value without changing it.

Example: expr.TextLike(expr.TextRowValue(v), "a%")

func Trim

func Trim[S any, V ~string](input RowValue[S, V]) TextRowExpression[S, string]

Trim removes ordinary spaces from both ends.

Example: expr.Trim(input)

func TrimChars

func TrimChars[S any, V, W ~string](input RowValue[S, V], other RowValue[S, W]) TextRowExpression[S, string]

TrimChars removes characters in the second argument from both ends.

Example: expr.TrimChars(input, other)

func TrimLeft

func TrimLeft[S any, V ~string](input RowValue[S, V]) TextRowExpression[S, string]

TrimLeft removes ordinary spaces from the start.

Example: expr.TrimLeft(input)

func TrimLeftChars

func TrimLeftChars[S any, V, W ~string](input RowValue[S, V], other RowValue[S, W]) TextRowExpression[S, string]

TrimLeftChars removes characters in the second argument from the start.

Example: expr.TrimLeftChars(input, other)

func TrimRight

func TrimRight[S any, V ~string](input RowValue[S, V]) TextRowExpression[S, string]

TrimRight removes ordinary spaces from the end.

Example: expr.TrimRight(input)

func TrimRightChars

func TrimRightChars[S any, V, W ~string](input RowValue[S, V], other RowValue[S, W]) TextRowExpression[S, string]

TrimRightChars removes characters in the second argument from the end.

Example: expr.TrimRightChars(input, other)

func Upper

func Upper[S any, V ~string](input RowValue[S, V]) TextRowExpression[S, string]

Upper uppercases text using the database collation.

Example: expr.Upper(input)

type TextValueComparison

type TextValueComparison[S any, V ~string] = textValueComparison[*S, V]

TextValueComparison supplies selected text conditions for HAVING.

Example: expr.TextValue(selectedName)

func TextValue

func TextValue[S any, V ~string](v Selected[S, V]) TextValueComparison[S, V]

TextValue exposes selected text comparisons.

Example: expr.TextValue(v)

type TextValueFilterAdapter added in v0.3.0

type TextValueFilterAdapter[S any, V ~string] struct {
	// contains filtered or unexported fields
}

TextValueFilterAdapter supplies typed HAVING operations to datatable filters.

Example: expr.TextValueFilter(source)

func TextValueFilter added in v0.3.0

func TextValueFilter[S any, V ~string](source TextValueOperand[S, V]) TextValueFilterAdapter[S, V]

TextValueFilter adapts a selected comparison source without changing scope, value, or phase.

Example: expr.TextValueFilter(source)

func (TextValueFilterAdapter[S, V]) Contains added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Contains(v V) HavingPredicate[S]

Contains tests a text substring within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) Eq added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Eq(v V) HavingPredicate[S]

Eq compares equality within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) Gt added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Gt(v V) HavingPredicate[S]

Gt compares greater than within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) Gte added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Gte(v V) HavingPredicate[S]

Gte compares greater than or equal within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) IContains added in v0.3.0

func (a TextValueFilterAdapter[S, V]) IContains(v V) HavingPredicate[S]

IContains tests a text substring without case sensitivity within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) In added in v0.3.0

func (a TextValueFilterAdapter[S, V]) In(vs ...V) HavingPredicate[S]

In tests membership within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) Like added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Like(v V) HavingPredicate[S]

Like tests a SQL text pattern within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) Lt added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Lt(v V) HavingPredicate[S]

Lt compares less than within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) Lte added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Lte(v V) HavingPredicate[S]

Lte compares less than or equal within the adapter's HAVING scope.

func (TextValueFilterAdapter[S, V]) Ne added in v0.3.0

func (a TextValueFilterAdapter[S, V]) Ne(v V) HavingPredicate[S]

Ne compares inequality within the adapter's HAVING scope.

type TextValueOperand added in v0.3.0

type TextValueOperand[S any, V ~string] interface {
	OrderedValueOperand[S, V]
	// contains filtered or unexported methods
}

TextValueOperand supplies text comparisons in HAVING without losing the declared string type.

Example: var source expr.TextValueOperand[User, string] = expr.TextValue(selectedName)

type TimeZone

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

TimeZone names an explicitly selected IANA timezone; its zero value is invalid.

Example: expr.UTCZone()

func LoadTimeZone

func LoadTimeZone(name string) (TimeZone, error)

LoadTimeZone validates an explicit IANA timezone.

Example: expr.LoadTimeZone(name)

func UTCZone

func UTCZone() TimeZone

UTCZone selects UTC without a session default.

Example: expr.UTCZone()

func (TimeZone) String

func (z TimeZone) String() string

String returns the explicitly selected IANA timezone name.

type TimestampUnit

type TimestampUnit uint8

TimestampUnit identifies a timestamp boundary, including fractional seconds.

Example: expr.TimestampDay

const (
	TimestampMicrosecond TimestampUnit = TimestampUnit(unitMicrosecond)
	TimestampMillisecond TimestampUnit = TimestampUnit(unitMillisecond)
	TimestampSecond      TimestampUnit = TimestampUnit(unitSecond)
	TimestampMinute      TimestampUnit = TimestampUnit(unitMinute)
	TimestampHour        TimestampUnit = TimestampUnit(unitHour)
	TimestampDay         TimestampUnit = TimestampUnit(unitDay)
	TimestampWeek        TimestampUnit = TimestampUnit(unitWeek)
	TimestampMonth       TimestampUnit = TimestampUnit(unitMonth)
	TimestampQuarter     TimestampUnit = TimestampUnit(unitQuarter)
	TimestampYear        TimestampUnit = TimestampUnit(unitYear)
	TimestampDecade      TimestampUnit = TimestampUnit(unitDecade)
	TimestampCentury     TimestampUnit = TimestampUnit(unitCentury)
	TimestampMillennium  TimestampUnit = TimestampUnit(unitMillennium)
)

type ValueCase

type ValueCase[S, V any] struct {
	// contains filtered or unexported fields
}

ValueCase is unfinished selected CASE with group predicates and selected results.

Example: expr.WhenValue(expr.GtValue(count, 0), expr.AsSelected(count)).Else(expr.AsSelected(expr.ParamOf(count, 0)))

func WhenValue

func WhenValue[S, V any](condition HavingPredicate[S], result Selected[S, V]) ValueCase[S, V]

WhenValue starts selected CASE using group predicates and selected results.

Example: expr.WhenValue(condition, result)

func (ValueCase[S, V]) Else

func (c ValueCase[S, V]) Else(result Selected[S, V]) Selected[S, V]

Else finishes selected CASE with a matching selected fallback.

Example: choice.Else(expr.AsSelected(expr.ParamOf(count, 0)))

func (ValueCase[S, V]) ElseNull

func (c ValueCase[S, V]) ElseNull() Selected[S, value.Nullable[V]]

ElseNull finishes required-valued selected CASE with one nullable layer.

Example: expr.WhenValue(expr.GtValue(count, 0), expr.AsSelected(count)).ElseNull()

func (ValueCase[S, V]) When

func (c ValueCase[S, V]) When(condition HavingPredicate[S], result Selected[S, V]) ValueCase[S, V]

When appends an independent selected CASE branch.

Example: choice.When(expr.GtValue(count, 10), expr.AsSelected(count))

type ValueComparison

type ValueComparison[S, V any] = valueComparison[*S, V]

ValueComparison compares selected values without exposing row predicates.

Example: expr.EqValue(expr.CompareValue(selected), value)

func CompareValue

func CompareValue[S, V any](v Selected[S, V]) ValueComparison[S, V]

CompareValue exposes equality comparisons for a selected value.

Example: expr.CompareValue(v)

type ValueFilterAdapter added in v0.3.0

type ValueFilterAdapter[S any, V any] struct {
	// contains filtered or unexported fields
}

ValueFilterAdapter supplies typed HAVING operations to datatable filters.

Example: expr.ValueFilter(source)

func ValueFilter added in v0.3.0

func ValueFilter[S any, V any](source ValueOperand[S, V]) ValueFilterAdapter[S, V]

ValueFilter adapts a selected comparison source without changing scope, value, or phase.

Example: expr.ValueFilter(source)

func (ValueFilterAdapter[S, V]) Eq added in v0.3.0

func (a ValueFilterAdapter[S, V]) Eq(v V) HavingPredicate[S]

Eq compares equality within the adapter's HAVING scope.

func (ValueFilterAdapter[S, V]) In added in v0.3.0

func (a ValueFilterAdapter[S, V]) In(vs ...V) HavingPredicate[S]

In tests membership within the adapter's HAVING scope.

func (ValueFilterAdapter[S, V]) Ne added in v0.3.0

func (a ValueFilterAdapter[S, V]) Ne(v V) HavingPredicate[S]

Ne compares inequality within the adapter's HAVING scope.

type ValueOperand added in v0.3.0

type ValueOperand[S, V any] interface {
	// contains filtered or unexported methods
}

ValueOperand supplies literal comparisons in HAVING, retaining scope and value types. Nullable operands compare present values using their nullable codec.

Example: var source expr.ValueOperand[User, int64] = expr.Count[User]()

type ValueOrderSource added in v0.3.0

type ValueOrderSource[S, V any] interface {
	ParamSource[S, V]
	// contains filtered or unexported methods
}

ValueOrderSource is a selected or aggregate value that can supply selected ordering.

Example: var source expr.ValueOrderSource[User, int64] = expr.Count[User]()

type Window

type Window[S any] struct {
	// contains filtered or unexported fields
}

Window is an immutable scope-owned partition, order and frame. Its zero value means OVER ().

Example: expr.Window[User]{}.OrderBy(expr.Asc(expr.Value(orm.KeyExpr(Users.ID))))

func WindowFor

func WindowFor[S, M any](scope Scope[S, M]) Window[S]

WindowFor infers ownership from a concrete model/join/alias scope; it does not copy query ordering or pagination.

Example: expr.WindowFor(scope)

func (Window[S]) ExcludeCurrentRow

func (w Window[S]) ExcludeCurrentRow() Window[S]

ExcludeCurrentRow excludes the current row.

Example: w.ExcludeCurrentRow()

func (Window[S]) ExcludeGroup

func (w Window[S]) ExcludeGroup() Window[S]

ExcludeGroup excludes the current row and peers.

Example: w.ExcludeGroup()

func (Window[S]) ExcludeNone

func (w Window[S]) ExcludeNone() Window[S]

ExcludeNone restores the default exclusion.

Example: w.ExcludeNone()

func (Window[S]) ExcludeTies

func (w Window[S]) ExcludeTies() Window[S]

ExcludeTies excludes peers but retains the current row.

Example: w.ExcludeTies()

func (Window[S]) GroupsBetween

func (w Window[S]) GroupsBetween(start, end FrameBoundary) Window[S]

GroupsBetween replaces the peer-group frame; ordering is required.

Example: w.GroupsBetween(expr.Preceding(1), expr.CurrentRow())

func (Window[S]) Named

func (w Window[S]) Named(name string) Window[S]

Named registers a reusable definition emitted once per SELECT.

Example: w.Named("by_buyer")

func (Window[S]) OrderBy

func (w Window[S]) OrderBy(orders ...ProjectionOrder[S]) Window[S]

OrderBy appends row/selected ordering; it does not order the final result.

Example: w.OrderBy(expr.Desc(amount))

func (Window[S]) PartitionBy

func (w Window[S]) PartitionBy(keys ...GroupKey[S]) Window[S]

PartitionBy appends row keys without grouping the result.

Example: w.PartitionBy(expr.Group(buyer))

func (Window[S]) PartitionByValues

func (w Window[S]) PartitionByValues(keys ...ProjectionKey[S]) Window[S]

PartitionByValues appends selected keys, including aggregates.

Example: w.PartitionByValues(expr.Key(expr.AsSelected(count)))

func (Window[S]) RangeBetween

func (w Window[S]) RangeBetween(start, end FramePosition) Window[S]

RangeBetween defines a peer/unbounded frame without value distances.

Example: w.RangeBetween(expr.CurrentRow(), expr.UnboundedFollowing())

func (Window[S]) RowsBetween

func (w Window[S]) RowsBetween(start, end FrameBoundary) Window[S]

RowsBetween replaces the physical-row frame.

Example: w.RowsBetween(expr.Preceding(1), expr.CurrentRow())

Jump to

Keyboard shortcuts

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