Commit Graph

47 Commits

Author SHA1 Message Date
Maxim Bublis 36e9d2ebbd Add test case for Must helper. 2018-01-03 17:44:51 +00:00
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
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 508dbd67f2 Remove obsolete tests. 2018-01-02 18:15:32 +00:00
Daniel Bershatsky 23a7b8435b Refactor UnmarshalText in order to parse hash-like UUID. 2018-01-02 15:11:40 +00:00
Kevin Burke e9dec51388 Fix errors reported by go vet
For the benchmark, `u.String()` or the loop could
potentially be optimized away by the compiler (see
http://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go for more
information). A format string in uuid_test.go has the wrong type.
2016-08-23 18:20:22 -07: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ß b111a074d5 Update FromString tests: long and invalid strings
This adds two new tests for overly long and otherwise invalidly
formatted strings to the FromString tests.

The most failure case is the acceptance of arbitrarily long hex
strings and truncating the first 32 characters to a UUID.

--- FAIL: TestFromStringLong (0.00s)
        uuid_test.go:250: Should return error trying to parse too long string, passed 6ba7b810-9dad-11d1-80b4-00c04fd430c8=
        uuid_test.go:250: Should return error trying to parse too long string, passed 6ba7b810-9dad-11d1-80b4-00c04fd430c8}
        uuid_test.go:250: Should return error trying to parse too long string, passed 6ba7b810-9dad-11d1-80b4-00c04fd430c800c04fd430c8
--- FAIL: TestFromStringInvalid (0.00s)
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d180b400c04fd430c86ba7b8109dad11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b810-9dad11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad-11d180b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d1-80b400c04fd430c8
        uuid_test.go:275: Should return error trying to parse invalid string, passed 6ba7b8109dad11d180b4-00c04fd430c8
2016-06-03 00:42:25 +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 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 2ffad3eff9 Closes #3. Adds encoding interface support for Go 1.2 2013-12-09 02:43:16 +04:00
Maxim Bublis f1c985a73e go fmt 2013-12-05 18:55:21 +04:00
Maxim Bublis 5ce331fec4 Added bytes representation for UUID 2013-12-05 13:51:57 +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 a7058a90b0 Added tests for bitwise operations 2013-12-03 20:01:39 +04:00
Maxim Bublis 154a70b629 Using value instead of pointer in test 2013-12-03 20:01:22 +04:00
Maxim Bublis 68d5abec68 Dropped epoch func setter/getter 2013-07-29 17:07:35 +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 67d9289518 tests refactored 2013-07-23 18:08:05 +04:00
Maxim Bublis 7ecb95b6a7 do not return partially initialized UUID on error 2013-07-17 16:06:54 +04:00
Maxim Bublis 56bfdc9ea4 go fmt 2013-07-17 15:03:51 +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
Maxim Bublis 3148e12291 API for changing epoch calculation function 2013-07-09 17:02:26 +04:00
Maxim Bublis 86bd425532 blackbox testing 2013-07-09 14:35:21 +04:00
Maxim Bublis 8890320c67 UUID version 2 implementation (as described in DCE 1.1) 2013-06-19 01:48:27 +04:00
Maxim Bublis d6514623b2 cosmetic 2013-06-18 23:04:30 +04:00
Maxim Bublis 3b90dc21d7 benchmarks separated 2013-06-18 23:04:09 +04:00
Maxim Bublis 6686cf783b tests added 2013-06-18 21:00:58 +04:00
Maxim Bublis 7727cb7aa6 UUID equality function 2013-06-18 20:17:07 +04:00
Maxim Bublis fbbf090357 tests added 2013-06-18 20:14:33 +04:00
Maxim Bublis f5cf14f17d added benchmarks 2013-06-18 19:05:51 +04:00
Maxim Bublis b905db1227 UUID v1 implementation 2013-06-18 18:58:10 +04:00
Maxim Bublis 739c217e7b UUID v3 and v5 implementation 2013-06-18 17:23:53 +04:00
Maxim Bublis 7e5faa5783 implemented UUID.Variant() method 2013-06-18 14:51:58 +04:00
Maxim Bublis 6f0b1e4b83 UUIDv4 generation implemented 2013-06-18 13:50:18 +04:00