Commit from GitHub Actions (Generate Clients & Examples)

This commit is contained in:
crufter
2021-11-11 11:57:36 +00:00
parent fff15c6f5b
commit 0aa4c208dd
5 changed files with 32 additions and 5 deletions

View File

@@ -34,12 +34,24 @@ func (t *DbService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
return rsp, t.client.Call("db", "Delete", request, rsp)
}
//
func (t *DbService) ListTables(request *ListTablesRequest) (*ListTablesResponse, error) {
rsp := &ListTablesResponse{}
return rsp, t.client.Call("db", "ListTables", request, rsp)
}
// Read data from a table. Lookup can be by ID or via querying any field in the record.
func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {
rsp := &ReadResponse{}
return rsp, t.client.Call("db", "Read", request, rsp)
}
//
func (t *DbService) RenameTable(request *RenameTableRequest) (*RenameTableResponse, error) {
rsp := &RenameTableResponse{}
return rsp, t.client.Call("db", "RenameTable", request, rsp)
}
// Truncate the records in a table
func (t *DbService) Truncate(request *TruncateRequest) (*TruncateResponse, error) {
rsp := &TruncateResponse{}
@@ -84,6 +96,13 @@ type DeleteRequest struct {
type DeleteResponse struct {
}
type ListTablesRequest struct {
}
type ListTablesResponse struct {
Tables []string `json:"tables"`
}
type ReadRequest struct {
// Read by id. Equivalent to 'id == "your-id"'
Id string `json:"id"`
@@ -110,6 +129,14 @@ type ReadResponse struct {
Records []map[string]interface{} `json:"records"`
}
type RenameTableRequest struct {
From string `json:"from"`
To string `json:"to"`
}
type RenameTableResponse struct {
}
type TruncateRequest struct {
// Optional table name. Defaults to 'default'
Table string `json:"table"`

View File

@@ -78,5 +78,5 @@
"prepare": "npm run build"
},
"types": "index.d.ts",
"version": "1.0.706"
"version": "1.0.717"
}

View File

@@ -12,10 +12,10 @@ func CreateArecord() {
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"age": 42,
"isActive": true,
"id": "1",
"name": "Jane",
"age": 42,
"isActive": true,
},
Table: "users",
})

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{}{
"type": "signup",
"user": "john",
"id": "1",
"type": "signup",
},
Topic: "events",
})