Init project structure
Please consider supporting us by disabling your ad blocker ๐
So letโs start creating our project. Open Terminal and create a new directory named postgresql-intro in a location of your choice.
mkdir postgresql-intro
Go to the directory:
cd postgresql-intro
and create a new Go module for our project:
go mod init postgresql-intro
Then create three new directories in the postgresql-intro project:
mkdir cmd
mkdir website
mkdir app
The initial project tree should look like this:
postgresql-intro
โโโ app
โโโ cmd
โโโ go.mod
โโโ website
where:
go.modis the Go module definition.websiteis our domain package. We are going to create a mini ranking of websites, so we will put theWebsitedomain object, the repository definition, and its three implementations here.appis the package that will contain the demo procedure of our repository and that will be used by all apps in thecmddirectory.cmdis a directory that will contain three apps running our repository demo procedure, one for each repository implementation: with the classicdatabase/sqlapproach, with thepgxdatabase client, and with the GORM ORM.