From 1b1bc8da447447440a214f8bd5a721dd9dc2cf73 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 5 Dec 2026 20:27:52 +0000 Subject: Reorder fields to match syntax --- .../output/generators/sql/SqlGenerator.java | 4 +- .../output/lang/sql/ast/SqlSelectStatement.java | 52 +++++++++++----------- 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/sql/SqlGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/sql/SqlGenerator.java index 1abdccb..3326f04 100644 --- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/sql/SqlGenerator.java +++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/sql/SqlGenerator.java @@ -113,8 +113,8 @@ public class SqlGenerator { return new SqlSelectStatement( columns, generateTableName(table.name()), - orderBy, - Optional.empty() + Optional.empty(), + orderBy ); } diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/sql/ast/SqlSelectStatement.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/sql/ast/SqlSelectStatement.java index f7627a8..681f4c1 100644 --- a/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/sql/ast/SqlSelectStatement.java +++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/lang/sql/ast/SqlSelectStatement.java @@ -8,73 +8,73 @@ package org.zwobble.hobgoblin.compiler.output.lang.sql.ast; public record SqlSelectStatement( java.util.List columns, org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlIdentifier from, - java.util.List orderBy, - java.util.Optional where + java.util.Optional where, + java.util.List orderBy ) implements org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlStatement { public static org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder arbitrary() { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(java.util.List.of(), org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlIdentifier.arbitrary().build(), java.util.List.of(), java.util.Optional.empty()); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(java.util.List.of(), org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlIdentifier.arbitrary().build(), java.util.Optional.empty(), java.util.List.of()); } public record Builder( java.util.List columns, org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlIdentifier from, - java.util.List orderBy, - java.util.Optional where + java.util.Optional where, + java.util.List orderBy ) implements org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlStatement.Builder { public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement build() { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement(columns, from, orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement(columns, from, where, orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withColumns(java.util.List columns) { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder addColumn(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlResultColumn column) { var columns = new java.util.ArrayList(this.columns); columns.add(column); - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder addColumn(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlResultColumn.Builder column) { var columns = new java.util.ArrayList(this.columns); columns.add(column.build()); - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withFrom(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlIdentifier from) { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withFrom(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlIdentifier.Builder from) { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from.build(), orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from.build(), where, orderBy); + } + + public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withWhere(java.util.Optional where) { + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); + } + + public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withWhere(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlExpression where) { + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, java.util.Optional.of(where), orderBy); + } + + public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withWhere(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlExpression.Builder where) { + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, java.util.Optional.of(where.build()), orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withOrderBy(java.util.List orderBy) { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder addOrderByElement(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlOrderingTerm orderByElement) { var orderBy = new java.util.ArrayList(this.orderBy); orderBy.add(orderByElement); - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); } public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder addOrderByElement(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlOrderingTerm.Builder orderByElement) { var orderBy = new java.util.ArrayList(this.orderBy); orderBy.add(orderByElement.build()); - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); - } - - public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withWhere(java.util.Optional where) { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, where); - } - - public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withWhere(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlExpression where) { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, java.util.Optional.of(where)); - } - - public org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder withWhere(org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlExpression.Builder where) { - return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, orderBy, java.util.Optional.of(where.build())); + return new org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder(columns, from, where, orderBy); } // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.sql.ast.SqlSelectStatement.Builder body -- cgit v1.2.3