Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created wrappers around Internal IDs for consistency and added an ID dispatch registry #1107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
28 changes: 28 additions & 0 deletions core/id/internal_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,34 @@ 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 = ""
// 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
Loading