mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-18 05:35:10 +00:00
Commit from GitHub Actions (Generate Clients & Examples)
This commit is contained in:
@@ -34,12 +34,24 @@ func (t *DbService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
|||||||
return rsp, t.client.Call("db", "Delete", request, rsp)
|
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.
|
// 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) {
|
func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {
|
||||||
rsp := &ReadResponse{}
|
rsp := &ReadResponse{}
|
||||||
return rsp, t.client.Call("db", "Read", request, rsp)
|
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
|
// Truncate the records in a table
|
||||||
func (t *DbService) Truncate(request *TruncateRequest) (*TruncateResponse, error) {
|
func (t *DbService) Truncate(request *TruncateRequest) (*TruncateResponse, error) {
|
||||||
rsp := &TruncateResponse{}
|
rsp := &TruncateResponse{}
|
||||||
@@ -84,6 +96,13 @@ type DeleteRequest struct {
|
|||||||
type DeleteResponse struct {
|
type DeleteResponse struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ListTablesRequest struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
type ListTablesResponse struct {
|
||||||
|
Tables []string `json:"tables"`
|
||||||
|
}
|
||||||
|
|
||||||
type ReadRequest struct {
|
type ReadRequest struct {
|
||||||
// Read by id. Equivalent to 'id == "your-id"'
|
// Read by id. Equivalent to 'id == "your-id"'
|
||||||
Id string `json:"id"`
|
Id string `json:"id"`
|
||||||
@@ -110,6 +129,14 @@ type ReadResponse struct {
|
|||||||
Records []map[string]interface{} `json:"records"`
|
Records []map[string]interface{} `json:"records"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RenameTableRequest struct {
|
||||||
|
From string `json:"from"`
|
||||||
|
To string `json:"to"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type RenameTableResponse struct {
|
||||||
|
}
|
||||||
|
|
||||||
type TruncateRequest struct {
|
type TruncateRequest struct {
|
||||||
// Optional table name. Defaults to 'default'
|
// Optional table name. Defaults to 'default'
|
||||||
Table string `json:"table"`
|
Table string `json:"table"`
|
||||||
|
|||||||
@@ -78,5 +78,5 @@
|
|||||||
"prepare": "npm run build"
|
"prepare": "npm run build"
|
||||||
},
|
},
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"version": "1.0.706"
|
"version": "1.0.717"
|
||||||
}
|
}
|
||||||
@@ -12,10 +12,10 @@ func CreateArecord() {
|
|||||||
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
dbService := db.NewDbService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := dbService.Create(&db.CreateRequest{
|
rsp, err := dbService.Create(&db.CreateRequest{
|
||||||
Record: map[string]interface{}{
|
Record: map[string]interface{}{
|
||||||
"age": 42,
|
|
||||||
"isActive": true,
|
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"name": "Jane",
|
"name": "Jane",
|
||||||
|
"age": 42,
|
||||||
|
"isActive": true,
|
||||||
},
|
},
|
||||||
Table: "users",
|
Table: "users",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ func PublishAnEvent() {
|
|||||||
eventService := event.NewEventService(os.Getenv("MICRO_API_TOKEN"))
|
eventService := event.NewEventService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := eventService.Publish(&event.PublishRequest{
|
rsp, err := eventService.Publish(&event.PublishRequest{
|
||||||
Message: map[string]interface{}{
|
Message: map[string]interface{}{
|
||||||
|
"id": "1",
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
"user": "john",
|
"user": "john",
|
||||||
"id": "1",
|
|
||||||
},
|
},
|
||||||
Topic: "user",
|
Topic: "user",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ func PublishAmessage() {
|
|||||||
mqService := mq.NewMqService(os.Getenv("MICRO_API_TOKEN"))
|
mqService := mq.NewMqService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := mqService.Publish(&mq.PublishRequest{
|
rsp, err := mqService.Publish(&mq.PublishRequest{
|
||||||
Message: map[string]interface{}{
|
Message: map[string]interface{}{
|
||||||
|
"type": "signup",
|
||||||
"user": "john",
|
"user": "john",
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"type": "signup",
|
|
||||||
},
|
},
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user