Fix codegen when search cfg is sorting&&!paging
This commit is contained in:
@@ -73,13 +73,17 @@ func (s Store) {{ toggleExport .Search.Export "Search" $.Types.Plural }}(ctx con
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
{{ end }}
|
||||
|
||||
{{ if $.Search.EnableSorting }}
|
||||
{{ if and $.Search.EnableSorting $.Search.EnablePaging }}
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
{{ else if $.Search.EnablePaging }}
|
||||
// Sorting is disabled in definition yaml file
|
||||
// {search: {enableSorting:false}}
|
||||
@@ -93,7 +97,7 @@ func (s Store) {{ toggleExport .Search.Export "Search" $.Types.Plural }}(ctx con
|
||||
{{ end }}
|
||||
|
||||
return set, f, s.config.ErrorHandler(func() error {
|
||||
{{- if $.Search.EnablePaging }}
|
||||
{{- if $.Search.EnablePaging -}}
|
||||
set, err = s.{{ unexport "fetchFullPageOf" $.Types.Plural }}(ctx{{ template "extraArgsCall" . }}, q, curSort, f.PageCursor, f.Limit, {{ if $.Search.EnableFilterCheckFn }}f.Check{{ else }}nil{{ end }},)
|
||||
|
||||
if err != nil {
|
||||
@@ -114,6 +118,13 @@ func (s Store) {{ toggleExport .Search.Export "Search" $.Types.Plural }}(ctx con
|
||||
f.PageCursor = nil
|
||||
return nil
|
||||
{{- else }}
|
||||
{{- if $.Search.EnableSorting }}
|
||||
// Apply sorting expr from filter to query
|
||||
if q, err = setOrderBy(q, f.Sort, s.sortable{{ export $.Types.Singular }}Columns()...); err != nil {
|
||||
return err
|
||||
}
|
||||
{{ end -}}
|
||||
|
||||
set, _, _, err = s.{{ export "query" $.Types.Plural }}(ctx{{ template "extraArgsCall" . }}, q, {{ if $.Search.EnableFilterCheckFn }}f.Check{{else}}nil{{ end }})
|
||||
return err
|
||||
{{ end }}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchApplications(ctx context.Context, f types.ApplicationFilter
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchComposeCharts(ctx context.Context, f types.ChartFilter) (ty
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchComposeModules(ctx context.Context, f types.ModuleFilter) (
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchComposeNamespaces(ctx context.Context, f types.NamespaceFil
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchComposePages(ctx context.Context, f types.PageFilter) (type
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) searchComposeRecords(ctx context.Context, _mod *types.Module, f t
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchMessagingChannels(ctx context.Context, f types.ChannelFilte
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchReminders(ctx context.Context, f types.ReminderFilter) (typ
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchRoles(ctx context.Context, f types.RoleFilter) (types.RoleS
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
@@ -43,9 +43,12 @@ func (s Store) SearchUsers(ctx context.Context, f types.UserFilter) (types.UserS
|
||||
// This tells us to flip the descending flag on all used sort keys
|
||||
reversedCursor := f.PageCursor != nil && f.PageCursor.Reverse
|
||||
|
||||
// Sorting and paging are both enabled in definition yaml file
|
||||
// {search: {enableSorting:true, enablePaging:true}}
|
||||
curSort := f.Sort.Clone()
|
||||
|
||||
// If paging with reverse cursor, change the sorting
|
||||
// direction for all columns we're sorting by
|
||||
curSort := f.Sort.Clone()
|
||||
if reversedCursor {
|
||||
curSort.Reverse()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user