Count method
This commit is contained in:
@ -20,10 +20,11 @@ type RepoBase[T schema.Tabler] struct {
|
||||
ListMethod[T]
|
||||
GetMethod[T]
|
||||
ExistsMethod[T]
|
||||
CountMethod[T]
|
||||
methods []MethodInitInterface[T]
|
||||
}
|
||||
|
||||
func (repo *RepoBase[T]) InitMethods(dbConn *gorm.DB) {
|
||||
func (repo *RepoBase[T]) InitMethods() {
|
||||
for _, method := range repo.methods {
|
||||
method.Init(repo)
|
||||
}
|
||||
@ -41,6 +42,11 @@ func (m *RepoBase[T]) Init(dbConn *gorm.DB, options *RepoOptions) {
|
||||
}
|
||||
}
|
||||
|
||||
m.methods = []MethodInitInterface[T]{&m.ListMethod, &m.GetMethod, &m.ExistsMethod}
|
||||
m.InitMethods(dbConn)
|
||||
m.methods = []MethodInitInterface[T]{
|
||||
&m.ListMethod,
|
||||
&m.GetMethod,
|
||||
&m.ExistsMethod,
|
||||
&m.CountMethod,
|
||||
}
|
||||
m.InitMethods()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user