@rivascva/dt-idl 1.1.130 → 1.1.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/go/psql/utils.go +11 -0
- package/package.json +1 -1
package/go/psql/utils.go
CHANGED
|
@@ -41,6 +41,17 @@ func GetSelectAllQuery(table string, where ...Where) (string, []any, error) {
|
|
|
41
41
|
return builder.ToSql()
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// GetSelectAllQueryWithLimit builds and returns the query and arguments to perform a select all query on the given table with a limit.
|
|
45
|
+
// Provide a where map to specify which rows to select. A nil value will select all rows.
|
|
46
|
+
func GetSelectAllQueryWithLimit(table string, limit int, where ...Where) (string, []any, error) {
|
|
47
|
+
builder := sq.Select("*").From(table)
|
|
48
|
+
for _, mp := range where {
|
|
49
|
+
builder = builder.Where(mp)
|
|
50
|
+
}
|
|
51
|
+
builder.Limit(uint64(limit))
|
|
52
|
+
return builder.ToSql()
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
// GetSelectColumnQuery builds and returns the query and arguments to perform a select column query on the given table.
|
|
45
56
|
// Provide a where map to specify which rows to select. A nil value will select all rows.
|
|
46
57
|
func GetSelectColumnQuery(table string, column string, where ...Where) (string, []any, error) {
|