Skip to content

Instantly share code, notes, and snippets.

@manakuro
Created December 10, 2021 04:41
Show Gist options
  • Save manakuro/d2bfe304a9781b6d93625e2b41da2f3d to your computer and use it in GitHub Desktop.
Save manakuro/d2bfe304a9781b6d93625e2b41da2f3d to your computer and use it in GitHub Desktop.
package controller
import (
"context"
"golang-clean-architecture-ent-gqlgen/pkg/entity/model"
"golang-clean-architecture-ent-gqlgen/pkg/usecase/usecase"
)
type user struct {
userUsecase usecase.User
}
// User of interface
type User interface {
Get(ctx context.Context, id *int) (*model.User, error)
}
// NewUserController returns user controller
func NewUserController(uu usecase.User) User {
return &user{userUsecase: uu}
}
func (u *user) Get(ctx context.Context, id *int) (*model.User, error) {
return u.userUsecase.Get(ctx, id)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment