writer

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionRootSetter

type SessionRootSetter func(ctx *sql.Context, dbName string, root *doltdb.RootValue) error

SessionRootSetter sets the root value for the session.

type TableWriter

type TableWriter interface {
	sql.RowReplacer
	sql.RowUpdater
	sql.RowInserter
	sql.RowDeleter
	sql.ForeignKeyUpdater
	sql.AutoIncrementSetter
	GetNextAutoIncrementValue(ctx *sql.Context, insertVal interface{}) (uint64, error)
}

type WriteSession

type WriteSession interface {
	// GetTableWriter creates a TableWriter and adds it to the WriteSession.
	GetTableWriter(ctx context.Context, table, db string, setter SessionRootSetter, batched bool) (TableWriter, error)

	// UpdateWorkingSet takes a callback to update this WriteSession's WorkingSet. The update method cannot change the
	// WorkingSetRef of the WriteSession. WriteSession flushes the pending writes in the session before calling the update.
	UpdateWorkingSet(ctx context.Context, cb func(ctx context.Context, current *doltdb.WorkingSet) (*doltdb.WorkingSet, error)) error

	// SetWorkingSet modifies the state of the WriteSession. The WorkingSetRef of |ws| must match the existing Ref.
	SetWorkingSet(ctx context.Context, ws *doltdb.WorkingSet) error

	// GetOptions returns the editor.Options for this session.
	GetOptions() editor.Options

	// SetOptions sets the editor.Options for this session.
	SetOptions(opts editor.Options)

	WriteSessionFlusher
}

WriteSession encapsulates writes made within a SQL session. It's responsible for creating and managing the lifecycle of TableWriter's.

func NewWriteSession

NewWriteSession creates and returns a WriteSession. Inserting a nil root is not an error, as there are locations that do not have a root at the time of this call. However, a root must be set through SetRoot before any table editors are returned.

type WriteSessionFlusher

type WriteSessionFlusher interface {
	// Flush flushes the pending writes in the session.
	Flush(ctx context.Context) (*doltdb.WorkingSet, error)
}

WriteSessionFlusher is responsible for flushing any pending edits to the session

Jump to

Keyboard shortcuts

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