Documentation
¶
Index ¶
- Constants
- type GUID
- func (guid *GUID) Equal(other *GUID) bool
- func (guid *GUID) FromRawBytes(data []byte)
- func (guid *GUID) ToBytes() []byte
- func (guid *GUID) ToFormatB() string
- func (guid *GUID) ToFormatD() string
- func (guid *GUID) ToFormatN() string
- func (guid *GUID) ToFormatP() string
- func (guid *GUID) ToFormatX() string
Constants ¶
const ( GUID_FORMAT_N_REGEX = "^[0-9a-f]{32}$" GUID_FORMAT_D_REGEX = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" GUID_FORMAT_B_REGEX = "^\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}$" GUID_FORMAT_P_REGEX = "^\\([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\)$" GUID_FORMAT_X_REGEX = "" /* 167-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GUID ¶
GUID represents a globally unique identifier (GUID). It consists of five fields: A, B, C, D, and E, which are used to store the components of the GUID.
Fields: - A: A 32-bit unsigned integer representing the first part of the GUID. - B: A 16-bit unsigned integer representing the second part of the GUID. - C: A 16-bit unsigned integer representing the third part of the GUID. - D: A 16-bit unsigned integer representing the fourth part of the GUID. - E: A 64-bit unsigned integer representing the fifth part of the GUID.
func FromFormatB ¶
FromFormatB parses a GUID from a string in the format B: {00000000-0000-0000-0000-000000000000}
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format B.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format B.
func FromFormatD ¶
FromFormatD parses a GUID from a string in the format D: 00000000-0000-0000-0000-000000000000
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format D.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format D.
func FromFormatN ¶
FromFormatN parses a GUID from a string in the format N: 00000000000000000000000000000000
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format N.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format N.
func FromFormatP ¶
FromFormatP parses a GUID from a string in the format P: (00000000-0000-0000-0000-000000000000)
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format P.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format P.
func FromFormatX ¶
FromFormatX parses a GUID from a string in the format X: {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID in the format X.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID in the format X.
func FromString ¶
FromString parses a GUID from a string.
The function takes a string and parses it into a GUID.
Parameters: - data: A string containing the GUID.
Returns: - A pointer to the parsed GUID. - An error if the string is not a valid GUID.
func NewGUID ¶
func NewGUID() *GUID
NewGUID generates a new random GUID.
The function creates a new GUID by generating random values for each of its five fields: - A: A 32-bit unsigned integer. - B: A 16-bit unsigned integer. - C: A 16-bit unsigned integer. - D: A 16-bit unsigned integer. - E: A 64-bit unsigned integer.
Returns: - A pointer to a newly generated GUID.
func (*GUID) Equal ¶
Equal checks if two GUIDs are equal.
The function compares the two GUIDs and returns true if they are equal, false otherwise.
func (*GUID) FromRawBytes ¶
FromRawBytes parses a GUID from a raw byte array.
The function takes a byte array and assigns the values to the GUID fields.
Parameters: - data: A byte array containing the raw bytes of the GUID.
Returns: - A pointer to the parsed GUID.
func (*GUID) ToBytes ¶
ToBytes returns the raw byte array representation of the GUID.
The function converts the GUID into a byte array.
Returns: - A byte array containing the raw bytes of the GUID.
func (*GUID) ToFormatB ¶
ToFormatB returns the GUID in the format B: {00000000-0000-0000-0000-000000000000}
The function converts the GUID into a string in the format B.
Returns: - A string containing the GUID in the format B.
func (*GUID) ToFormatD ¶
ToFormatD returns the GUID in the format D: 00000000-0000-0000-0000-000000000000
The function converts the GUID into a string in the format D.
Returns: - A string containing the GUID in the format D.
func (*GUID) ToFormatN ¶
ToFormatN returns the GUID in the format N: 00000000000000000000000000000000
The function converts the GUID into a string in the format N.
Returns: - A string containing the GUID in the format N.