Documentation
¶
Index ¶
- Constants
- type Collection
- func (pgs *Collection) Clone(ctx context.Context) *Collection
- func (pgs *Collection) CreateSequence(ctx context.Context, seq *Sequence) error
- func (pgs *Collection) DeserializeRootObject(ctx context.Context, data []byte) (objinterface.RootObject, error)
- func (pgs *Collection) DiffRootObjects(ctx context.Context, fromHash string, o objinterface.RootObject, ...) ([]objinterface.RootObjectDiff, objinterface.RootObject, error)
- func (pgs *Collection) DropRootObject(ctx context.Context, identifier id.Id) error
- func (pgs *Collection) DropSequence(ctx context.Context, names ...id.Sequence) (err error)
- func (pgs *Collection) GetAllSequences(ctx context.Context) (sequences map[string][]*Sequence, schemaNames []string, totalCount int, ...)
- func (pgs *Collection) GetFieldType(ctx context.Context, fieldName string) *pgtypes.DoltgresType
- func (pgs *Collection) GetID() objinterface.RootObjectID
- func (pgs *Collection) GetRootObject(ctx context.Context, identifier id.Id) (objinterface.RootObject, bool, error)
- func (pgs *Collection) GetSequence(ctx context.Context, name id.Sequence) (*Sequence, error)
- func (pgs *Collection) GetSequencesWithTable(ctx context.Context, name doltdb.TableName) ([]*Sequence, error)
- func (*Collection) HandleMerge(ctx context.Context, mro merge.MergeRootObject) (doltdb.RootObject, *merge.MergeStats, error)
- func (pgs *Collection) HasRootObject(ctx context.Context, identifier id.Id) (bool, error)
- func (pgs *Collection) HasSequence(ctx context.Context, name id.Sequence) bool
- func (pgs *Collection) IDToTableName(identifier id.Id) doltdb.TableName
- func (pgs *Collection) IterAll(ctx context.Context, ...) error
- func (pgs *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error
- func (pgs *Collection) IterateSequences(ctx context.Context, f func(seq *Sequence) (stop bool, err error)) (err error)
- func (*Collection) LoadCollection(ctx context.Context, root objinterface.RootValue) (objinterface.Collection, error)
- func (*Collection) LoadCollectionHash(ctx context.Context, root objinterface.RootValue) (hash.Hash, error)
- func (pgs *Collection) Map(ctx context.Context) (prolly.AddressMap, error)
- func (pgs *Collection) NextVal(ctx context.Context, name id.Sequence) (int64, error)
- func (pgs *Collection) PutRootObject(ctx context.Context, rootObj objinterface.RootObject) error
- func (pgs *Collection) RenameRootObject(ctx context.Context, oldName id.Id, newName id.Id) error
- func (pgs *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 (pgs *Collection) SetVal(ctx context.Context, name id.Sequence, newValue int64, autoAdvance bool) error
- func (pgs *Collection) TableNameToID(name doltdb.TableName) id.Id
- func (pgs *Collection) UpdateField(ctx context.Context, rootObject objinterface.RootObject, fieldName string, ...) (objinterface.RootObject, error)
- func (pgs *Collection) UpdateRoot(ctx context.Context, root objinterface.RootValue) (objinterface.RootValue, error)
- type Persistence
- type Sequence
- func (sequence *Sequence) GetID() id.Id
- func (sequence *Sequence) GetRootObjectID() objinterface.RootObjectID
- func (sequence *Sequence) HashOf(ctx context.Context) (hash.Hash, error)
- func (sequence *Sequence) Name() doltdb.TableName
- func (sequence *Sequence) Serialize(ctx context.Context) ([]byte, error)
Constants ¶
const ( FIELD_NAME_DATA_TYPE = "data_type" FIELD_NAME_PERSISTENCE = "persistence" FIELD_NAME_START = "start" FIELD_NAME_CURRENT = "current" FIELD_NAME_INCREMENT = "increment" FIELD_NAME_MINIMUM = "minimum" FIELD_NAME_MAXIMUM = "maximum" FIELD_NAME_CACHE = "cache" FIELD_NAME_CYCLE = "cycle" FIELD_NAME_IS_AT_END = "is_at_end" FIELD_NAME_OWNER_TABLE = "owner_table" FIELD_NAME_OWNER_COLUMN = "owner_column" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection contains a collection of sequences.
func LoadSequences ¶ added in v0.50.0
func LoadSequences(ctx context.Context, root objinterface.RootValue) (*Collection, error)
LoadSequences loads the sequences collection from the given root.
func (*Collection) Clone ¶ added in v0.8.0
func (pgs *Collection) Clone(ctx context.Context) *Collection
Clone returns a new *Collection with the same contents as the original.
func (*Collection) CreateSequence ¶
func (pgs *Collection) CreateSequence(ctx context.Context, seq *Sequence) error
CreateSequence creates a new sequence.
func (*Collection) DeserializeRootObject ¶ added in v0.51.1
func (pgs *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 (pgs *Collection) DiffRootObjects(ctx context.Context, fromHash string, o objinterface.RootObject, t objinterface.RootObject, a objinterface.RootObject) ([]objinterface.RootObjectDiff, objinterface.RootObject, error)
DiffRootObjects implements the interface objinterface.Collection.
func (*Collection) DropRootObject ¶ added in v0.50.0
DropRootObject implements the interface objinterface.Collection.
func (*Collection) DropSequence ¶
DropSequence drops existing sequences.
func (*Collection) GetAllSequences ¶ added in v0.10.0
func (pgs *Collection) GetAllSequences(ctx context.Context) (sequences map[string][]*Sequence, schemaNames []string, totalCount int, err error)
GetAllSequences returns a map containing all sequences in the collection, grouped by the schema they're contained in. Each sequence array is also sorted by the sequence name.
func (*Collection) GetFieldType ¶ added in v0.51.1
func (pgs *Collection) GetFieldType(ctx context.Context, fieldName string) *pgtypes.DoltgresType
GetFieldType implements the interface objinterface.Collection.
func (*Collection) GetID ¶ added in v0.50.0
func (pgs *Collection) GetID() objinterface.RootObjectID
GetID implements the interface objinterface.Collection.
func (*Collection) GetRootObject ¶ added in v0.50.0
func (pgs *Collection) GetRootObject(ctx context.Context, identifier id.Id) (objinterface.RootObject, bool, error)
GetRootObject implements the interface objinterface.Collection.
func (*Collection) GetSequence ¶ added in v0.8.0
GetSequence returns the sequence with the given schema and name. Returns nil if the sequence cannot be found.
func (*Collection) GetSequencesWithTable ¶ added in v0.8.0
func (pgs *Collection) GetSequencesWithTable(ctx context.Context, name doltdb.TableName) ([]*Sequence, error)
GetSequencesWithTable returns all sequences with the given table as the owner.
func (*Collection) HandleMerge ¶ added in v0.50.0
func (*Collection) HandleMerge(ctx context.Context, mro merge.MergeRootObject) (doltdb.RootObject, *merge.MergeStats, error)
HandleMerge implements the interface objinterface.Collection.
func (*Collection) HasRootObject ¶ added in v0.50.0
HasRootObject implements the interface objinterface.Collection.
func (*Collection) HasSequence ¶
HasSequence returns whether the sequence is present.
func (*Collection) IDToTableName ¶ added in v0.50.0
func (pgs *Collection) IDToTableName(identifier id.Id) doltdb.TableName
IDToTableName implements the interface objinterface.Collection.
func (*Collection) IterAll ¶ added in v0.50.0
func (pgs *Collection) IterAll(ctx context.Context, callback func(rootObj objinterface.RootObject) (stop bool, err error)) error
IterAll implements the interface objinterface.Collection.
func (*Collection) IterIDs ¶ added in v0.50.0
func (pgs *Collection) IterIDs(ctx context.Context, callback func(identifier id.Id) (stop bool, err error)) error
IterIDs implements the interface objinterface.Collection.
func (*Collection) IterateSequences ¶ added in v0.8.0
func (pgs *Collection) IterateSequences(ctx context.Context, f func(seq *Sequence) (stop bool, err error)) (err error)
IterateSequences iterates over all sequences in the collection.
func (*Collection) LoadCollection ¶ added in v0.50.0
func (*Collection) LoadCollection(ctx context.Context, root objinterface.RootValue) (objinterface.Collection, error)
LoadCollection implements the interface objinterface.Collection.
func (*Collection) LoadCollectionHash ¶ added in v0.50.0
func (*Collection) LoadCollectionHash(ctx context.Context, root objinterface.RootValue) (hash.Hash, error)
LoadCollectionHash implements the interface objinterface.Collection.
func (*Collection) Map ¶ added in v0.50.0
func (pgs *Collection) Map(ctx context.Context) (prolly.AddressMap, error)
Map writes any cached sequences to the underlying map, and then returns the underlying map.
func (*Collection) PutRootObject ¶ added in v0.50.0
func (pgs *Collection) PutRootObject(ctx context.Context, rootObj objinterface.RootObject) error
PutRootObject implements the interface objinterface.Collection.
func (*Collection) RenameRootObject ¶ added in v0.50.0
RenameRootObject implements the interface objinterface.Collection.
func (*Collection) ResolveName ¶ added in v0.50.0
func (pgs *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 ¶ added in v0.50.0
func (*Collection) Serializer() objinterface.RootObjectSerializer
Serializer implements the interface objinterface.Collection.
func (*Collection) SetVal ¶
func (pgs *Collection) SetVal(ctx context.Context, name id.Sequence, newValue int64, autoAdvance bool) error
SetVal sets the sequence to the
func (*Collection) TableNameToID ¶ added in v0.50.0
func (pgs *Collection) TableNameToID(name doltdb.TableName) id.Id
TableNameToID implements the interface objinterface.Collection.
func (*Collection) UpdateField ¶ added in v0.51.1
func (pgs *Collection) UpdateField(ctx context.Context, rootObject objinterface.RootObject, fieldName string, newValue any) (objinterface.RootObject, error)
UpdateField implements the interface objinterface.Collection.
func (*Collection) UpdateRoot ¶ added in v0.50.0
func (pgs *Collection) UpdateRoot(ctx context.Context, root objinterface.RootValue) (objinterface.RootValue, error)
UpdateRoot implements the interface objinterface.Collection.
type Persistence ¶
type Persistence uint8
Persistence controls the persistence of a Sequence.
const ( Persistence_Permanent Persistence = 0 Persistence_Temporary Persistence = 1 Persistence_Unlogged Persistence = 2 )
type Sequence ¶
type Sequence struct {
Id id.Sequence
DataTypeID id.Type
Persistence Persistence
Start int64
Current int64
Increment int64
Minimum int64
Maximum int64
Cache int64
Cycle bool
IsAtEnd bool
OwnerTable id.Table
OwnerColumn string
}
Sequence represents a single sequence within the pg_sequence table.
func DeserializeSequence ¶ added in v0.50.0
DeserializeSequence returns the Sequence that was serialized in the byte slice. Returns an empty Sequence if data is nil or empty.
func (*Sequence) GetRootObjectID ¶ added in v0.51.1
func (sequence *Sequence) GetRootObjectID() objinterface.RootObjectID
GetRootObjectID implements the interface objinterface.RootObject.