Documentation
¶
Index ¶
- Constants
- func Cache() *cacheStruct
- func PerformOperation(ctx *sql.Context, targetSection Section, operation Operation, originalID Id, ...) error
- func RegisterListener(listener Listener, sections ...Section)
- func ValidateOperation(ctx *sql.Context, targetSection Section, operation Operation, originalID Id, ...) error
- type AccessMethod
- type Check
- type Collation
- type ColumnDefault
- type Database
- type EnumLabel
- type ForeignKey
- type Function
- type Id
- type Index
- type Listener
- type Namespace
- type Oid
- type Operation
- type Section
- type Sequence
- type Table
- type Type
- type View
Constants ¶
const ( // Null is an empty, invalid ID. Null Id = "" // NullAccessMethod is an empty, invalid ID. This is exactly equivalent to Null. NullAccessMethod AccessMethod = "" // NullCheck is an empty, invalid ID. This is exactly equivalent to Null. NullCheck Check = "" // NullCollation is an empty, invalid ID. This is exactly equivalent to Null. NullCollation Collation = "" // NullColumnDefault is an empty, invalid ID. This is exactly equivalent to Null. NullColumnDefault ColumnDefault = "" // NullDatabase is an empty, invalid ID. This is exactly equivalent to Null. NullDatabase Database = "" // NullEnumLabel is an empty, invalid ID. This is exactly equivalent to Null. NullEnumLabel EnumLabel = "" // NullForeignKey is an empty, invalid ID. This is exactly equivalent to Null. NullForeignKey ForeignKey = "" // NullFunction is an empty, invalid ID. This is exactly equivalent to Null. NullFunction Function = "" // NullIndex is an empty, invalid ID. This is exactly equivalent to Null. NullIndex Index = "" // NullNamespace is an empty, invalid ID. This is exactly equivalent to Null. NullNamespace Namespace = "" // NullSequence is an empty, invalid ID. This is exactly equivalent to Null. NullSequence Sequence = "" // NullTable is an empty, invalid ID. This is exactly equivalent to Null. NullTable Table = "" // NullType is an empty, invalid ID. This is exactly equivalent to Null. NullType Type = "" // NullView is an empty, invalid ID. This is exactly equivalent to Null. NullView View = "" )
Variables ¶
This section is empty.
Functions ¶
func Cache ¶
func Cache() *cacheStruct
Cache returns the global cache that is used for the server session.
func PerformOperation ¶ added in v0.17.0
func PerformOperation(ctx *sql.Context, targetSection Section, operation Operation, originalID Id, newID Id) error
PerformOperation calls all registered performers that are associated with the given section. This does not call any validators, which should be done using ValidateOperation. This returns the first error that is encountered.
func RegisterListener ¶ added in v0.17.0
RegisterListener registers the given listener for the given sections.
For example, sequences are related to tables. Whenever a table operation is performed that changes its ID, sequences will also need to update their IDs that reference the table. This is accomplished by registering a performer that accepts a table section, where the performer modifies sequences as needed.
Performers should not register sections that are directly related to themselves. For example, a sequence performer should not register itself under the sequence section, as it will be the one broadcasting that section, and therefore could cause a loop.
Types ¶
type AccessMethod ¶ added in v0.17.0
type AccessMethod Id
AccessMethod is an Id wrapper for access methods. This wrapper must not be returned to the client.
func NewAccessMethod ¶ added in v0.17.0
func NewAccessMethod(methodName string) AccessMethod
NewAccessMethod returns a new AccessMethod. This wrapper must not be returned to the client.
func (AccessMethod) AsId ¶ added in v0.17.0
func (id AccessMethod) AsId() Id
AsId returns the unwrapped ID.
func (AccessMethod) IsValid ¶ added in v0.17.0
func (id AccessMethod) IsValid() bool
IsValid returns whether the ID is valid.
func (AccessMethod) MethodName ¶ added in v0.17.0
func (id AccessMethod) MethodName() string
MethodName returns the method's name.
type Check ¶ added in v0.17.0
type Check Id
Check is an Id wrapper for checks. This wrapper must not be returned to the client.
func NewCheck ¶ added in v0.17.0
NewCheck returns a new Check. This wrapper must not be returned to the client.
func (Check) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the check.
type Collation ¶ added in v0.17.0
type Collation Id
Collation is an Id wrapper for collations. This wrapper must not be returned to the client.
func NewCollation ¶ added in v0.17.0
NewCollation returns a new Collation. This wrapper must not be returned to the client.
func (Collation) CollationName ¶ added in v0.17.0
CollationName returns the collation's name.
func (Collation) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the collation.
type ColumnDefault ¶ added in v0.17.0
type ColumnDefault Id
ColumnDefault is an Id wrapper for column defaults. This wrapper must not be returned to the client.
func NewColumnDefault ¶ added in v0.17.0
func NewColumnDefault(schemaName string, tableName string, columnName string) ColumnDefault
NewColumnDefault returns a new ColumnDefault. This wrapper must not be returned to the client.
func (ColumnDefault) AsId ¶ added in v0.17.0
func (id ColumnDefault) AsId() Id
AsId returns the unwrapped ID.
func (ColumnDefault) ColumnName ¶ added in v0.17.0
func (id ColumnDefault) ColumnName() string
ColumnName returns the column's name that the default belongs to.
func (ColumnDefault) IsValid ¶ added in v0.17.0
func (id ColumnDefault) IsValid() bool
IsValid returns whether the ID is valid.
func (ColumnDefault) SchemaName ¶ added in v0.17.0
func (id ColumnDefault) SchemaName() string
SchemaName returns the schema name of the column default.
func (ColumnDefault) TableName ¶ added in v0.17.0
func (id ColumnDefault) TableName() string
TableName returns the name of the table that the column belongs to.
type Database ¶ added in v0.17.0
type Database Id
Database is an Id wrapper for databases. This wrapper must not be returned to the client.
func NewDatabase ¶ added in v0.17.0
NewDatabase returns a new Database. This wrapper must not be returned to the client.
func (Database) DatabaseName ¶ added in v0.17.0
DatabaseName returns the database's name.
type EnumLabel ¶ added in v0.17.0
type EnumLabel Id
EnumLabel is an Id wrapper for enum labels. This wrapper must not be returned to the client.
func NewEnumLabel ¶ added in v0.17.0
NewEnumLabel returns a new EnumLabel. This wrapper must not be returned to the client.
type ForeignKey ¶ added in v0.17.0
type ForeignKey Id
ForeignKey is an Id wrapper for foreign keys. This wrapper must not be returned to the client.
func NewForeignKey ¶ added in v0.17.0
func NewForeignKey(schemaName string, tableName string, fkName string) ForeignKey
NewForeignKey returns a new ForeignKey. This wrapper must not be returned to the client.
func (ForeignKey) AsId ¶ added in v0.17.0
func (id ForeignKey) AsId() Id
AsId returns the unwrapped ID.
func (ForeignKey) ForeignKeyName ¶ added in v0.17.0
func (id ForeignKey) ForeignKeyName() string
ForeignKeyName returns the foreign key's name.
func (ForeignKey) IsValid ¶ added in v0.17.0
func (id ForeignKey) IsValid() bool
IsValid returns whether the ID is valid.
func (ForeignKey) SchemaName ¶ added in v0.17.0
func (id ForeignKey) SchemaName() string
SchemaName returns the schema name of the foreign key.
func (ForeignKey) TableName ¶ added in v0.17.0
func (id ForeignKey) TableName() string
TableName returns the name of the table that the foreign key belongs to.
type Function ¶ added in v0.17.0
type Function Id
Function is an Id wrapper for functions. This wrapper must not be returned to the client.
func NewFunction ¶ added in v0.17.0
NewFunction returns a new Function. This wrapper must not be returned to the client.
func (Function) FunctionName ¶ added in v0.17.0
FunctionName returns the function's name.
func (Function) ParameterCount ¶ added in v0.17.0
ParameterCount returns the function's name.
func (Function) Parameters ¶ added in v0.17.0
Parameters returns the function's name.
func (Function) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the function.
type Id ¶ added in v0.17.0
type Id string
Id 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.
func NewId ¶ added in v0.17.0
NewId constructs an Id using the given section and data. In general, you should prefer to use the `NewIDTYPE` that matches the Section that's being created, and then convert that to an Id for returning or storage. You almost never want to call this function directly.
func (Id) CaseString ¶ added in v0.17.0
CaseString returns a quoted string that may be used to represent this ID in a switch-case.
func (Id) Segment ¶ added in v0.17.0
Segment returns the segment from the given index. An empty string is returned for an index not contained by the ID.
func (Id) SegmentCount ¶ added in v0.17.0
SegmentCount returns the number of segments that were in the original data.
func (Id) String ¶ added in v0.17.0
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 (Id) UnderlyingBytes ¶ added in v0.17.0
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 Index ¶ added in v0.17.0
type Index Id
Index is an Id wrapper for indexes. This wrapper must not be returned to the client.
func NewIndex ¶ added in v0.17.0
NewIndex returns a new Index. This wrapper must not be returned to the client.
func (Index) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the index.
type Listener ¶ added in v0.17.0
type Listener interface { // OperationPerformer is a function that performs the given operation on the original ID. Some operations, such as // renames, will use the new ID. OperationPerformer(ctx *sql.Context, operation Operation, originalID Id, newID Id) error // OperationValidator is a function that validates the given operation on the original ID. Some operations, such as // renames, will use the new ID. A validator is not required, and is intended for operations that may be relatively // expensive to perform, but able to check quickly for failures. In addition, validators should not perform any // modifications. If a validator is not required, then this should just return nil. OperationValidator(ctx *sql.Context, operation Operation, originalID Id, newID Id) error }
type Namespace ¶ added in v0.17.0
type Namespace Id
Namespace is an Id wrapper for schemas/namespaces. This wrapper must not be returned to the client.
func NewNamespace ¶ added in v0.17.0
NewNamespace returns a new Namespace. This wrapper must not be returned to the client.
func (Namespace) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name.
type Oid ¶ added in v0.17.0
type Oid Id
Oid is an Id wrapper for OIDs. This wrapper must not be returned to the client.
func NewOID ¶ added in v0.17.0
NewOID returns a new Oid. This wrapper must not be returned to the client.
type Operation ¶ added in v0.17.0
type Operation uint8
Operation represents an operation that is being performed or validated.
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 users 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.
type Sequence ¶ added in v0.17.0
type Sequence Id
Sequence is an Id wrapper for sequences. This wrapper must not be returned to the client.
func NewSequence ¶ added in v0.17.0
NewSequence returns a new Sequence. This wrapper must not be returned to the client.
func (Sequence) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the sequence.
func (Sequence) SequenceName ¶ added in v0.17.0
SequenceName returns the name of the sequence.
type Table ¶ added in v0.17.0
type Table Id
Table is an Id wrapper for tables. This wrapper must not be returned to the client.
func NewTable ¶ added in v0.17.0
NewTable returns a new Table. This wrapper must not be returned to the client.
func (Table) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the table.
type Type ¶ added in v0.17.0
type Type Id
Type is an Id wrapper for types. This wrapper must not be returned to the client.
func NewType ¶ added in v0.17.0
NewType returns a new Type. This wrapper must not be returned to the client.
func (Type) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the type.
type View ¶ added in v0.17.0
type View Id
View is an Id wrapper for views. This wrapper must not be returned to the client.
func NewView ¶ added in v0.17.0
NewView returns a new View. This wrapper must not be returned to the client.
func (View) SchemaName ¶ added in v0.17.0
SchemaName returns the schema name of the view.