Commit Graph

26 Commits (00a91ad22f60c8dd27c4611dfe8a6f59d7ea343d)

Author SHA1 Message Date
Jonathan A. Sternberg 0ae8bebd75
refactor: rewrite imports to include the /v2 suffix for version 2 2020-04-03 12:39:20 -05:00
docmerlin (j. Emrys Landivar) 19fe098888 chore(ci): update go-tools 2019-08-22 10:55:05 -05:00
lisale0 8c045ad08a gofmt 2019-06-20 16:25:38 -07:00
zhulongcheng 3c1e9ee5f3 fix(influxdb): use influxdb.Error in ID.Decode 2019-05-15 22:53:31 +08:00
Mark Rushakoff d4b5ff29cf fix: encode IDs as JSON map keys properly
The encoding/json docs explain that you need to provide a MarshalText
method to encode integer types as map keys, otherwise they will be
formatted as a string version of the decimal number.

Providing MarshalText and UnmarshalText also uses those methods as a
fallback for MarshalJSON and UnmarshalJSON, so we no longer need
explicit versions of those latter methods.

Apparently Sources were using IDs as map keys and were providing the
,string attribute on the JSON tag on the struct. This was not correct so
that attribute has been removed. Existing sources will no longer be
readable as a result of this change.

Fixes #13277.
2019-04-26 20:41:20 -07:00
Mark Rushakoff d73d73c0d4 chore: rename imports from platform to influxdb
I did this with a dumb editor macro, so some comments changed too.

Also rename root package from platform to influxdb.

In interest of minimizing risk, anyone importing the root package has
now aliased it to "platform" so that no changes beyond imports were
necessary in those files.

Lastly, replace the old platform module to local path /dev/null so that
nobody can accidentally reintroduce a platform dependency while
migrating platform code to influxdb.
2019-01-09 20:51:47 -08:00
Mark Rushakoff 7ae106d14a chore: add GoString method to platform.ID
While debugging, I was printing out some structs with %#v and found that
Go would format the structs' IDs as uint64s instead of with the String
method. That behavior needlessly made my debugging more difficult.

Before, %#v would format a type with an ID like:

    {ID:0x2def021097c6000}

After:

    {ID:"02def021097c6000"}

They look similar, but a search for the string ID would not match the
uint64 default formatting.
2018-10-31 14:41:47 -07:00
Chris Goller e7d75b7162 perf(id): decrease allocations for id decoding 2018-10-11 09:54:19 -05:00
Chris Goller 2bea48f15a refactor(testing): rename MustIDFromString to MustIDBase16 2018-10-11 09:54:19 -05:00
Chris Goller b68a98043d refactor(id): update name to IDLength 2018-10-11 09:54:19 -05:00
Leonardo Di Donato 6725ae6f64 feat(platform/id): method to create an invalid id
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2018-10-11 09:54:18 -05:00
Leonardo Di Donato 8d7f06cf4b feat(platform/id): using uint64 for platform.IDs
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
Co-Authored-by: Lorenzo Fontana <lo@linux.com>
2018-10-11 09:54:18 -05:00
Michael Desa 8c87c9d132 revert #442 2018-08-01 14:54:32 -04:00
Leonardo Di Donato 43ebb0251f Improvements to platform.ID errors
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2018-08-01 18:20:59 +02:00
Leonardo Di Donato 5addb88eb5 MustIDFromString no more requires test instance
It panics now.
2018-08-01 18:20:59 +02:00
Leonardo Di Donato c16a855a58 Better naming for the ID length constant 2018-08-01 18:20:59 +02:00
Leonardo Di Donato bba4e4d69f Moving ID tests in platform_test package to avoid circular deps 2018-08-01 18:20:59 +02:00
Leonardo Di Donato c6b8c9d82e All zeros ID considered invalid 2018-08-01 18:20:59 +02:00
Leonardo Di Donato 4387206181 Other test for IDs
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2018-08-01 18:20:59 +02:00
Leonardo Di Donato bcd4e7e675 Fix ID error about exact length 2018-08-01 18:20:59 +02:00
Leonardo Di Donato fac113821e Testing marshalling of IDs and viceversa 2018-08-01 18:20:59 +02:00
Leonardo Di Donato 617795da5d Testing IDs 2018-08-01 18:20:59 +02:00
Leonardo Di Donato 31bcd42d05 Fix testing of ID from string function
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2018-08-01 18:20:59 +02:00
Leonardo Di Donato bc03eb2d2b Tests for platform.ID
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2018-08-01 18:20:59 +02:00
Leonardo Di Donato 5335c52c87 Initial tests for platform.ID
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
Co-Authored-by: Lorenzo Fontana <lo@linux.com>
2018-08-01 18:20:59 +02:00
Lorenzo Fontana 8f0ebe47f2
Static id from string function
Signed-off-by: Lorenzo Fontana <lo@linux.com>
Co-authored-by: Chris Goller <goller@gmail.com>
2018-07-20 17:00:36 +02:00