Skip to content

Commit

Permalink
ZDatabase: Add count method
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslopezf committed Oct 31, 2023
1 parent 9a60456 commit 78c4030
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/zdb/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ func (z *zDatabase) Distinct(args ...interface{}) ZDatabase {
return wrap(z.db.Distinct(args...))
}

func (z *zDatabase) Count(count *int64) ZDatabase {
return wrap(z.db.Count(count))
}

func (z *zDatabase) Group(name string) ZDatabase {
return wrap(z.db.Group(name))
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/zdb/mock_zdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ func (m *MockZDatabase) Distinct(params ...interface{}) ZDatabase {
return args.Get(0).(ZDatabase)
}

func (m *MockZDatabase) Count(count *int64) ZDatabase {
args := m.Called(count)
return args.Get(0).(ZDatabase)
}

func (m *MockZDatabase) Scopes(funcs ...func(ZDatabase) ZDatabase) ZDatabase {
args := m.Called(funcs)
return args.Get(0).(ZDatabase)
Expand Down
1 change: 1 addition & 0 deletions pkg/zdb/zdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type ZDatabase interface {
Offset(offset int) ZDatabase
Order(value interface{}) ZDatabase
Distinct(args ...interface{}) ZDatabase
Count(count *int64) ZDatabase
Group(name string) ZDatabase
Create(value interface{}) ZDatabase
Delete(value interface{}, where ...interface{}) ZDatabase
Expand Down

0 comments on commit 78c4030

Please sign in to comment.