edgedb / edgedb-go

The official Go client library for EdgeDB
https://pkg.go.dev/github.com/edgedb/edgedb-go
Apache License 2.0
167 stars 11 forks source link

`(edgedb.Client).WithConfig` function does not seem to actually do anything #291

Closed TomLisankie closed 7 months ago

TomLisankie commented 8 months ago

Describe the bug Using the (edgedb.Client).WithConfig does not seem to actually do anything. All other client functionality seems to work as expected

Reproduction

        conn, err = edgedb.CreateClient(context.Background(), edgedb.Options{
        Host:      host,
        Port:      edgedbPort,
        SecretKey: edgedbSecretKey,
    })
        // The below does not seem to actually do its job
    conn.WithConfig(map[string]interface{}{
        "allow_user_specified_id": true,
    })

Expected behavior I expected this to achieve the same effect as if I ran the following EdgeQL: configure instance set allow_user_specified_id := true;

Versions (please complete the following information):

Additional context I'm trying to do this on the setup of my API server in the context of docker-compose. The whole purpose of all of this is so I can run automated tests via GitHub Actions. I ended up modifying my docker-compose.yml file to pass in an edgedb-bootstrap.yml as specified here so that I could at least make sure I was getting my config correct whether the Go library is working correctly or not.

fmoor commented 8 months ago

The WithX methods return a new client with modified state. Try changing your example to something like this:

configuredClient := conn.WithConfig(map[string]interface{}{
    "allow_user_specified_id": true,
})
err := configuredClient.Query(...)
raddevon commented 7 months ago

Closing this since it's been inactive for a while. Feel free to reopen if you're still having a problem, @TomLisankie.