Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Unsupported custom-type #194

Open
2 tasks done
EtienneBruines opened this issue Dec 9, 2024 · 1 comment
Open
2 tasks done

Bug: Unsupported custom-type #194

EtienneBruines opened this issue Dec 9, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@EtienneBruines
Copy link
Contributor

Describe the bug

It's not possible to provide a custom type as part of the Create method:

type MyThingy struct {
    Name string `json:"name"`
}

// does not work:
// rpc request err Error: Expected a CBOR integer, text, array or map
// unavailable ErrorChannel <nil>
// (See issue #186 )
_, err = surrealdb.Create[struct{}](surrealConn, "table1", MyThingy{
		Name: "Hello World",
	})

// works
_, err = surrealdb.Create[struct{}](surrealConn, "table1", map[string]interface{}{
		"name": "Hello World",
	})

Steps to reproduce

  • Run the example code.

Expected behaviour

Custom types to be usable as a parameter to Create.

SurrealDB version

surreal 2.1.2 for linux on amd64

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@EtienneBruines EtienneBruines added the bug Something isn't working label Dec 9, 2024
@remade
Copy link
Collaborator

remade commented Dec 15, 2024

Thanks for raising this @EtienneBruines. Can you please confirm the code you shared? I tried it successfully
image

image

@remade remade self-assigned this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants