updated dependencies and go
This commit is contained in:
+5
-3
@@ -6,6 +6,7 @@ import (
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/exerr"
|
||||
"git.blackforestbytes.com/BlackForestBytes/goext/langext"
|
||||
pag "git.blackforestbytes.com/BlackForestBytes/goext/pagination"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func Paginate[TData any](ctx context.Context, q Queryable, table string, filter PaginateFilter, scanMode StructScanMode, scanSec StructScanSafety, page int, limit *int) ([]TData, pag.Pagination, error) {
|
||||
@@ -34,12 +35,13 @@ func Paginate[TData any](ctx context.Context, q Queryable, table string, filter
|
||||
|
||||
filterCond, joinCond, joinTables := filter.SQL(prepParams)
|
||||
|
||||
selectCond := table + ".*"
|
||||
var selectCond strings.Builder
|
||||
selectCond.WriteString(table + ".*")
|
||||
for _, v := range joinTables {
|
||||
selectCond += ", " + v + ".*"
|
||||
selectCond.WriteString(", " + v + ".*")
|
||||
}
|
||||
|
||||
sqlQueryData := "SELECT " + selectCond + " FROM " + table + " " + joinCond + " WHERE ( " + filterCond + " ) " + sortCond + " " + pageCond
|
||||
sqlQueryData := "SELECT " + selectCond.String() + " FROM " + table + " " + joinCond + " WHERE ( " + filterCond + " ) " + sortCond + " " + pageCond
|
||||
sqlQueryCount := "SELECT " + "COUNT(*)" + " FROM " + table + " " + joinCond + " WHERE ( " + filterCond + " ) "
|
||||
|
||||
rows, err := q.Query(ctx, sqlQueryData, prepParams)
|
||||
|
||||
Reference in New Issue
Block a user