Commit from GitHub Actions (Generate Clients & Examples)

This commit is contained in:
crufter
2021-11-11 12:07:21 +00:00
parent 7fa39b93c8
commit e80b68116a
8 changed files with 69 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
curl "http://localhost:8080/db/ListTables" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{}'

View File

@@ -0,0 +1,15 @@
package example
import (
"fmt"
"os"
"github.com/micro/services/clients/go/db"
)
//
func ListTables() {
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,10 @@
const { DbService } = require("m3o/db");
//
async function listTables() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.listTables({});
console.log(rsp);
}
listTables();

View File

@@ -0,0 +1,7 @@
curl "http://localhost:8080/db/RenameTable" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"from": "events",
"to": "events_backup"
}'

View File

@@ -0,0 +1,18 @@
package example
import (
"fmt"
"os"
"github.com/micro/services/clients/go/db"
)
//
func RenameTable() {
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := dbService.RenameTable(&db.RenameTableRequest{
From: "events",
To: "events_backup",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,13 @@
const { DbService } = require("m3o/db");
//
async function renameTable() {
let dbService = new DbService(process.env.MICRO_API_TOKEN);
let rsp = await dbService.renameTable({
from: "events",
to: "events_backup",
});
console.log(rsp);
}
renameTable();

View File

@@ -12,9 +12,9 @@ func PublishAnEvent() {
eventService := event.NewEventService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "user",
})

View File

@@ -12,9 +12,9 @@ func PublishAmessage() {
mqService := mq.NewMqService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "events",
})