generator

package module
v0.0.0-...-2a873f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 13 Imported by: 1

README

orgInfo-generator

backend (Golang)


go version 

orginfo-generator is a generator tool, which create a back-end structure

Powered by

cgapp logo

please notice me if you have any other idea ...

Gmail Telegram

Quick Construction (Ubuntu 22.04.1 LTS)


  1. install go from official website https://golang.ir/
  2. set $GOROOT:/usr/local/go/bin & $GOPATH/src: ~/go/src
  3. 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


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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New()

Types

type InputData

type InputData struct {
	DomainName string         `json:"domain_name"`
	Fields     []entity.Field `json:"fields"`
}

type Runner

type Runner interface {
	Name() string
	Init(args []string) error
	Run() error
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL