Giter Club home page Giter Club logo

mall's Introduction

# go-zero 微服务实战
https://zhuanlan.zhihu.com/p/461604538

常用命令
mkdir -p mall && cd mall && go mod init
mkdir -p service && cd service
mkdir -p {user,order,pay,product}/{api,rpc,model}

cd user
goctl model mysql ddl -src ./model/user.sql -dir ./model -c
goctl api go -api ./api/user.api -dir ./api
goctl rpc protoc rpc/user.proto --go_out=./rpc/pb --go-grpc_out=./rpc/pb --zrpc_out=rpc/

goctl docker --go user.go --port 8000

cd ~/go-zero-demo/mall/service/product/api
go mod init github.com/dfang/mall/service/product/api
go mod tidy
cd ~/go-zero-demo/mall/service/product/rpc
go mod init github.com/dfang/mall/service/pay/rpc
go mod tidy

cd ~/go-zero-demo/mall/service/user/api
go mod init github.com/dfang/mall/service/user/api
go mod tidy
cd ~/go-zero-demo/mall/service/user/rpc
go mod init github.com/dfang/mall/service/pay/rpc
go mod tidy

cd ~/go-zero-demo/mall/service/order/api
go mod init github.com/dfang/mall/service/order/api
go mod tidy
cd ~/go-zero-demo/mall/service/order/rpc
go mod init github.com/dfang/mall/service/order/rpc
go mod tidy

cd ~/go-zero-demo/mall/service/pay/api
go mod init github.com/dfang/mall/service/pay/api
go mod tidy
cd ~/go-zero-demo/mall/service/pay/rpc
go mod init github.com/dfang/mall/service/pay/rpc
go mod tidy

gsed -i 's/search/replace/gI' input.txt

# only find word ‘love’ and replace it with ‘sick’ if line content a specific string such as FOO:
sed -i -e '/FOO/s/love/sick/' input.txt

etcdctl get "" --prefix --keys-only
etcdctl --endpoints etcd:2379 get "" --prefix --keys-only

unset all proxy on local


find . -name captain.yml -execdir captain build \;
find . -name captain.yml -execdir sh -c "captain build; captain push" \;

```
 λ  tree -L 2 service/
service/
├── order
│   ├── api
│   ├── captain.yml
│   ├── model
│   └── rpc
├── pay
│   ├── api
│   ├── captain.yml
│   ├── model
│   └── rpc
├── product
│   ├── api
│   ├── captain.yml
│   ├── model
│   └── rpc
└── user
    ├── api
    ├── captain.yml
    ├── model
    └── rpc

# 进入每个RPC目录执行go mod tidy
λ find . -type d -iname rpc -execdir sh -c "cd {}; go mod tidy" \;

cd service
find . -name go.mod -execdir bash -c "go mod tidy" \;

find . -iname .gitignore -execdir bash -c "cat {}; echo" \;
find . -iname .gitignore -execdir bash -c "git add {}" \;
```

mall's People

Contributors

dfang avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.