repository-pattern

module
v0.0.0-...-baeefe5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2020 License: MIT

README

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.

Directories

Path Synopsis
Domain models package, includes Repository interface
Domain models package, includes Repository interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL