Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/golang.org/x/tools-0…
Browse files Browse the repository at this point in the history
….15.0
  • Loading branch information
tr1v3r committed Dec 21, 2023
2 parents 25fea0e + 9675153 commit fe93f65
Show file tree
Hide file tree
Showing 6 changed files with 2,684 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ jobs:
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: '--timeout 5m'
12 changes: 12 additions & 0 deletions do_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@ func TestDO_methods(t *testing.T) {
Expr: u.Order(u.ID.Desc()).Order(u.Age),
Result: "ORDER BY `id` DESC,`age`",
},
{
Expr: u.Order(u.ID.Asc()),
Result: "ORDER BY `id` ASC",
},
{
Expr: u.Order(u.ID.Asc(), u.Age),
Result: "ORDER BY `id` ASC,`age`",
},
{
Expr: u.Order(u.ID.Asc()).Order(u.Age),
Result: "ORDER BY `id` ASC,`age`",
},
{
Expr: u.Clauses(hints.New("hint")).Select(),
Result: "SELECT /*+ hint */ *",
Expand Down
4 changes: 4 additions & 0 deletions field/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ func TestExpr_Build(t *testing.T) {
Expr: field.NewAsterisk("user").Count(),
Result: "COUNT(`user`.*)",
},
{
Expr: field.ALL.Count().As("num"),
Result: "COUNT(*) AS `num`",
},
{
Expr: field.NewAsterisk("user").Distinct().Count(),
Result: "COUNT(DISTINCT `user`.*)",
Expand Down
7 changes: 7 additions & 0 deletions field/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Expr interface {
type OrderExpr interface {
Expr
Desc() Expr
Asc() Expr
}

type expression interface{}
Expand Down Expand Up @@ -274,10 +275,16 @@ func (e expr) As(alias string) Expr {
return e
}

// Desc sort by desc
func (e expr) Desc() Expr {
return e.setE(clause.Expr{SQL: "? DESC", Vars: []interface{}{e.RawExpr()}})
}

// Asc sort by asc
func (e expr) Asc() Expr {
return e.setE(clause.Expr{SQL: "? ASC", Vars: []interface{}{e.RawExpr()}})
}

// ======================== general experssion ========================
func (e expr) value(value interface{}) AssignExpr {
return e.setE(clause.Eq{Column: e.col.Name, Value: value})
Expand Down
25 changes: 12 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
golang.org/x/tools v0.15.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/datatypes v1.1.1-0.20230130040222-c43177d3cf8c
gorm.io/driver/clickhouse v0.5.0
gorm.io/driver/clickhouse v0.6.0
gorm.io/driver/mysql v1.5.1-0.20230509030346-3715c134c25b
gorm.io/driver/postgres v1.4.5
gorm.io/driver/sqlite v1.4.3
Expand All @@ -17,15 +17,15 @@ require (
)

require (
github.com/ClickHouse/ch-go v0.48.0 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.3.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/ClickHouse/ch-go v0.58.2 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.15.0 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.13.0 // indirect
Expand All @@ -37,19 +37,18 @@ require (
github.com/jackc/pgx/v4 v4.17.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/microsoft/go-mssqldb v0.17.0 // indirect
github.com/paulmach/orb v0.7.1 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/paulmach/orb v0.10.0 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/stretchr/testify v1.8.2 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/trace v1.10.0 // indirect
golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/text v0.13.0 // indirect
)
Loading

0 comments on commit fe93f65

Please sign in to comment.