Back
Return TablesDB from REST and Go Function are different, from Go SDK no returning column
- 0
- Functions
- Cloud
This my Go code for deploy in function:
TypeScript
package handler
import (
"os"
"github.com/appwrite/sdk-for-go/appwrite"
"github.com/appwrite/sdk-for-go/client"
"github.com/open-runtimes/types-for-go/v4/openruntimes"
)
var (
appwriteClient client.Client
)
func Main(Context openruntimes.Context) openruntimes.Response {
appwriteClient = appwrite.NewClient(
appwrite.WithEndpoint(os.Getenv("APPWRITE_FUNCTION_API_ENDPOINT")),
appwrite.WithProject(os.Getenv("APPWRITE_FUNCTION_PROJECT_ID")),
appwrite.WithKey(Context.Req.Headers["x-appwrite-key"]),
)
tablesDB := appwrite.NewTablesDB(appwriteClient)
if Context.Req.Path == "/cek" {
if Context.Req.Method == "GET" {
response, err := tablesDB.ListRows("68f8e75900141e1e5ca6", "hargadomain")
if err != nil {
Context.Error("Gagal ngambil row: ", err)
return Context.Res.Send(err.Error(), Context.Res.WithStatusCode(500))
}
return Context.Res.Json(response)
} else {
return Context.Res.Send("Metode tidak diizinkan.", Context.Res.WithStatusCode(405))
}
}
return Context.Res.Send("Endpoint tidak ditemukan.", Context.Res.WithStatusCode(404))
}
Compare with this rest: https://sgp.cloud.appwrite.io/v1/tablesdb/68f8e75900141e1e5ca6/tables/hargadomain/rows?project=69031557003caa33521a
This rest is return all column (pic 1), but for go code it's not return the column, any wrong with my code?
TL;DR
The developer is facing an issue where the Go function they deployed is not returning all columns of a table from the TablesDB compared to a REST endpoint. The issue may be with how they are handling the response in their code. They should check their Go code to ensure it properly includes all necessary columns in the response.Recommended threads
- Bug Report: type generation for enum of ...
### 👟 Reproduction steps in the enum element value, instead of English, use another language (Khmer), in my case Khmer text. ``` export enum ProvinceType { ...
- Github Repos are not appearing on sites ...
Hi, Has anyone had recent issues with sites feature where github repos are not appearing? I even tried unliking and giving it a shot! It does not even show up, ...
- [Bug] Cannot set any token expiry to Nev...
Tried with file tokens and api keys