Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Last active May 22, 2021 10:32
Show Gist options
  • Save dipeshhkc/9229f37f959685040ac6bc13beb6b674 to your computer and use it in GitHub Desktop.
Save dipeshhkc/9229f37f959685040ac6bc13beb6b674 to your computer and use it in GitHub Desktop.
package repository
import (
"mini-ecommerce/model"
"github.com/jinzhu/gorm"
)
type UserRepository interface {
AddUser(model.User) (model.User, error)
GetUser(int) (model.User, error)
GetByEmail(string) (model.User, error)
GetAllUser() ([]model.User, error)
UpdateUser(model.User) (model.User, error)
DeleteUser(model.User) (model.User, error)
GetProductOrdered(int) ([]model.Order, error)
}
type userRepository struct {
connection *gorm.DB
}
func NewUserRepository() UserRepository {
return &userRepository{
connection: DB(),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment