About | Features | Technologies | Requirements | Usage | License | Author
Gorm Repository Boilerplate is a boilerplate for gorm repository pattern. It is a providing basic functions to CRUD and query entities as well as transactions and common error handling. It is a good starting point for gorm repository pattern.
✔️ CRUD
The following tools were used in this project:
Before starting 🏁, you need to have Go installed.
package base
import "github.com/bangadam/gorm-repository-boilerplate"
type BaseRepository interface {
gormrepository.TransactionRepository
FindByName(target interface{}, name string, preloads ...string) error
}
type repository struct {
gormrepository.TransactionRepository
}
func NewRepository(db *gorm.DB, logger logging.Logger) BaseRepository {
return &repository{
TransactionRepository: gormrepository.NewGormRepository(db, logger, "Creator"),
}
}
func (r *repository) FindByName(target interface{}, name string, preloads ...string) error {
return r.TransactionRepository.FindOneByField(target, "name", name, preloads...)
}
This project is under license from MIT. For more details, see the LICENSE file.
Made with ❤️ by bangadam