github.com/benz9527/xboot@v0.0.0-20240504061247-c23f15593274/lib/id/id_intf.go (about)

     1  package id
     2  
     3  // Gen generates the number uuid.
     4  type Gen func() uint64
     5  
     6  type UUIDGen interface {
     7  	Number() uint64
     8  	Str() string
     9  }
    10  
    11  var (
    12  	_ UUIDGen = (*uuidDelegator)(nil)
    13  )
    14  
    15  type uuidDelegator struct {
    16  	number Gen
    17  	str    func() string
    18  }
    19  
    20  func (id *uuidDelegator) Number() uint64 { return id.number() }
    21  func (id *uuidDelegator) Str() string    { return id.str() }
    22  
    23  type NanoIDGen func() string