Skip to content

Commit

Permalink
Remove unnecessary interface in orm.Query and orm.ExecQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenafamo committed Dec 11, 2024
1 parent fef0a80 commit 45fc611
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 43 deletions.
36 changes: 1 addition & 35 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,5 @@
# Changelog

<!--toc:start-->

- [Changelog](#changelog)
- [[v0.29.0] - 2024-11-20](#v0290-2024-11-20)
- [[v0.28.1] - 2024-06-28](#v0281-2024-06-28)
- [[v0.28.0] - 2024-06-25](#v0280-2024-06-25)
- [[v0.27.1] - 2024-06-05](#v0271-2024-06-05)
- [[v0.27.0] - 2024-06-05](#v0270-2024-06-05)
- [[v0.26.1] - 2024-05-26](#v0261-2024-05-26)
- [[v0.26.0] - 2024-05-21](#v0260-2024-05-21)
- [[v0.25.0] - 2024-01-20](#v0250-2024-01-20)
- [[v0.24.0] - 2024-01-20](#v0240-2024-01-20)
- [[v0.23.2] - 2024-01-04](#v0232-2024-01-04)
- [[v0.23.1] - 2024-01-03](#v0231-2024-01-03)
- [[v0.23.0] - 2024-01-03](#v0230-2024-01-03)
- [[v0.22.0] - 2023-08-18](#v0220-2023-08-18)
- [[v0.21.1] - 2023-05-22](#v0211-2023-05-22)
- [[v0.21.0] - 2023-05-09](#v0210-2023-05-09)
- [[v0.20.6] - 2023-04-25](#v0206-2023-04-25)
- [[v0.20.5] - 2023-04-14](#v0205-2023-04-14)
- [[v0.20.4] - 2023-04-07](#v0204-2023-04-07)
- [[v0.20.3] - 2023-04-06](#v0203-2023-04-06)
- [[v0.20.2] - 2023-04-05](#v0202-2023-04-05)
- [[v0.20.1] - 2023-04-04](#v0201-2023-04-04)
- [[v0.20.0] - 2023-04-03](#v0200-2023-04-03)
- [[v0.19.1] - 2023-03-21](#v0191-2023-03-21)
- [[v0.19.0] - 2023-03-19](#v0190-2023-03-19)
- [[v0.18.2] - 2023-03-18](#v0182-2023-03-18)
- [[v0.18.1] - 2023-03-16](#v0181-2023-03-16)
- [[v0.18.0] - 2023-03-12](#v0180-2023-03-12)
- [[v0.17.3] - 2023-03-11](#v0173-2023-03-11)
- [[v0.17.2] - 2023-03-09](#v0172-2023-03-09)

<!--toc:end-->

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
Expand All @@ -51,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

- Remove redundatnt type parameters from `orm.ExecQuery`.
- Remove unnecessary interface in `orm.Query` and `orm.ExecQuery`.

### Fixed

Expand Down
13 changes: 5 additions & 8 deletions orm/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ import (
"github.com/stephenafamo/scan"
)

type expression interface {
bob.Expression
RunHooks(ctx context.Context, exec bob.Executor) (context.Context, error)
}

type ExecQuery[Q expression] struct {
type ExecQuery[Q bob.Expression] struct {
bob.BaseQuery[Q]
Hooks *bob.Hooks[Q, bob.SkipQueryHooksKey]
}
Expand All @@ -25,7 +20,9 @@ func (q ExecQuery[Q]) Clone() ExecQuery[Q] {
}

func (q ExecQuery[Q]) RunHooks(ctx context.Context, exec bob.Executor) (context.Context, error) {
ctx, err := q.Expression.RunHooks(ctx, exec)
var err error

ctx, err = q.BaseQuery.RunHooks(ctx, exec)
if err != nil {
return ctx, err
}
Expand All @@ -47,7 +44,7 @@ func (q ExecQuery[Q]) Exec(ctx context.Context, exec bob.Executor) (int64, error
return result.RowsAffected()
}

type Query[Q expression, T any, Ts ~[]T] struct {
type Query[Q bob.Expression, T any, Ts ~[]T] struct {
ExecQuery[Q]
Scanner scan.Mapper[T]
}
Expand Down

0 comments on commit 45fc611

Please sign in to comment.