yuyuid

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 4 Imported by: 1

README

yuyuid

Build Status codecov GoDoc Go Report Card

Go uuid library.

Installation

go get github.com/komuw/yuyuid

Usage

package main

import (
	"fmt"

	"github.com/komuw/yuyuid"
)

func main() {
	UUID4 := yuyuid.UUID4()
	fmt.Println("UUID4 is", UUID4)

	UUID5 := yuyuid.UUID5(yuyuid.NamespaceDNS, "SomeName")
	fmt.Println("UUID5", UUID5)
}

FAQ

Why?

  • golang doesn't have an inbuilt uuid lib
  • pet project to help me learn golang

Is it done yet?

  • Yes
  • Only uuid versions 3, 4 and 5 are implemented. I don't think I'll ever implement uuid version 1

Documentation

Overview

Package yuyuid provides an implementation of Universally Unique Identifier (UUID) version 3, 4 and 5.

Example usage:

package main

import (
	"fmt"

	"github.com/komuw/yuyuid"
)

func main() {
	UUID4 := yuyuid.UUID4()
	fmt.Println("UUID4 is", UUID4)

	UUID5 := yuyuid.UUID5(yuyuid.NamespaceDNS, "SomeName")
	fmt.Println("UUID5", UUID5)
}

Index

Constants

This section is empty.

Variables

View Source
var (
	NamespaceDNS  = UUID{107, 167, 184, 16, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NamespaceURL  = UUID{107, 167, 184, 17, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NamespaceOID  = UUID{107, 167, 184, 18, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NamespaceX500 = UUID{107, 167, 184, 20, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
)

The following standard UUIDs are for use with UUID3() or UUID5().

Functions

This section is empty.

Types

type UUID

type UUID [16]byte

UUID represents a UUID

func UUID3

func UUID3(namespace UUID, name string) UUID

UUID3 generates a version 3 UUID

func UUID4

func UUID4() UUID

UUID4 generates a version 4 UUID

func UUID5

func UUID5(namespace UUID, name string) UUID

UUID5 generates a version 5 UUID

func (UUID) String

func (u UUID) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL