sequences

package
v0.52.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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

DiffRootObjects implements the interface objinterface.Collection.

func (*Collection) DropRootObject added in v0.50.0

func (pgs *Collection) DropRootObject(ctx context.Context, identifier id.Id) error

DropRootObject implements the interface objinterface.Collection.

func (*Collection) DropSequence

func (pgs *Collection) DropSequence(ctx context.Context, names ...id.Sequence) (err error)

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

func (pgs *Collection) GetSequence(ctx context.Context, name id.Sequence) (*Sequence, error)

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

HandleMerge implements the interface objinterface.Collection.

func (*Collection) HasRootObject added in v0.50.0

func (pgs *Collection) HasRootObject(ctx context.Context, identifier id.Id) (bool, error)

HasRootObject implements the interface objinterface.Collection.

func (*Collection) HasSequence

func (pgs *Collection) HasSequence(ctx context.Context, name id.Sequence) bool

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

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) NextVal

func (pgs *Collection) NextVal(ctx context.Context, name id.Sequence) (int64, error)

NextVal returns the next value in the sequence.

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

func (pgs *Collection) RenameRootObject(ctx context.Context, oldName id.Id, newName id.Id) error

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

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

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

func DeserializeSequence(ctx context.Context, data []byte) (*Sequence, error)

DeserializeSequence returns the Sequence that was serialized in the byte slice. Returns an empty Sequence if data is nil or empty.

func (*Sequence) GetID added in v0.50.0

func (sequence *Sequence) GetID() id.Id

GetID implements the interface objinterface.RootObject.

func (*Sequence) GetRootObjectID added in v0.51.1

func (sequence *Sequence) GetRootObjectID() objinterface.RootObjectID

GetRootObjectID implements the interface objinterface.RootObject.

func (*Sequence) HashOf added in v0.50.0

func (sequence *Sequence) HashOf(ctx context.Context) (hash.Hash, error)

HashOf implements the interface rootobject.RootObject.

func (*Sequence) Name

func (sequence *Sequence) Name() doltdb.TableName

Name implements the interface rootobject.RootObject.

func (*Sequence) Serialize added in v0.50.0

func (sequence *Sequence) Serialize(ctx context.Context) ([]byte, error)

Serialize returns the Sequence as a byte slice. If the Sequence is nil, then this returns a nil slice.

Jump to

Keyboard shortcuts

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