This is repository + controller

```
package brand

import (
    "path/to/models"
    "gorm.io/gorm"

    "github.com/gin-gonic/gin"
)

type ResponseBrand struct {
    Items      []models.MasterBrand `json:"items"`
    TotalCount int                  `json:"total"`
}

type Repository interface {
    GetAll() (ResponseBrand, error)
}

type DBRepo struct {
    db *gorm.DB
}

func (repo *DBRepo) GetAll() (ResponseBrand, error) {
    var response ResponseBrand
    var brands []models.MasterBrand

    repo.db.Find(&brands)

    response.Items = brands
    response.TotalCount = len(brands)

    return response, nil
}

func list(c *gin.Context) {
    // this is an error
    res, _ := Repository.GetAll()
}

```

This for routing group

```
func ApplyRoutes(r *gin.RouterGroup) {
    brand := r.Group("/brand") {
        brand.GET("/", list)
    }
}

```

I try to implement repository in my project, but still stuck to call **Repository.GetAll()** in our controller function **list**. i use gin & gorm for this