sequences

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 Deserialize

func Deserialize(ctx context.Context, data []byte) (*Collection, error)

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

func Merge

func Merge(ctx context.Context, ourCollection, theirCollection, ancCollection *Collection) (*Collection, error)

Merge handles merging sequences on our root and their root.

func (*Collection) Clone added in v0.8.0

func (pgs *Collection) Clone() *Collection

Clone returns a new *Collection with the same contents as the original.

func (*Collection) CreateSequence

func (pgs *Collection) CreateSequence(schema string, seq *Sequence) error

CreateSequence creates a new sequence.

func (*Collection) DropSequence

func (pgs *Collection) DropSequence(name doltdb.TableName) error

DropSequence drops an existing sequence.

func (*Collection) GetSequence added in v0.8.0

func (pgs *Collection) GetSequence(name doltdb.TableName) *Sequence

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(name doltdb.TableName) []*Sequence

GetSequencesWithTable returns all sequences with the given table as the owner.

func (*Collection) HasSequence

func (pgs *Collection) HasSequence(name doltdb.TableName) bool

HasSequence returns whether the sequence is present.

func (*Collection) IterateSequences added in v0.8.0

func (pgs *Collection) IterateSequences(f func(schema string, seq *Sequence) error) error

IterateSequences iterates over all sequences in the collection.

func (*Collection) NextVal

func (pgs *Collection) NextVal(schema, name string) (int64, error)

NextVal returns the next value in the sequence.

func (*Collection) Serialize

func (pgs *Collection) Serialize(ctx context.Context) ([]byte, error)

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

func (*Collection) SetVal

func (pgs *Collection) SetVal(schema, name string, newValue int64, autoAdvance bool) error

SetVal sets the sequence to the

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 {
	Name        string
	DataTypeOID uint32
	Persistence Persistence
	Start       int64
	Current     int64
	Increment   int64
	Minimum     int64
	Maximum     int64
	Cache       int64
	Cycle       bool
	IsAtEnd     bool
	OwnerUser   string
	OwnerTable  string
	OwnerColumn string
}

Sequence represents a single sequence within the pg_sequence table.

Jump to

Keyboard shortcuts

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