...

Source file src/github.com/pborman/uuid/version1.go

Documentation: github.com/pborman/uuid

     1  // Copyright 2011 Google Inc.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package uuid
     6  
     7  import (
     8  	guuid "github.com/google/uuid"
     9  )
    10  
    11  // NewUUID returns a Version 1 UUID based on the current NodeID and clock
    12  // sequence, and the current time.  If the NodeID has not been set by SetNodeID
    13  // or SetNodeInterface then it will be set automatically.  If the NodeID cannot
    14  // be set NewUUID returns nil.  If clock sequence has not been set by
    15  // SetClockSequence then it will be set automatically.  If GetTime fails to
    16  // return the current NewUUID returns nil.
    17  func NewUUID() UUID {
    18  	gu, err := guuid.NewUUID()
    19  	if err == nil {
    20  		return UUID(gu[:])
    21  	}
    22  	return nil
    23  }
    24  

View as plain text