Skip to content

Datetime support #145

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

Merged
merged 3 commits into from
Jun 23, 2022
Merged

Datetime support #145

merged 3 commits into from
Jun 23, 2022

Conversation

ligurio
Copy link
Member

@ligurio ligurio commented Mar 5, 2022

This patch provides datetime support for all space operations and as
function return result. Datetime type was introduced in Tarantool 2.10.
See more in issue [1].

  1. Add TIMESTAMP and INTERVAL extensions to Msgpack tarantool#5946

Closes #118

@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch from 13db82c to fa131df Compare March 5, 2022 07:56
@ligurio ligurio marked this pull request as draft March 5, 2022 07:56
@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch 2 times, most recently from 41c5936 to 7719f53 Compare March 6, 2022 16:28
@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch 3 times, most recently from 5672651 to f60d0c4 Compare March 16, 2022 08:06
@ligurio ligurio marked this pull request as ready for review March 16, 2022 08:13
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have left several comments. If my questions about parsing are reasonable and I haven't misinterpreted something, they should be fixed. Also tests should contain at least basic value parsing tests so we know that result is valid and not just a valid datetime

@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch 6 times, most recently from 6eb6112 to 4ab4218 Compare April 13, 2022 12:48
@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch from 4ab4218 to 1cb237b Compare April 13, 2022 15:03
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like it's valid

@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch from 1cb237b to 6a5d9e6 Compare April 15, 2022 18:51
@oleg-jukovec oleg-jukovec self-requested a review April 18, 2022 11:29
@funny-falcon
Copy link

Существующие на данный момент тесты не убеждают меня, что поле структуры будет нормально кодироваться/декодироваться.
Требую тестов с таплами.

  • с текущим таплом TupleDatetime, который почему-то не протестирован.
    Можно ему добавить метод EncdeMsgpack
  • с таким же, но у которого в DecodeMsgpack используется err = d.Decode(&t.tm)
  • с таплом без явных методов кодирования, но с
    _msgpack struct{} `msgpack:",asArray"`

@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch 3 times, most recently from 9fe1a3f to c1750dc Compare April 18, 2022 20:06
@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch 9 times, most recently from e113800 to 2e37483 Compare June 16, 2022 19:31
@ligurio ligurio force-pushed the ligurio/gh-118-datetime-support branch 4 times, most recently from 5775854 to 323f733 Compare June 22, 2022 08:00
@oleg-jukovec oleg-jukovec force-pushed the ligurio/gh-118-datetime-support branch 4 times, most recently from 915537d to 563a6d6 Compare June 23, 2022 12:18
oleg-jukovec and others added 3 commits June 23, 2022 15:21
The new name is shorter and relates to the current code.
Add Tarantool 2.10 [1] to testing matrix, it is a first release with
datetime support. Tarantool 2.9 has been removed, it was never
published [2].

setup-tarantool action does not support new Tarantool release policy
[3], and Tarantool 2.10 is installed without action but using curl and
apt. New issue to fix this has been submitted [4].

1. https://www.tarantool.io/en/doc/latest/release/2.10.0/
2. https://www.tarantool.io/en/doc/latest/release/calendar/
3. tarantool/setup-tarantool#19
4. #186

Needed for #118
This patch provides datetime support for all space operations and as
function return result. Datetime type was introduced in Tarantool 2.10.
See more in issue [1].

Note that timezone's index and offset and intervals are not implemented
in Tarantool, see [2] and [3].

This Lua snippet was quite useful for debugging encoding and decoding
datetime in MessagePack:

local msgpack = require('msgpack')
local datetime = require('datetime')

local dt = datetime.parse('2012-01-31T23:59:59.000000010Z')
local mp_dt = msgpack.encode(dt):gsub('.',
    function (c)
        return string.format('%02x', string.byte(c))
    end)

print(mp_dt)  -- d8047f80284f000000000a00000000000000

1. tarantool/tarantool#5946
2. #163
3. #165

Closes #118
@oleg-jukovec oleg-jukovec force-pushed the ligurio/gh-118-datetime-support branch from 563a6d6 to 19cf335 Compare June 23, 2022 12:21
@oleg-jukovec oleg-jukovec merged commit 61d0739 into master Jun 23, 2022
@oleg-jukovec oleg-jukovec deleted the ligurio/gh-118-datetime-support branch June 23, 2022 12:39
@oleg-jukovec
Copy link
Collaborator

oleg-jukovec commented Jun 23, 2022

I made some changes in 61d0739 without directly approval from @ligurio (this format for finish the pull request has been agreed upon us). Unfortunately, I forgot to add myself as a co-author, but you need to blame me for all the problems of the commit, not @ligurio .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support datetime
5 participants