Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-11-11 11:59:54 +00:00
parent d31fde4be4
commit 1e54e284f6
19 changed files with 722 additions and 691 deletions

View File

@@ -40,6 +40,14 @@ func (t *DbService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
}
//
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) {
@@ -48,6 +56,14 @@ func (t *DbService) Read(request *ReadRequest) (*ReadResponse, error) {
}
//
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) {
@@ -96,6 +112,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"`
@@ -122,6 +145,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"`