we have fixtures ladies and gentleman
This commit is contained in:
@@ -92,6 +92,11 @@ func (l *listgetter[T]) Where(query string, args ...any) *listgetter[T] {
|
||||
return l
|
||||
}
|
||||
|
||||
func (l *listgetter[T]) Order(orders ...string) *listgetter[T] {
|
||||
l.q = l.q.Order(orders...)
|
||||
return l
|
||||
}
|
||||
|
||||
func (l *listgetter[T]) Relation(name string, apply ...func(*bun.SelectQuery) *bun.SelectQuery) *listgetter[T] {
|
||||
l.q = l.q.Relation(name, apply...)
|
||||
return l
|
||||
@@ -130,6 +135,14 @@ func (l *listgetter[T]) GetPaged(ctx context.Context, pageOpts, defaults *PageOp
|
||||
return list, nil
|
||||
}
|
||||
|
||||
func (l *listgetter[T]) Count(ctx context.Context) (int, error) {
|
||||
count, err := l.q.Count(ctx)
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "query.Count")
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (l *listgetter[T]) GetAll(ctx context.Context) ([]*T, error) {
|
||||
err := l.q.Scan(ctx)
|
||||
if err != nil && errors.Is(err, sql.ErrNoRows) {
|
||||
|
||||
Reference in New Issue
Block a user