Skip to content

Commit

Permalink
fix(orderby): improved OrderByBuilder for api input
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlangzi committed Apr 12, 2024
1 parent c865e63 commit 41d5da8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ 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.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.3] - 2014-04-12
### Fixes
- fixed close issue when it fails to build prepareStmt (#33)
- improved `OrderByBuilder` for api input (#34)

## [1.4.2] - 2014-04-10
### Added
- added `OrderByBuilder` to prevent sql injection (#32, #33)
Expand Down
6 changes: 3 additions & 3 deletions sqlbuilder_orderby_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ func TestOrderByBuilder(t *testing.T) {
wanted: "SELECT * FROM users ORDER BY id ASC, created_at DESC, updated_at ASC",
},
{
name: "order_by_raw_sqll_should_work",
name: "order_by_raw_sql_should_work",
build: func() *Builder {
b := New("SELECT * FROM users")
b.Order("id", "created_at", "updated_at").
By("created_at desc, id, name asc, updated_at asc")
b.Order("id", "created_at", "updated_at", "age").
By("created_at desc, id, name asc, updated_at asc, age invalid_by, unsafe_asc, unsafe_desc desc")

return b
},
Expand Down

0 comments on commit 41d5da8

Please sign in to comment.