https://github.com/blaxberry333/venomous_app_protobuf
Developing...
https://github.com/blaxberry333/venomous_app_protobuf
protocol-buffer
Last synced: 3 months ago
JSON representation
Developing...
- Host: GitHub
- URL: https://github.com/blaxberry333/venomous_app_protobuf
- Owner: BlaxBerry333
- Created: 2024-04-11T02:23:21.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-04T12:45:31.000Z (4 months ago)
- Last Synced: 2025-02-04T13:37:42.670Z (4 months ago)
- Topics: protocol-buffer
- Language: Protocol Buffer
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Venomous Apps' Protocol Buffers & Code Generator
| | Main Skills | Topic | Supported Languages |
| :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------: | :-----------------: |
| Protobuf |![]()
| Type Code Serialization | Golang、TypeScript |
## 🚀 Local Setup
0. setup environments
- Goalng
- Python
- Node.js
1. install protobuf for usingprotoc
command
```shell
# 1. install protobuf compiler
brew install protobuf# 2. check version
protoc --version
```
2. install pkgprotoc-gen-go
for generating Golang code, then add to$PATH
```shell
# 1. install pkg
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest# 2. add path
export PATH="$PATH:$(go env GOPATH)/bin" >> ~/.zshrc
source ~/.zshrc# 3. check pkg's position & version
which protoc-gen-go
protoc-gen-go --version
```
3. install pkgts-proto
for generating Typescript code
```shell
% npm install ts-proto
```
4. install all pkgs
```shell
% npm install
```## 🛠 Commands
```shell
% make gen-all # generate all
% make gen-go # only generate Golang code
% make gen-ts # only generate Typescript code
% make gen-py # only generate Python code
```## 🤔 How to use
### TypeScript
1. install pkg inside project
```shell
cdyarn add git+https://github.com/BlaxBerry333/venomous_app_protobuf.git
yarn add -D google-protobuf @types/google-protobuf
```
2. import type then use
```tsx
import type { MessageNode, HTMLNode } from "venomous_app_protobuf/ts/workflow";
import type { ChatBotData } from "venomous_app_protobuf/ts/chat";
import type { NoteData } from "venomous_app_protobuf/ts/notes";
```### Golang
1. get pkg
```shell
cdgo get github.com/BlaxBerry333/venomous_app_protobuf/go/scenario@main
```
2. import pkg then use
```go
import (
"fmt"workflow "github.com/BlaxBerry333/venomous_app_protobuf/go/workflow"
)var MockMessageNode = &workflow.MessageNode{
Id: 11,
Title: "xxx",
Text: "yyy",
}var MockHTMLNode = &workflow.HTMLNode{
Id: 22,
Title: "xxx",
Text: "yyy",
}func main() {
fmt.Println(MockMessageNode.Id)
fmt.Println(MockMessageNode.Title)
fmt.Println(MockMessageNode.Text)
}
```