tentone / mssql-uuid

Go implementation of MS SQL Server Uniqueidentifier type.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mssql-uuid

  • Go implementation of MS SQL Server uniqueidentifier type.
  • Implements the JSON Marshal/Unmarshal and SQL Scan interfaces to ensure that data is read correctly from DB.
  • The uniqueidentifier data type is a 16-byte GUID*.
  • This data type is used as primary key alternative to identity columns.
  • uniqueidentifier is globally unique, whereas identity is unique within a table.
  • Can be used alongside ORM such as GORM

Example

package main

import uuid "github.com/tentone/mssql-uuid"

func main() {
	var uid uuid.UUID = uuid.NewV4()
	print(uid.String())
}

UUID Storage

  • Microsoft implementation of UUID uses litle endian for the first half the first 8 bytes, and big Endian encoding for the second 8 bytes.
  • Because of this other UUID libs fail to correctly parse the data.
LLLLLLLL-LLLL-LLLL-BBBB-BBBBBBBBBBBB

License

  • The project is distributed under MIT license.
  • The lincese is available on the repository.

About

Go implementation of MS SQL Server Uniqueidentifier type.

License:MIT License


Languages

Language:Go 100.0%