Clean Architecture with ent and gqlgen
$ cd docker
$ docker comopse up
$ make install
$ make setup_db
$ make migrate_schema
$ make start
$ make setup_test_db
$ make test_repository
$ make setup_e2e_db
$ make e2e
Clean Architecture with ent and gqlgen
Home Page: https://betterprogramming.pub/clean-architecture-with-ent-and-gqlgen-a789933a3665
Clean Architecture with ent and gqlgen
$ cd docker
$ docker comopse up
$ make install
$ make setup_db
$ make migrate_schema
$ make start
$ make setup_test_db
$ make test_repository
$ make setup_e2e_db
$ make e2e
While following your great tutorial on gqlgen/ent clean architecture on Medium, I am having difficulty binding my TodoStatus
from ent using the gqlgen.yaml
file using the following lines.
TodoStatus:
model:
- go-ent-gqlgen/ent/todo.Status
Despite spending quite some time trying to understand what I am missing here, I am still having the following error upon running the gqlgen
command, and I wanted to ask if it is familiar to you:
validation failed: packages.Load: -: package go-ent-gqlgen/graph/model is not in GOROOT (/usr/local/go/src/go-ent-gqlgen/graph/model)
At this point I am suspecting a wrong configuration of Go on my machine, but as someone relatively new to the language I was unable to find what is causing my issue. I would really appreciate if you could help me find the root cause.
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/floriannguyen/Library/Caches/go-build"
GOENV="/Users/floriannguyen/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/floriannguyen/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/floriannguyen/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/floriannguyen/go/src/github.com/florian-nguyen/go-ent-gqlgen/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6b/kd8wb_kx69ld3qr8h70qb0y80000gn/T/go-build2828287172=/tmp/go-build -gno-record-gcc-switches -fno-common"
And allow me at last to thank you for your articles. It is quite difficult to find advanced tutorials on Golang and I enjoy very much learning through yours.
Thank you,
Florian
I found your article about Clean Architecture. I found it insightful.
I am new to using ENT. Your use of mixin is quite interesting.
// UserMixin defines Fields
type UserMixin struct {
entMixin.Schema
}
// Fields of the User.
func (UserMixin) Fields() []ent.Field {
...
instead of defining fields of user
struct you defined them on UserMixin
struct. Why?
I am sorry for adding this as an issue.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.