The UUID struct wraps the UUID type of the github.com/gofrs/uuid package. The SDK encodes a UUID as CBOR tag 37, the tag that SurrealDB specifies for a UUID. A UUID can hold a UUID v4 or v7 value.
Package: github.com/surrealdb/surrealdb.go/v2/pkg/models
Source: pkg/models/uuid.go
Definition
type UUID struct {
uuid.UUID
}UUID embeds github.com/gofrs/uuid.UUID, so every method of uuid.UUID is available on it.
Related types
UUIDString
A string type that holds a UUID as text. The SDK encodes it as CBOR tag 9.
type UUIDString stringCBOR encoding
The SDK encodes a UUID as CBOR tag 37, which holds the UUID as 16 bytes. It encodes a UUIDString as CBOR tag 9, which holds the UUID as text.
Usage
Live query functions return a UUID, and a new session or transaction has a UUID as its ID. You usually get a UUID from the SDK instead of making one yourself.
liveID, err := surrealdb.Live(ctx, db, models.Table("persons"), false)
fmt.Println(liveID.String())See also
Live queries for live query UUIDs
Session for session UUIDs
Transaction for transaction UUIDs
Value types for the full type mapping
SurrealQL UUID type for the underlying data model