Skip to content

Commit

Permalink
rename SetDefaultQueryHooks(...) => SetDefaultQueryHook(...)
Browse files Browse the repository at this point in the history
  • Loading branch information
alimy committed Mar 30, 2023
1 parent efadd51 commit 91bd63e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func yesqlScan[T any](query yesql.SQLQuery, obj T) T {
func initSqlxDB() {
_db = conf.MustSqlxDB()
yesql.UseSqlx(_db)
yesql.SetDefaultQueryHooks(func(query *yesql.Query) (*yesql.Query, error) {
yesql.SetDefaultQueryHook(func(query *yesql.Query) (*yesql.Query, error) {
qstr := strings.TrimRight(query.Query, ";")
// table name fixed
qstr = strings.Replace(qstr, "@", conf.DatabaseSetting.TablePrefix, -1)
Expand Down
4 changes: 2 additions & 2 deletions yesql.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func SetDefaultPrepareHook(hook PrepareHook) {
}
}

// SetDefaultQueryHooks set default query hooks
func SetDefaultQueryHooks(hooks ...func(query *Query) (*Query, error)) {
// SetDefaultQueryHook set default query hooks
func SetDefaultQueryHook(hooks ...func(query *Query) (*Query, error)) {
_defaultQueryHooks = nil
for _, hook := range hooks {
if hook != nil {
Expand Down

0 comments on commit 91bd63e

Please sign in to comment.