Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-19 11:37:31 +00:00
parent de9c4adf65
commit dfe8bc8923
14 changed files with 754 additions and 754 deletions

View File

@@ -4,38 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/db/api](https:
Endpoints:
## Update
Update a record in the database. Include an "id" in the record to update.
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Truncate
Truncate the records in a table
@@ -64,12 +32,12 @@ func TruncateTable() {
}
```
## Count
## DropTable
Count records in a table
Drop a table in the DB
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
```go
package example
@@ -81,10 +49,10 @@ import(
"go.m3o.com/db"
)
// Count records in a table
func CountEntriesInAtable() {
// Drop a table in the DB
func DropTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Count(&db.CountRequest{
rsp, err := dbService.DropTable(&db.DropTableRequest{
Table: "example",
})
@@ -180,6 +148,38 @@ Table: "example",
})
fmt.Println(rsp, err)
}
```
## Update
Update a record in the database. Include an "id" in the record to update.
[https://m3o.com/db/api#Update](https://m3o.com/db/api#Update)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Update a record in the database. Include an "id" in the record to update.
func UpdateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Update(&db.UpdateRequest{
Record: map[string]interface{}{
"id": "1",
"age": 43,
},
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Read
@@ -240,12 +240,12 @@ Table: "example",
}
```
## DropTable
## Count
Drop a table in the DB
Count records in a table
[https://m3o.com/db/api#DropTable](https://m3o.com/db/api#DropTable)
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
```go
package example
@@ -257,10 +257,10 @@ import(
"go.m3o.com/db"
)
// Drop a table in the DB
func DropTable() {
// Count records in a table
func CountEntriesInAtable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.DropTable(&db.DropTableRequest{
rsp, err := dbService.Count(&db.CountRequest{
Table: "example",
})