add country
This commit is contained in:
81
README.md
81
README.md
@@ -1 +1,80 @@
|
||||
protoc --proto_path=proto --go_out=out --go_opt=paths=source_relative proto/messages.proto
|
||||
# Go Cart Actor
|
||||
|
||||
A distributed cart management system using the actor model pattern.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Go 1.24.2+
|
||||
- Protocol Buffers compiler (`protoc`)
|
||||
- protoc-gen-go plugin
|
||||
|
||||
### Installing Protocol Buffers
|
||||
|
||||
On Windows:
|
||||
```powershell
|
||||
winget install protobuf
|
||||
```
|
||||
|
||||
On macOS:
|
||||
```bash
|
||||
brew install protobuf
|
||||
```
|
||||
|
||||
On Linux:
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt install protobuf-compiler
|
||||
|
||||
# Or download from: https://github.com/protocolbuffers/protobuf/releases
|
||||
```
|
||||
|
||||
### Installing Go protobuf plugin
|
||||
|
||||
```bash
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
|
||||
```
|
||||
|
||||
## Working with Protocol Buffers
|
||||
|
||||
### Generating Go code from proto files
|
||||
|
||||
After modifying `proto/messages.proto`, regenerate the Go code:
|
||||
|
||||
```bash
|
||||
cd proto
|
||||
protoc --go_out=. --go_opt=paths=source_relative messages.proto
|
||||
```
|
||||
|
||||
### Protocol Buffer Messages
|
||||
|
||||
The `proto/messages.proto` file defines the following message types:
|
||||
|
||||
- `AddRequest` - Add items to cart (includes quantity, sku, country, optional storeId)
|
||||
- `SetCartRequest` - Set entire cart contents
|
||||
- `AddItem` - Complete item information for cart
|
||||
- `RemoveItem` - Remove item from cart
|
||||
- `ChangeQuantity` - Update item quantity
|
||||
- `SetDelivery` - Configure delivery options
|
||||
- `SetPickupPoint` - Set pickup location
|
||||
- `PickupPoint` - Pickup point details
|
||||
- `RemoveDelivery` - Remove delivery option
|
||||
- `CreateCheckoutOrder` - Initiate checkout
|
||||
- `OrderCreated` - Order creation response
|
||||
|
||||
### Building the project
|
||||
|
||||
```bash
|
||||
go build .
|
||||
```
|
||||
|
||||
### Running tests
|
||||
|
||||
```bash
|
||||
go test ./...
|
||||
```
|
||||
|
||||
## Important Notes
|
||||
|
||||
- Always regenerate protobuf Go code after modifying `.proto` files
|
||||
- The generated `messages.pb.go` file should not be edited manually
|
||||
- Make sure your PATH includes the protoc-gen-go binary location (usually `$GOPATH/bin`)
|
||||
Reference in New Issue
Block a user