go-tarantool
go-tarantool copied to clipboard
Datetime docs?
given schema
box.schema.space.create('some_space', {
format = {
{name = 'somedate', type = 'datetime'},
...
}
})
trying to write some data with the go driver gets me:
Tuple field 13 (somedate) type does not match one required by operation: expected datetime, got string
changing the schema to type = 'string' and it seems to just work fine, so I assume either the datetime package isn't functioning as expected, and again there's no docs or full examples. is this expected? am I doing something wrong? can we get some docs created someday?
Hello, could you please provide a reproducer with the connector code?
There is an example:
https://pkg.go.dev/github.com/tarantool/[email protected]/datetime#example-package
https://github.com/tarantool/go-tarantool/blob/64e41c5798b0de75ab97d527afb67abdc40760d1/datetime/example_test.go#L21-L81
After spending some more time on this probably the issue was somewhere else in the stack, though with a clearer example somewhere I could have ruled it out sooner before coming here.
In particular, you aren't showing an end to end example of saving this into a space (what does the space def look like in the example tests you shared?)
Also lacking is a complete example of a real entity/struct defined actually using the datetime type as a member prop etc so you really need to be motivated to find the answer, not great for newcomers to tarantool which I would assume many users of the Golang drivers will be
The space has a just datetime field:
https://github.com/tarantool/go-tarantool/blob/ab1fb930328e8a680ef2537b25be77f8b94bf5a0/datetime/config.lua#L17
Let's summarize. We need to improve our datetime examples:
- Add a comment with
space.create(). - Add an example with a tuple as a custom structure type.