1
0
mirror of https://github.com/google/uuid.git synced 2024-11-24 08:32:23 +02:00
Commit Graph

59 Commits

Author SHA1 Message Date
Bryan Matsuo
7dd4798941 replace Must* funcs with a single generic Must func
The MustParse and MustNewUUID functions have been removed since they
can be replaced simply using the new function.

    uuid.Must(uuid.Parse(s))
    uuid.Must(uuid.NewUUID())

This also fixes a spurious bug in the UnmarshalJSON method that
prevented compiling the json.go file.
2016-02-25 20:56:08 -08:00
Paul Borman
a8b7006b7b Remove json.go 2016-02-25 19:51:46 -08:00
Paul Borman
06994e737f Update readme to make sure people know the API might change. 2016-02-19 12:57:29 -08:00
Paul Borman
9e951e1b07 Change a UUID from []byte to [16]byte along with other API changes. 2016-02-19 12:30:25 -08:00
Paul Borman
82d3e379a2 Update paths 2016-02-16 15:19:02 -08:00
pborman
cd53251766 Merge pull request #24 from bmatsuo/bmatsuo/array-conversions
Array conversions
2016-02-12 08:11:50 -08:00
Bryan Matsuo
be63595eee add method Array.String() 2016-02-12 08:02:43 -08:00
Bryan Matsuo
6032e8b8f0 don't slice arrays to test their values 2016-02-11 12:26:40 -08:00
Bryan Matsuo
b4118685bb define Array type to convert UUIDs to/from map keys. 2016-02-11 12:00:09 -08:00
pborman
0f1a46960a Merge pull request #14 from shawnps/patch-1
use Error rather than Errorf when there are no formatting directives
2016-02-09 11:07:13 -08:00
pborman
c3079288a2 Merge pull request #16 from theory/driver.Valuer
Add support for driver.Valuer.
2016-02-09 11:06:20 -08:00
Paul Borman
a97ce2ca70 Revert godoc link 2016-02-09 10:59:13 -08:00
Paul Borman
ad90cc0170 Add build status 2016-02-09 10:54:59 -08:00
Paul Borman
af95d6ed42 Add travis-ci configuration for testing. 2016-02-09 10:27:59 -08:00
pborman
27e2c5ea7b Merge pull request #13 from bmatsuo/optimizations
Optimizations
2016-02-09 10:14:57 -08:00
Paul Borman
6cc520cd8b Fix govet issues and make node.go thread safe.
Includes changes from mischief and shawnps.
2016-02-09 09:58:31 -08:00
pborman
ae80070655 Merge pull request #23 from jboverfelt/sql-test
Test fixes
2016-02-09 08:02:55 -08:00
Shawn Smith
6ce35c2639 use Error rather than Errorf when there are no formatting directives 2016-02-09 14:15:05 +09:00
David E. Wheeler
5aa6bf02fe De-dupe comment. 2016-02-08 15:47:57 -08:00
David E. Wheeler
26c42f1335 Value() is on UUID, not *UUID. 2016-02-08 15:47:57 -08:00
David E. Wheeler
0384d88412 Add support for driver.Valuer.
It just returns a string, but that should be recognizable by any database that
supports UUIDs, since it's the standard format.
2016-02-08 15:47:57 -08:00
Justin Overfelt
c1c74aeb83 Fix broken test and update tests to include coverage for empty uuid scenarios 2016-02-08 18:28:58 -05:00
pborman
5bc73798cc Merge pull request #19 from dansouza/master
altered uuid.Scan() so that it allows for empty UUIDs to be read ...
2016-02-08 13:05:45 -08:00
pborman
14801136da Merge pull request #10 from wallclockbuilder/master
Create README.md
2016-02-08 08:53:31 -08:00
pborman
eff1cd8d1e Merge pull request #17 from shawnps/patch-4
fix typo
2016-02-08 08:47:06 -08:00
pborman
db13d9ecca Merge pull request #20 from shawnps/patch-5
typo
2016-02-08 08:46:39 -08:00
pborman
b0e66f28f3 Merge pull request #21 from cd1/patch-1
Fix documentation typo
2016-02-08 08:46:13 -08:00
Crístian Deives
cf9841023e Fix documentation typo
Fix typo "dervied" -> "derived".
2016-01-30 18:35:52 -02:00
Shawn Smith
1ea597af03 typo 2016-01-22 08:36:40 -08:00
Daniel Souza
6a70b0ec98 altered uuid.Scan() so that it allows for empty UUIDs to be read properly (returning a null UUID value) 2016-01-21 23:52:00 -05:00
Shawn Smith
fe04eb6d8d fix typo 2015-12-31 15:05:18 +09:00
pborman
dee7705ef7 Merge pull request #15 from jboverfelt/sql-byte-scan
Attempt to scan []byte uuids larger than 16 bytes. Fixes #12
2015-12-15 07:05:54 -08:00
Justin Overfelt
d4a682d48d Attempt to scan []byte uuids larger than 16 bytes. Fixes #12 2015-11-18 19:54:10 -05:00
Bryan Matsuo
1c7b0fea16 opitimize json interface methods
A common helper function is used for UUID.String(), UUID.URN(), and
UUID.MarshalJSON().  Any perforance hit in UUID.String() and
UUID.Marshal() appears to be negligable.  The benefit to
UUID.MarshalJSON() is several hundred nanoseconds (23% faster) and 2
allocations (21% fewer bytes).

