Documentation
¶
Index ¶
- func TriggerIDToTableName(trigID id.Trigger) doltdb.TableName
- type Collection
- func (pgt *Collection) AddTrigger(ctx context.Context, t Trigger) error
- func (pgt *Collection) DeserializeRootObject(ctx context.Context, data []byte) (objinterface.RootObject, error)
- func (pgt *Collection) DiffRootObjects(ctx context.Context, fromHash string, ours objinterface.RootObject, ...) ([]objinterface.RootObjectDiff, objinterface.RootObject, error)
- func (pgt *Collection) DropRootObject(ctx context.Context, identifier id.Id) error
- func (pgt *Collection) DropTrigger(ctx context.Context, trigIDs ...id.Trigger) error
- func (pgt *Collection) GetFieldType(ctx context.Context, fieldName string) *pgtypes.DoltgresType
- func (pgt *Collection) GetID() objinterface.RootObjectID
- func (pgt *Collection) GetRootObject(ctx context.Context, identifier id.Id) (objinterface.RootObject, bool, error)
- func (pgt *Collection) GetTrigger(ctx context.Context, trigID id.Trigger) (Trigger, error)
- func (pgt *Collection) GetTriggerIDsForTable(ctx context.Context, tableID id.Table) []id.Trigger
- func (pgt *Collection) GetTriggersForTable(ctx context.Context, tableID id.Table) []Trigger
- func (pgt *Collection) GetTriggersForTableByTiming(ctx context.Context, tableID id.Table, timing TriggerTiming) []Trigger
- func (*Collection) HandleMerge(ctx context.Context, mro merge.MergeRootObject) (doltdb.RootObject, *merge.MergeStats, error)
- func (pgt *Collection) HasRootObject(ctx context.Context, identifier id.Id) (bool, error)
- func (pgt *Collection) HasTrigger(ctx context.Context, trigID id.Trigger) bool
- func (pgt *Collection) IDToTableName(identifier id.Id) doltdb.TableName
- func (pgt *Collection) IterAll(ctx context.Context, ...) error
- func (pgt *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error
- func (pgt *Collection) IterateTriggers(ctx context.Context, callback func(t Trigger) (stop bool, err error)) error
- func (*Collection) LoadCollection(ctx context.Context, root objinterface.RootValue) (objinterface.Collection, error)
- func (pgt *Collection) PutRootObject(ctx context.Context, rootObj objinterface.RootObject) error
- func (pgt *Collection) RenameRootObject(ctx context.Context, oldName id.Id, newName id.Id) error
- func (pgt *Collection) ResolveName(ctx context.Context, name doltdb.TableName) (doltdb.TableName, id.Id, error)
- func (*Collection) ResolveNameFromObjects(ctx context.Context, name doltdb.TableName, ...) (doltdb.TableName, id.Id, error)
- func (*Collection) Serializer() objinterface.RootObjectSerializer
- func (pgt *Collection) TableNameToID(name doltdb.TableName) id.Id
- func (pgt *Collection) UpdateField(ctx context.Context, rootObject objinterface.RootObject, fieldName string, ...) (objinterface.RootObject, error)
- type Trigger
- type TriggerDeferrable
- type TriggerEvent
- type TriggerEventType
- type TriggerTiming
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collection ¶
type Collection struct {
objinterface.RootObjectMap
// contains filtered or unexported fields
}
Collection contains a collection of triggers.
func LoadTriggers ¶
func LoadTriggers(ctx context.Context, root objinterface.RootValue) (*Collection, error)
LoadTriggers loads the triggers collection from the given root.
func NewCollection ¶
func NewCollection(ctx context.Context, rom objinterface.RootObjectMap) (*Collection, error)
NewCollection returns a new Collection.
func (*Collection) AddTrigger ¶
func (pgt *Collection) AddTrigger(ctx context.Context, t Trigger) error
AddTrigger adds a new trigger.
func (*Collection) DeserializeRootObject ¶ added in v0.51.1
func (pgt *Collection) DeserializeRootObject(ctx context.Context, data []byte) (objinterface.RootObject, error)
DeserializeRootObject implements the interface objinterface.Collection.
func (*Collection) DiffRootObjects ¶ added in v0.51.1
func (pgt *Collection) DiffRootObjects(ctx context.Context, fromHash string, ours objinterface.RootObject, theirs objinterface.RootObject, ancestor objinterface.RootObject) ([]objinterface.RootObjectDiff, objinterface.RootObject, error)
DiffRootObjects implements the interface objinterface.Collection.
func (*Collection) DropRootObject ¶
DropRootObject implements the interface objinterface.Collection.
func (*Collection) DropTrigger ¶
DropTrigger drops an existing trigger.
func (*Collection) GetFieldType ¶ added in v0.51.1
func (pgt *Collection) GetFieldType(ctx context.Context, fieldName string) *pgtypes.DoltgresType
GetFieldType implements the interface objinterface.Collection.
func (*Collection) GetID ¶
func (pgt *Collection) GetID() objinterface.RootObjectID
GetID implements the interface objinterface.Collection.
func (*Collection) GetRootObject ¶
func (pgt *Collection) GetRootObject(ctx context.Context, identifier id.Id) (objinterface.RootObject, bool, error)
GetRootObject implements the interface objinterface.Collection.
func (*Collection) GetTrigger ¶
GetTrigger returns the trigger with the given ID. Returns a trigger with an invalid ID if it cannot be found (Trigger.ID.IsValid() == false).
func (*Collection) GetTriggerIDsForTable ¶
GetTriggerIDsForTable returns the trigger IDs for the given table.
func (*Collection) GetTriggersForTable ¶
GetTriggersForTable returns the triggers for the given table.
func (*Collection) GetTriggersForTableByTiming ¶
func (pgt *Collection) GetTriggersForTableByTiming(ctx context.Context, tableID id.Table, timing TriggerTiming) []Trigger
GetTriggersForTableByTiming returns the triggers for the given table, all matching the given timing. These triggers are also sorted by their name ascending.
func (*Collection) HandleMerge ¶
func (*Collection) HandleMerge(ctx context.Context, mro merge.MergeRootObject) (doltdb.RootObject, *merge.MergeStats, error)
HandleMerge implements the interface objinterface.Collection.
func (*Collection) HasRootObject ¶
HasRootObject implements the interface objinterface.Collection.
func (*Collection) HasTrigger ¶
HasTrigger returns whether the trigger is present.
func (*Collection) IDToTableName ¶
func (pgt *Collection) IDToTableName(identifier id.Id) doltdb.TableName
IDToTableName implements the interface objinterface.Collection.
func (*Collection) IterAll ¶
func (pgt *Collection) IterAll(ctx context.Context, callback func(rootObj objinterface.RootObject) (stop bool, err error)) error
IterAll implements the interface objinterface.Collection.
func (*Collection) IterIDs ¶
func (pgt *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error
IterIDs implements the interface objinterface.Collection.
func (*Collection) IterateTriggers ¶
func (pgt *Collection) IterateTriggers(ctx context.Context, callback func(t Trigger) (stop bool, err error)) error
IterateTriggers iterates over all triggers in the collection.
func (*Collection) LoadCollection ¶
func (*Collection) LoadCollection(ctx context.Context, root objinterface.RootValue) (objinterface.Collection, error)
LoadCollection implements the interface objinterface.Collection.
func (*Collection) PutRootObject ¶
func (pgt *Collection) PutRootObject(ctx context.Context, rootObj objinterface.RootObject) error
PutRootObject implements the interface objinterface.Collection.
func (*Collection) RenameRootObject ¶
RenameRootObject implements the interface objinterface.Collection.
func (*Collection) ResolveName ¶
func (pgt *Collection) ResolveName(ctx context.Context, name doltdb.TableName) (doltdb.TableName, id.Id, error)
ResolveName implements the interface objinterface.Collection.
func (*Collection) ResolveNameFromObjects ¶ added in v0.51.1
func (*Collection) ResolveNameFromObjects(ctx context.Context, name doltdb.TableName, rootObjects []objinterface.RootObject) (doltdb.TableName, id.Id, error)
ResolveNameFromObjects implements the interface objinterface.Collection.
func (*Collection) Serializer ¶
func (*Collection) Serializer() objinterface.RootObjectSerializer
Serializer implements the interface objinterface.Collection.
func (*Collection) TableNameToID ¶
func (pgt *Collection) TableNameToID(name doltdb.TableName) id.Id
TableNameToID implements the interface objinterface.Collection.
func (*Collection) UpdateField ¶ added in v0.51.1
func (pgt *Collection) UpdateField(ctx context.Context, rootObject objinterface.RootObject, fieldName string, newValue any) (objinterface.RootObject, error)
UpdateField implements the interface objinterface.Collection.
type Trigger ¶
type Trigger struct {
ID id.Trigger
Function id.Function
Timing TriggerTiming
Events []TriggerEvent
ForEachRow bool // When false, represents FOR EACH STATEMENT
When []plpgsql.InterpreterOperation
Deferrable TriggerDeferrable
ReferencedTableName id.Table // FROM referenced_table_name
Constraint bool
OldTransitionName string // REFERENCING OLD TABLE AS transition_relation_name
NewTransitionName string // REFERENCING NEW TABLE AS transition_relation_name
Arguments []string
Definition string
}
Trigger represents a trigger.
func DeserializeTrigger ¶
DeserializeTrigger returns the Trigger that was serialized in the byte slice. Returns an empty Trigger (invalid ID) if data is nil or empty.
func (Trigger) GetRootObjectID ¶ added in v0.51.1
func (trigger Trigger) GetRootObjectID() objinterface.RootObjectID
GetRootObjectID implements the interface objinterface.RootObject.
type TriggerDeferrable ¶
type TriggerDeferrable uint8
TriggerDeferrable specifies whether the trigger is deferrable.
const ( TriggerDeferrable_NotDeferrable TriggerDeferrable = 0 // NOT DEFERRABLE TriggerDeferrable_DeferrableImmediate TriggerDeferrable = 1 // DEFERRABLE INITIALLY IMMEDIATE TriggerDeferrable_DeferrableDeferred TriggerDeferrable = 2 // DEFERRABLE INITIALLY DEFERRED )
type TriggerEvent ¶
type TriggerEvent struct {
Type TriggerEventType
ColumnNames []string
}
TriggerEvent specifies the event type, along with column information for update events.
type TriggerEventType ¶
type TriggerEventType uint8
TriggerEventType specifies which type of event that the trigger applies to.
const ( TriggerEventType_Insert TriggerEventType = 0 TriggerEventType_Update TriggerEventType = 1 TriggerEventType_Delete TriggerEventType = 2 TriggerEventType_Truncate TriggerEventType = 3 )
type TriggerTiming ¶
type TriggerTiming uint8
TriggerTiming specifies the timing of the trigger's execution.
const ( TriggerTiming_Before TriggerTiming = 0 TriggerTiming_After TriggerTiming = 1 TriggerTiming_InsteadOf TriggerTiming = 2 )