Skip to content

hendratommy/repository-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

repository-pattern

Implements Repository Pattern in Go.

Normally when implementing repository pattern peoples tends to forgot/not considering transaction. Thus makes the service layer/usecase layer to manually deal with the underlying database driver directly, which defeat the purpose of using repository pattern in the first place.

In java we usually use spring to create transaction and wire it to repository for us, thus enable us to write repository without thinking about transaction. In Go there is no magic to do that, we must implement it by ourselves. This repository try to implement repository with transaction supports.

This repository uses two persistence type (mongodb and postgresql) that you can switch one to another without affecting the logic that use the repository.

See main to try it out. See tests for more detailed.

About

Implements `Repository Pattern` in `Go`.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages