make count works
This commit is contained in:
parent
5fd2e0d54f
commit
ae68c0fb47
2
main.go
2
main.go
@ -228,7 +228,7 @@ func (s *DB) Pluck(column string, value interface{}) *DB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *DB) Count(value interface{}) *DB {
|
func (s *DB) Count(value interface{}) *DB {
|
||||||
return s.do(s.Value).count(value).db
|
return s.NewScope(s.Value).count(value).db
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DB) Table(name string) *DB {
|
func (s *DB) Table(name string) *DB {
|
||||||
|
6
scope.go
6
scope.go
@ -424,3 +424,9 @@ func (scope *Scope) pluck(column string, value interface{}) *Scope {
|
|||||||
}
|
}
|
||||||
return scope
|
return scope
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (scope *Scope) count(value interface{}) *Scope {
|
||||||
|
scope.Search = scope.Search.clone().selects("count(*)")
|
||||||
|
scope.Err(scope.row().Scan(value))
|
||||||
|
return scope
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user