Compare commits

...

2 Commits

Author SHA1 Message Date
4b55dbaacf v0.0.391
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s
2024-02-21 16:18:04 +01:00
c399fa42ae v0.0.390
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m26s
2024-02-21 16:11:15 +01:00
3 changed files with 24 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.389"
const GoextVersion = "0.0.391"
const GoextVersionTimestamp = "2024-02-21T16:10:28+0100"
const GoextVersionTimestamp = "2024-02-21T16:18:04+0100"

View File

@@ -265,6 +265,15 @@ func ArrFirstIndex[T comparable](arr []T, needle T) int {
return -1
}
func ArrFirstIndexFunc[T any](arr []T, comp func(v T) bool) int {
for i, v := range arr {
if comp(v) {
return i
}
}
return -1
}
func ArrLastIndex[T comparable](arr []T, needle T) int {
result := -1
for i, v := range arr {
@@ -275,6 +284,16 @@ func ArrLastIndex[T comparable](arr []T, needle T) int {
return result
}
func ArrLastIndexFunc[T any](arr []T, comp func(v T) bool) int {
result := -1
for i, v := range arr {
if comp(v) {
result = i
}
}
return result
}
func AddToSet[T comparable](set []T, add T) []T {
for _, v := range set {
if v == add {

View File

@@ -36,10 +36,10 @@ func NewPaginateFilter(sql func(params PP) (filterClause string, joinClause stri
}
}
func NewSimplePaginateFilter(filterClause string, params PP, sort []FilterSort) PaginateFilter {
func NewSimplePaginateFilter(filterClause string, filterParams PP, sort []FilterSort) PaginateFilter {
return genericPaginateFilter{
sql: func(params PP) (filterClause string, joinClause string, joinTables []string) {
params.AddAll(params)
sql: func(params PP) (string, string, []string) {
params.AddAll(filterParams)
return filterClause, "", nil
},
sort: func() []FilterSort {