Some redundant checks are removed from UUID.UnmarshalJSON() method.  The
"encoding/json".Unmarshaler interface specifies that implementations can
assume input is valid JSON content.  This allows one to assume that (1)
input is not empty and (2) if index 0 is a quote, then the content is a
json string and the last index will contain a terminating quote.  The
second point is not completely explicit in the documentation but it is
true in practice (and it is safe to assume -- errors will be caught).
2015-10-10 22:08:33 -07:00
Bryan Matsuo
0ec82b41c6 remove redundant nil checks in UUID.String() and UUID.URN() 2015-10-10 21:41:29 -07:00
Bryan Matsuo
9e4836cc57 do not use fmt.Sprintf() in UUID.URN()
The procedure is the same as UUID.String() (see f4e3abb).  Code is not
shared to ensure that unnecessary bounds checks do not occur.
2015-10-10 21:41:29 -07:00
Bryan Matsuo
71fb85a64c do not use fmt.Sprintf() in UUID.String()
A single array is used as a buffer and "encoding/hex".Encode() hex
encodes directly its final destination.  Loops are avoided because they
are simple enough to unroll manually.
2015-10-10 21:41:29 -07:00
Bryan Matsuo
4e1e17316e use arrays in Parse() for reduced allocation cost and bounds checks
An array is also for hex digit value lookups which seemed to reliably
give a few ns reduction in time.
2015-10-10 21:12:40 -07:00
Bryan Matsuo
baeec2195c benchmarks for Parse(), New(), String(), URN(), MarshalJSON, UnmarshalJSON()
There are no parse modifications yet.  This allows a benchmark to be
established for later commits.
2015-10-10 21:12:07 -07:00
pborman
cccd189d45 Merge pull request #6 from jboverfelt/sql-scanner
Implement database/sql's Scanner interface. Fixes #5
2015-08-24 14:28:02 -07:00
Justin Overfelt
7464a2351d Implement database/sql's Scanner interface. Fixes #5 2015-08-24 16:47:56 -04:00
Mawueli Kofi Adzoe
47b178d76c Create README.md 2015-07-17 14:13:31 +00:00
Paul Borman
ca53cad383 Remove unneeded lib directory 2015-06-03 14:40:16 -07:00
Paul Borman
2a573a0b4d Move code up one directory 2015-06-03 14:39:07 -07:00
Paul Borman
ed3ca8a15a go-uuid: Fix JSON encoding for empty UUIDs 2014-12-02 10:54:02 -06:00
Paul Borman
e1a3bdbdba Actually include the clock_seq fix 2014-12-01 10:02:42 -08:00
Paul Borman
20e286fb8b Hopefully actually add the new json files and seq_test.go file. 2014-12-01 09:59:57 -08:00
Paul Borman
bd9fbafc7a Cleanup 2014-04-14 13:07:31 -07:00
Paul Borman
cf8abfc1a1 Add locking around global time functions. 2014-04-14 13:05:23 -07:00
David Symonds
0b37a59742 go-uuid: Make uuid_test.go independent of the system clock.
The test depends on an advancing clock, but it can sometimes run
fast enough that the clock has not advanced.

R=borman
CC=borman
http://codereview.appspot.com/6243069

Committer: Paul Borman <borman@google.com>
2012-06-05 07:45:31 -07:00