Skip to content

v0.7.0

Latest
Compare
Choose a tag to compare
@System-Glitch System-Glitch released this 11 Jun 14:38
· 4 commits to master since this release
4b44f9e

The library has been upgraded for Goyave v5.

The filters library didn't allow decoupling of the HTTP layer and the data layer because of its dependency to the *goyave.Request. It was therefore impossible to move its uses to a repository, where they belongs. By creating a DTO for this specific use and changing the error handling, filters can now be properly integrated in the new architecture. They were also upgraded to take advantage of the generics.

  • filter.Settings, filter.Scope(), filter.ScopeUnpaginated() now take a generic parameter representing the model being filtered.
  • filter.Settings.CaseInsensitiveSort new option wraps the sort values in LOWER() if the column is a string, resulting in ORDER BY LOWER(column).
  • filter.Settings.DefaultSort new option allows to define a list of sorts to be used if the user request didn't contain any sort.
  • filter.Settings.Scope(), filter.Settings.ScopeUnpaginated(), filter.Scope(), filter.ScopeUnpaginated() now take a *filter.Request instead of a *goyave.Request. This request can be created from a HTTP query with the new function filter.NewRequest(query).
  • filter.Settings.Scope() and filter.Scope() now return an error instead of a *gorm.DB.
  • filter.Filter.Scope(), filter.Join.Scope(), filter.Sort.Scope() now take a filter.Blacklist instead of *filter.Settings.
  • filter.Validation is now a goyave.RuleSetFunc, and should be used with route.ValidateQuery().
  • The field fields in a request validated with filter.Validation will now always be a []string.
  • The page info and records SQL queries are now executed inside a transaction.
  • Validation error messages names had a "goyave-filter-" prefix added.