-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathselect.go
49 lines (39 loc) · 1 KB
/
select.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package content
import (
"context"
"log"
"github.com/volatiletech/sqlboiler/boil"
"github.com/volatiletech/sqlboiler/queries/qm"
"github.com/pongsanti/content/db/models"
)
func Select(
ctx context.Context, exec boil.ContextExecutor, qmods []qm.QueryMod) (
models.ContentSlice, error) {
log.Print("Content:Select")
var queryMods []qm.QueryMod
if qmods != nil {
queryMods = qmods
}
return models.Contents(queryMods...).All(ctx, exec)
}
func SelectOne(
ctx context.Context, exec boil.ContextExecutor, qmods []qm.QueryMod) (
*models.Content, error) {
log.Print("Content:SelectOne")
var queryMods []qm.QueryMod
if qmods != nil {
queryMods = qmods
}
return models.Contents(queryMods...).One(ctx, exec)
}
func SelectCount(
ctx context.Context, exec boil.ContextExecutor, qmods []qm.QueryMod) (
int, error) {
log.Print("Content:SelectCount")
var queryMods []qm.QueryMod
if qmods != nil {
queryMods = qmods
}
count, err := models.Contents(queryMods...).Count(ctx, exec)
return int(count), err
}