Documentation ¶
Overview ¶
Bloxid implements typed guids for identifying resource objects globally in the system. Resources are not specific to services/applications but must contain an entity type.
Typed guids have the advantage of being globally unique, easily readable, and strongly typed for authorization and logging. The trailing characters provide sufficient entropy to make each resource universally unique.
Bloxid package provides methods for generating and parsing versioned typed guids.
Index ¶
Constants ¶
View Source
const (
DefaultEntropySize = 40
)
View Source
const V0Delimiter = "."
Variables ¶
View Source
var ( ErrInvalidVersion error = errors.New("invalid bloxid version") ErrInvalidEntityType error = errors.New("entity type must be non-empty") ErrInvalidUniqueIDLen error = errors.New("unique ID did not meet minimum length requirements") ErrIDEmpty error = errors.New("empty bloxid") ErrV0Parts error = errors.New("invalid number of parts found") )
Functions ¶
func WithShortID ¶
Types ¶
type GenerateV0Opts ¶
type GenerateV0Opts func(o *V0Options)
type ID ¶
type ID interface { // String returns the complete resource ID String() string // ShortID returns a shortened ID that will be locally unique ShortID() string // Version returns a serialized representation of the ID version // ie. `V0` Version() string // V0 // Type returns entity type ie. `host` Type() string // Region is optional and returns the cloud region that // the resource is found in ie. `us-east-1` Region() string }
ID implements the interface for parsing a resource identifier
type V0 ¶
type V0 struct {
// contains filtered or unexported fields
}
V0 represents a typed guid
func GenerateV0 ¶
func GenerateV0(opts *V0Options, fnOpts ...GenerateV0Opts) (*V0, error)
Click to show internal directories.
Click to hide internal directories.