feat: search

This commit is contained in:
2025-03-15 18:43:43 +07:00
parent b26de27165
commit 8e7b0ab472
5 changed files with 140 additions and 58 deletions

View File

@@ -55,8 +55,12 @@ const CountRawTemplate = `func (service *{{.ServiceName}}) Count() (int64, error
return amount, err
}`
const SortedByOrderTemplate = `func (service *{{.ServiceName}}) SortedByOrder(fieldsSortOrder map[string]string) ([]*{{.EntityType}}, error) {
return utils.SortByOrder(fieldsSortOrder, {{.EntityType}}{})
const SortedByOrderTemplate = `func (service *{{.ServiceName}}) SortedByOrder(fieldsSortingOrder []utils.SortField) ([]*{{.EntityType}}, error) {
return utils.SortByOrder(fieldsSortingOrder, {{.EntityType}}{})
}`
var implementedMethods = []string{CreateMethod, GetAllMethod, GetByIdMethod, UpdateMethod, DeleteMethod, CountMethod, SortedByOrderMethod}
const SearchByAllStringFields = `func (service *{{.ServiceName}}) SearchByAllTextFields(phrase string) ([]*{{.EntityType}}, error) {
return utils.FindPhraseByStringFields[{{.EntityType}}](phrase, {{.EntityType}}{})
}`
var implementedMethods = []string{CreateMethod, GetAllMethod, GetByIdMethod, UpdateMethod, DeleteMethod, CountMethod, SortedByOrderMethod, SearchByAllStringFields}