Skip to content

Commit

Permalink
Created wrappers around Internal IDs for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Hydrocharged committed Jan 8, 2025
1 parent 6e5dbf6 commit 738599c
Show file tree
Hide file tree
Showing 87 changed files with 864 additions and 443 deletions.
4 changes: 1 addition & 3 deletions core/id/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package id

import (
"hash/crc32"
"strconv"
"sync"
)

Expand Down Expand Up @@ -59,8 +58,7 @@ func (cache *cacheStruct) ToOID(id Internal) uint32 {
}
cache.mutex.RUnlock()
if id.Section() == Section_OID {
oid, _ := strconv.ParseUint(id.Segment(0), 10, 32)
return uint32(oid)
return InternalOID(id).OID()
}
cache.mutex.Lock()
defer cache.mutex.Unlock()
Expand Down
30 changes: 30 additions & 0 deletions core/id/internal_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,36 @@ const (
formatMask = uint8(0x80)
// Null is an empty, invalid ID.
Null Internal = ""
// NullAccessMethod is an empty, invalid ID. This is exactly equivalent to Null.
NullAccessMethod InternalAccessMethod = ""
// NullCheck is an empty, invalid ID. This is exactly equivalent to Null.
NullCheck InternalCheck = ""
// NullCollation is an empty, invalid ID. This is exactly equivalent to Null.
NullCollation InternalCollation = ""
// NullColumnDefault is an empty, invalid ID. This is exactly equivalent to Null.
NullColumnDefault InternalColumnDefault = ""
// NullDatabase is an empty, invalid ID. This is exactly equivalent to Null.
NullDatabase InternalDatabase = ""
// NullEnumLabel is an empty, invalid ID. This is exactly equivalent to Null.
NullEnumLabel InternalEnumLabel = ""
// NullForeignKey is an empty, invalid ID. This is exactly equivalent to Null.
NullForeignKey InternalForeignKey = ""
// NullFunction is an empty, invalid ID. This is exactly equivalent to Null.
NullFunction InternalFunction = ""
// NullIndex is an empty, invalid ID. This is exactly equivalent to Null.
NullIndex InternalIndex = ""
// NullNamespace is an empty, invalid ID. This is exactly equivalent to Null.
NullNamespace InternalNamespace = ""
// NullOID is an empty, invalid ID. This is exactly equivalent to Null.
NullOID InternalOID = ""
// NullSequence is an empty, invalid ID. This is exactly equivalent to Null.
NullSequence InternalSequence = ""
// NullTable is an empty, invalid ID. This is exactly equivalent to Null.
NullTable InternalTable = ""
// NullType is an empty, invalid ID. This is exactly equivalent to Null.
NullType InternalType = ""
// NullView is an empty, invalid ID. This is exactly equivalent to Null.
NullView InternalView = ""
)

// Internal is an ID that is used within Doltgres. This ID is never exposed to clients through any normal means, and
Expand Down
Loading

0 comments on commit 738599c

Please sign in to comment.