orgInfo-generator
backend (Golang)
orginfo-generator is a generator tool, which create a back-end structure
Powered by |
|
please notice me if you have any other idea ...
Quick Construction (Ubuntu 22.04.1 LTS)
- install go from official website https://golang.ir/
- set $GOROOT:/usr/local/go/bin & $GOPATH/src: ~/go/src
- run project_creator
you can find default of file in this address: [sample structure](input_struct.json)
Domain generator
to create new domain with CRUD operation and other prerequisite:
go get -u github.com/ar-mokhtari/orginfo-generator
cd ~/go/src &&
project_name="myproject" &&
mkdir -p -m777 $project_name/cli/generator &&
echo "package main
import \"github.com/ar-mokhtari/orginfo-generator\"
func main() {
generator.New()
}
" > $project_name/cli/generator/main.go &&
> $project_name/go.mod && cd $project_name/cli/generator && go mod tidy && go get -u github.com/ar-mokhtari/orginfo-generator && go build && export GO111MODULE="off" && go get ./. && export GO111MODULE="auto" && go mod tidy
pattern #1
input from command and flag one by one:
cd go/src/$project_name/cli/generator/bin
./generator sub-command -domain_name="DOMAIN NAME" -fields="field1-string-field1_1,field2-uint-field1_2,..." && go mod tidy
run this for add a new domain:
./generator new -domain_name="DOMAIN_NAME" -fields="codeType-uint-code_type,code-uint-code" && go mod tidy
Also, to remove a domain run this:
./generator delete -domain_name="DOMAIN_NAME" && go mod tidy
pattern #2
import domain(s) from json type file ...
./generator new -from_file && go mod tidy
remove domain(s) from json type file ...
./generator delete -from_file && go mod tidy
the file name must be: `input.json`. in this address: `/config/cli/generator/`
you can find default of file in this address: [sample structure](input_struct.json)
[
{
"domain_name": "string",
"fields": [
{
"name": "string",
"type": "string",
"json_name": "string"
}
]
}
]
https://user-images.githubusercontent.com/49469395/194825671-d93fe8e4-64fb-4c67-a8fb-c5e29e55e16c.mp4
Json collection
To use and call from API platform like "Postman":
/docs/orginfo.postman_collection.json
Git
for continue on existing repo:
cd existing_repo
git remote add origin `git address`
git branch -M main
git push -uf origin main
for clone
git clone [email protected]:ar-mokhtari/orginfo.git
for production, there is stable main branch:
git checkout main
for develop:
git checkout -b developing
after all, back to main:
git merge --no-ff developing
Docker (compose)
for detail see:
docker-compose.yaml
docker compose up -d