Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-12-16 17:18:38 +00:00
parent 86803cc1e2
commit 32496fe696
15 changed files with 678 additions and 678 deletions

View File

@@ -26,10 +26,10 @@ func CreateArecord() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Create(&db.CreateRequest{
Record: map[string]interface{}{
"age": 42,
"isActive": true,
"id": "1",
"name": "Jane",
"age": 42,
},
Table: "example",
@@ -38,12 +38,12 @@ Table: "example",
}
```
## ListTables
## Truncate
List tables in the DB
Truncate the records in a table
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
```go
package example
@@ -55,11 +55,40 @@ import(
"go.m3o.com/db"
)
// List tables in the DB
func ListTables() {
// Truncate the records in a table
func TruncateTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.ListTables(&db.ListTablesRequest{
rsp, err := dbService.Truncate(&db.TruncateRequest{
Table: "example",
})
fmt.Println(rsp, err)
}
```
## Count
Count records in a table
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Count records in a table
func CountEntriesInAtable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Count(&db.CountRequest{
Table: "example",
})
fmt.Println(rsp, err)
@@ -182,34 +211,6 @@ Table: "example",
})
fmt.Println(rsp, err)
}
```
## Truncate
Truncate the records in a table
[https://m3o.com/db/api#Truncate](https://m3o.com/db/api#Truncate)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/db"
)
// Truncate the records in a table
func TruncateTable() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Truncate(&db.TruncateRequest{
Table: "example",
})
fmt.Println(rsp, err)
}
```
## DropTable
@@ -240,12 +241,12 @@ func DropTable() {
}
```
## Count
## ListTables
Count records in a table
List tables in the DB
[https://m3o.com/db/api#Count](https://m3o.com/db/api#Count)
[https://m3o.com/db/api#ListTables](https://m3o.com/db/api#ListTables)
```go
package example
@@ -257,12 +258,11 @@ import(
"go.m3o.com/db"
)
// Count records in a table
func CountEntriesInAtable() {
// List tables in the DB
func ListTables() {
dbService := db.NewDbService(os.Getenv("M3O_API_TOKEN"))
rsp, err := dbService.Count(&db.CountRequest{
Table: "example",
rsp, err := dbService.ListTables(&db.ListTablesRequest{
})
fmt.Println(rsp, err)