appwrite / appwrite/sdk-for-go

🐛 Bug Report: Unable to access nested structs (e.g. User Preferences)

Open
#37 3 comments 0 reactions 2 assignees Claimed by @devarsh10 View on GitHub
bug
Dominant language
Go
Stars
94
Forks
29
Avg merge
3h 16m
Merged PRs (30d)
8

Description

### 👟 Reproduction steps

Run:

```go
package main

import (
"fmt"

"github.com/appwrite/sdk-for-go/appwrite"
)

func main() {
client := appwrite.NewClient(
appwrite.WithEndpoint("https://.cloud.appwrite.io/v1"),
appwrite.WithProject(""),
appwrite.WithKey(""),
)

users := appwrite.NewUsers(client)
user, err := users.Get("")
if err != nil {
panic(err)
}
println("User ID:", user.Id)
println("User Email:", user.Email)
fmt.Printf("User Prefs: %#v\n", user.Prefs)
prefs := map[string]interface{}{}
user.Prefs.Decode(&prefs)
fmt.Printf("User Prefs: %#v\n", prefs)
}

```

### 👍 Expected behavior

The prefs have data

### 👎 Actual Behavior

```
User ID: 6797eb6600209d9c9f72
User Email: test1@example.com
User Prefs: models.Preferences{data:[]uint8(nil)}
User Prefs: map[string]interface {}{}
```

### 🎲 Appwrite version

Version 0.10.x

### 💻 Operating system

Linux

### 🧱 Your Environment

_No response_

### 👀 Have you spent some time to check if this issue has been raised before?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [x] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.