Commit Graph

65 Commits

Author SHA1 Message Date
Maxim Bublis f58768cc1a Add support for setting variant bits other than RFC4122. 2018-01-03 15:23:54 +00:00
Maxim Bublis 980eb8c1d5 Rewrite tests using gocheck. 2018-01-03 00:28:15 +00:00
Maxim Bublis 95d61fadb1 Moved codecs suport into `codec.go` 2018-01-03 00:28:15 +00:00
Maxim Bublis 2558856ae9 Moved database support into `sql.go`. 2018-01-02 20:56:48 +00:00
Maxim Bublis b27323f250 Use Must helper for namespace UUIDs initialization. 2018-01-02 20:38:35 +00:00
Alexey Kudinkin b86a6b7dda Moved all generation related logic into `generator.go`.
Abstracted behind `Generator` interface for easy mocking in tests.
2018-01-02 20:21:13 +00:00
Maxim Bublis 57d18d3c55 Remove binary uuid AND and OR operations.
This functionality is pretty much misleading and non-standard.
2018-01-02 16:09:01 +00:00
Maxim Bublis 8be4f1c3d9 Merge pull request #54 from daskol/parse-from-string
Refactor UnmarshalText in order to parse hash-like UUID.
2018-01-02 15:43:10 +00:00
Daniel Bershatsky 23a7b8435b Refactor UnmarshalText in order to parse hash-like UUID. 2018-01-02 15:11:40 +00:00
Maxim Bublis 3b14077cbb
Merge pull request #55 from kevinburke/add-size
Add Size constant
2018-01-02 14:14:55 +00:00
Kevin Burke 0ca0c2cf9e
Add Size constant
If I want to account for the size of a UUID in bytes in my package,
it would be nice to be able to write `uuid.Size` (to make it clear to
readers why I'm adding this many bytes) instead of the magic number
"16".
2017-08-15 11:39:26 -07:00
marclave 1d213916d1 Add must helper
A Must function is idiomatic go; the benefit of having a must is to
panic when it is not a valid UUID vs error handle.
2017-06-28 09:57:42 -07:00
Maxim Bublis 0aa62d5ddc Remove version check in UnmarshalText method. 2016-07-13 19:03:06 +01:00
Maxim Bublis fce4b1f106 Merge pull request #23 from jrouviere/master
Interpret SQL NULL values as uuid.Nil
2016-06-07 15:07:18 +01:00
Jörg Pernfuß 561449c091 Handle braced format with trailing characters 2016-06-03 01:09:06 +00:00
Jörg Pernfuß 90e70752a6 Make UnmarshalText parse more strictly
With these updates, all updated tests are passed and
no invalid strings are converted to UUID.
2016-06-03 00:43:55 +00:00
Julien Rouviere cba34673b5 Introduce NullUUID type to handle NULL SQL values
NullUUID works similarly to NullString from the database/sql package, it represents a UUID that can be NULL, a Valid boolean indicates if the value was NULL or not.
2016-04-30 20:05:32 +01:00
Tom Stokes 89fb462add Fix UnmarshalText panic on invalid short uuid
Fixes satori/go.uuid#20
2016-03-23 10:37:25 -06:00
Maksim Naumov 676762fded Implement driver.Valuer interface 2015-10-28 09:07:30 +01:00
Artem Nezvigin bb07160e36 Add FromBytesOrNil 2015-07-22 02:38:27 -07:00
Artem Nezvigin 1384c63220 Add FromStringOrNil 2015-07-20 23:29:55 -07:00
Maxim Bublis afe1e2ddf0 Omit epochFunc variable type as it will be inferred from the value. 2015-06-15 05:45:37 +03:00
Chris Bandy fe802816cf Initialize storage only when it is used 2015-06-06 16:27:38 +00:00
Chris Bandy 2fb2740a40 Panic when there is an error getting entropy 2015-06-06 14:03:51 +00:00
Chris Bandy b688244ed5 Move epoch initialization out of init 2015-06-06 12:46:50 +00:00
Florin Patan 946784907a Speed-up for string conversion function 2015-05-01 17:00:27 +02:00
Maxim Bublis dea5d44ec0 Add Nil UUID variable.
Thanks deoxxa (Conrad Pankoff) for report.
Closes #6.
2015-04-24 23:18:43 +03:00
Maxim Bublis 242673bbc8 Update copyright year 2015-02-15 00:26:48 +07:00
Chris Bandy 28f0f6f81a Implement sql.Scanner interface 2015-02-05 04:20:22 +00:00
Maxim Bublis a07c134f82 Refactor UUID string parsing.
Use less memory allocations, 2x speed up.
2014-08-19 18:31:44 +04:00
Maxim Bublis 5c6f91b6c0 Implement FromBytes in term of UnmarshalBinary, not vice versa 2014-08-19 18:28:30 +04:00
Maxim Bublis 46e1db2797 Fixes #4. Fixed data races with UUID v1/v2 storage access 2013-12-09 03:46:21 +04:00
Maxim Bublis 2ffad3eff9 Closes #3. Adds encoding interface support for Go 1.2 2013-12-09 02:43:16 +04:00
Maxim Bublis 74f1c8fb37 Set multicast bit for random generated MAC 2013-12-05 18:42:37 +04:00
Maxim Bublis 5ce331fec4 Added bytes representation for UUID 2013-12-05 13:51:57 +04:00
Maxim Bublis e7cf45c6fe Using FromString for predefined namespaces 2013-12-04 23:12:06 +04:00
Maxim Bublis 10f354ca4b Added error messages prefix 2013-12-04 19:11:37 +04:00
Maxim Bublis 3f8b0b0fa2 Added FromString parser 2013-12-04 19:01:44 +04:00
Maxim Bublis 349e66f415 Added FromBytes converter 2013-12-04 15:49:52 +04:00
Maxim Bublis 872f316627 go lint 2013-12-03 14:17:47 +04:00
Andy Lindeman bfd6674638 Fixes bug: epochStart is being added twice 2013-09-25 18:12:20 -04:00
Maxim Bublis 68d5abec68 Dropped epoch func setter/getter 2013-07-29 17:07:35 +04:00
Maxim Bublis bdf6752f55 Added bitwise AND and OR operations for UUID 2013-07-27 12:09:46 +04:00
Maxim Bublis 0971b1350e return uuid instead of pointer 2013-07-25 14:30:11 +04:00
Maxim Bublis 3aa70bb761 copyright notice added to source files 2013-07-24 16:49:33 +04:00
Maxim Bublis 93cf86f2c8 uuid generation functions signatures changed 2013-07-23 18:22:23 +04:00
Maxim Bublis 7ecb95b6a7 do not return partially initialized UUID on error 2013-07-17 16:06:54 +04:00
Maxim Bublis b50e6c82d7 go fmt 2013-07-17 16:00:24 +04:00
Maxim Bublis ccb23b2132 better API for changing epoch calculation function 2013-07-09 17:10:32 +04:00
Maxim Bublis 40349dfbd7 100% test coverage 2013-07-09 17:02:40 +04:00