id

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache() *cacheStruct

Cache returns the global cache that is used for the server session.

Types

type Internal

type Internal string

Internal is an ID that is used within Doltgres. This ID is never exposed to clients through any normal means, and exists solely for internal operations to be able to identify specific items. This functions as an internal replacement for Postgres' OIDs.

const (

	// Null is an empty, invalid ID.
	Null Internal = ""
)

func NewInternal

func NewInternal(section Section, data ...string) Internal

NewInternal constructs an Internal ID using the given section and data.

func (Internal) CaseString

func (id Internal) CaseString() string

CaseString returns a quoted string that may be used to represent this ID in a switch-case.

func (Internal) Data

func (id Internal) Data() []string

Data returns the original data used to create this Internal ID.

func (Internal) IsValid

func (id Internal) IsValid() bool

IsValid returns whether the Internal ID is valid.

func (Internal) Section

func (id Internal) Section() Section

Section returns the Section for this Internal ID.

func (Internal) Segment

func (id Internal) Segment(index int) string

Segment returns the segment from the given index. An empty string is returned for an index not contained by the ID.

func (Internal) SegmentCount

func (id Internal) SegmentCount() int

SegmentCount returns the number of segments that were in the original data.

func (Internal) String

func (id Internal) String() string

String returns a display-suitable version of the ID. Although the ID is implemented as a string, it should not be treated as a string except for the purposes of storage and retrieval.

func (Internal) UnderlyingBytes

func (id Internal) UnderlyingBytes() []byte

UnderlyingBytes returns the underlying bytes for the ID. These must not be modified, as this is intended solely for efficient usage of operations that require byte slices.

type Section

type Section uint8

Section represents a specific space that an Internal ID resides in. This makes it relatively simple to find the target of the ID, since each searchable space has its own section.

const (
	Section_Null                 Section = 0  // Represents a null ID
	Section_AccessMethod         Section = 1  // Refers to relation access methods
	Section_Cast                 Section = 2  // Refers to casts between types
	Section_Check                Section = 3  // Refers to checks on tables
	Section_Collation            Section = 4  // Refers to collations
	Section_ColumnDefault        Section = 5  // Refers to column defaults on tables
	Section_Database             Section = 6  // Refers to the database
	Section_EnumLabel            Section = 7  // Refers to a specific label in an ENUM type
	Section_EventTrigger         Section = 8  // Refers to event triggers
	Section_ExclusionConstraint  Section = 9  // Refers to exclusion constraints
	Section_Extension            Section = 10 // Refers to extensions
	Section_ForeignKey           Section = 11 // Refers to foreign keys on tables
	Section_ForeignDataWrapper   Section = 12 // Refers to foreign data wrappers
	Section_ForeignServer        Section = 13 // Refers to foreign servers
	Section_ForeignTable         Section = 14 // Refers to foreign tables
	Section_Function             Section = 15 // Refers to functions
	Section_FunctionLanguage     Section = 16 // Refers to the programming languages available for writing functions
	Section_Index                Section = 17 // Refers to indexes on tables
	Section_Namespace            Section = 18 // Namespaces are the underlying structure of a schema (basically the schema)
	Section_OID                  Section = 19 // Refers to a raw OID that is not actually attached to anything (ONLY used with reg types)
	Section_Operator             Section = 20 // Refers to operators (+, -, *, etc.)
	Section_OperatorClass        Section = 21 // Refers to operator classes
	Section_OperatorFamily       Section = 22 // Refers to operator families
	Section_PrimaryKey           Section = 23 // Refers to primary keys on tables
	Section_Procedure            Section = 24 // Refers to stored procedures
	Section_Publication          Section = 25 // Refers to publications
	Section_RowLevelSecurity     Section = 26 // Refers to row-level security polices on tables
	Section_Sequence             Section = 27 // Refers to sequences
	Section_Subscription         Section = 28 // Refers to logical replication subscriptions
	Section_Table                Section = 29 // Refers to tables
	Section_TextSearchConfig     Section = 30 // Refers to text search configuration
	Section_TextSearchDictionary Section = 31 // Refers to text search dictionaries
	Section_TextSearchParser     Section = 32 // Refers to text search parsers
	Section_TextSearchTemplate   Section = 33 // Refers to text search templates
	Section_Trigger              Section = 34 // Refers to triggers on tables and views
	Section_Type                 Section = 35 // Refers to types
	Section_UniqueKey            Section = 36 // Refers to unique keys on tables
	Section_User                 Section = 37 // Refers to user
	Section_View                 Section = 38 // Refers to views
)

All new sections must be given an unused number, as these may be persisted in tables. Changing them would change pre-existing table data, potentially corrupting that table data. At most, there can be 127 sections, since the first bit is reserved to determine a format's encoding.

func (Section) String

func (section Section) String() string

String returns the name of the Section.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL