shared/generate/db/parse.go
func Filters(pkg *ast.Package, entity string) [][]string {
	objects := pkg.Scope.Objects
	filters := [][]string{}

	prefix := fmt.Sprintf("%sObjectsBy", entity)

	for name := range objects {
		if !strings.HasPrefix(name, prefix) {
			continue
		}
		rest := name[len(prefix):]
		filters = append(filters, strings.Split(rest, "And"))
	}

	sort.SliceStable(filters, func(i, j int) bool {
		return len(filters[i]) > len(filters[j])
	})

	return filters
}
func Filters(pkg *ast.Package, entity string) [][]string {
	objects := pkg.Scope.Objects
	filters := [][]string{}

	prefix := fmt.Sprintf("%sObjectsBy", entity)

	for name := range objects {
		if !strings.HasPrefix(name, prefix) {
			continue
		}
		rest := name[len(prefix):]
		filters = append(filters, strings.Split(rest, "And"))
	}

	sort.SliceStable(filters, func(i, j int) bool {
		return len(filters[i]) > len(filters[j])
	})

	return filters
}
func Filters ( pkg * ast . Package , entity string ) [ ] [ ] string { objects := pkg . Scope . Objects filters := [ ] [ ] string { } prefix := fmt . Sprintf ( " " , entity ) for name := range objects { if ! strings . HasPrefix ( name , prefix ) { continue } rest := name [ len ( prefix ) : ] filters = append ( filters , strings . Split ( rest , " " ) ) } sort . SliceStable ( filters , func ( i , j int ) bool { return len ( filters [ i ] ) > len ( filters [ j ] ) } ) return filters }
// Filters parses all filtering statement defined for the given entity. It
// returns all supported combinations of filters, sorted by number of criteria.
Filters parses all filtering statement defined for the given entity . It returns all supported combinations of filters sorted by number of criteria .