database

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package database provides database primitives such as tables, transactions and indexes.

Index

Constants

View Source
const (
	CatalogTableName  = InternalPrefix + "catalog"
	SequenceTableName = InternalPrefix + "sequence"
)

System tables

View Source
const (
	RelationTableType    = "table"
	RelationIndexType    = "index"
	RelationSequenceType = "sequence"
)

Relation types

View Source
const (
	CatalogTableNamespace    tree.Namespace = 1
	SequenceTableNamespace   tree.Namespace = 2
	RollbackSegmentNamespace tree.Namespace = 3
	MinTransientNamespace    tree.Namespace = math.MaxInt64 - 1<<24
	MaxTransientNamespace    tree.Namespace = math.MaxInt64
)

System namespaces

View Source
const (
	// OnConflictDoNothing ignores the duplicate error and returns nothing.
	OnConflictDoNothing = iota + 1

	// OnConflictDoReplace replaces the conflicting row with a new one.
	OnConflictDoReplace
)
View Source
const (
	InternalPrefix = "__chai_"
)
View Source
const (
	StoreSequence = InternalPrefix + "store_seq"
)

System sequences

Variables

View Source
var (
	// ErrIndexDuplicateValue is returned when a value is already associated with a key
	ErrIndexDuplicateValue = errors.New("duplicate value")
)

Functions

func IsConstraintViolationError

func IsConstraintViolationError(err error) bool

Types

type BasicRow

type BasicRow struct {
	row.Row
	// contains filtered or unexported fields
}

func NewBasicRow

func NewBasicRow(r row.Row) *BasicRow

func (*BasicRow) Key

func (r *BasicRow) Key() *tree.Key

func (*BasicRow) OriginalRow added in v0.17.0

func (r *BasicRow) OriginalRow() Row

func (*BasicRow) ResetWith

func (r *BasicRow) ResetWith(tableName string, key *tree.Key, rr row.Row)

func (*BasicRow) SetOriginalRow added in v0.17.0

func (r *BasicRow) SetOriginalRow(original Row)

func (*BasicRow) TableName

func (r *BasicRow) TableName() string

type Catalog

type Catalog struct {
	Cache        *catalogCache
	CatalogTable *CatalogStore

	TransientNamespaces *atomic.Counter
}

Catalog manages all database objects such as tables, indexes and sequences. It stores all these objects in memory for fast access. Any modification is persisted into the __chai_catalog table.

func NewCatalog

func NewCatalog() *Catalog

func (*Catalog) Clone

func (c *Catalog) Clone() *Catalog

func (*Catalog) GetFreeTransientNamespace

func (c *Catalog) GetFreeTransientNamespace() tree.Namespace

GetFreeTransientNamespace returns the next available transient namespace. Transient namespaces start from math.MaxInt64 - (2 << 24) to math.MaxInt64 (around 16 M). The transient namespaces counter is not persisted and resets when the database is restarted. Once the counter reaches its maximum value, it will wrap around to the minimum value. Technically, if a transient namespace is still in use by the time the counter wraps around its data may be overwritten. However, transient trees are supposed to verify that the namespace is not in use before writing to it.

func (*Catalog) GetIndex

func (c *Catalog) GetIndex(tx *Transaction, indexName string) (*Index, error)

GetIndex returns an index by name.

func (*Catalog) GetIndexInfo

func (c *Catalog) GetIndexInfo(indexName string) (*IndexInfo, error)

GetIndexInfo returns an index info by name.

func (*Catalog) GetSequence

func (c *Catalog) GetSequence(name string) (*Sequence, error)

func (*Catalog) GetTable

func (c *Catalog) GetTable(tx *Transaction, tableName string) (*Table, error)

func (*Catalog) GetTableInfo

func (c *Catalog) GetTableInfo(tableName string) (*TableInfo, error)

GetTableInfo returns the table info for the given table name.

func (*Catalog) ListIndexes

func (c *Catalog) ListIndexes(tableName string) []string

ListIndexes returns all indexes for a given table name. If tableName is empty if returns a list of all indexes. The returned list of indexes is sorted lexicographically.

func (*Catalog) ListSequences

func (c *Catalog) ListSequences() []string

ListSequences returns all sequence names sorted lexicographically.

type CatalogLoader

type CatalogLoader interface {
	LoadCatalog(engine.Session) (*Catalog, error)
}

CatalogLoader loads the catalog from the disk. It may parse a SQL representation of the catalog and return a Catalog that represents all entities stored on disk.

type CatalogStore

type CatalogStore struct {
	// contains filtered or unexported fields
}

func (*CatalogStore) Delete

func (s *CatalogStore) Delete(tx *Transaction, name string) error

func (*CatalogStore) Info

func (s *CatalogStore) Info() *TableInfo

func (*CatalogStore) Insert

func (s *CatalogStore) Insert(tx *Transaction, r Relation) error

Insert a catalog object to the table.

func (*CatalogStore) Replace

func (s *CatalogStore) Replace(tx *Transaction, name string, r Relation) error

Replace a catalog object with another.

func (*CatalogStore) Table

func (s *CatalogStore) Table(tx *Transaction) *Table

type CatalogWriter

type CatalogWriter struct {
	*Catalog
}

A CatalogWriter is used to apply modifications to the catalog in a thread-safe manner. All the updates are only visible to the current transaction and don't require any lock. Upon commit, the transaction will apply the changes to the catalog.

func NewCatalogWriter

func NewCatalogWriter(c *Catalog) *CatalogWriter

func (*CatalogWriter) AddColumnConstraint added in v0.17.0

func (c *CatalogWriter) AddColumnConstraint(tx *Transaction, tableName string, cc *ColumnConstraint, tcs TableConstraints) error

AddColumnConstraint adds a field constraint to a table.

func (*CatalogWriter) CreateIndex

func (c *CatalogWriter) CreateIndex(tx *Transaction, info *IndexInfo) (*IndexInfo, error)

CreateIndex creates an index with the given name. If it already exists, returns errs.ErrIndexAlreadyExists.

func (*CatalogWriter) CreateSequence

func (c *CatalogWriter) CreateSequence(tx *Transaction, info *SequenceInfo) error

CreateSequence creates a sequence with the given name.

func (*CatalogWriter) CreateTable

func (c *CatalogWriter) CreateTable(tx *Transaction, tableName string, info *TableInfo) error

CreateTable creates a table with the given name. If it already exists, returns ErrTableAlreadyExists.

func (*CatalogWriter) DropIndex

func (c *CatalogWriter) DropIndex(tx *Transaction, name string) error

DropIndex deletes an index from the

func (*CatalogWriter) DropSequence

func (c *CatalogWriter) DropSequence(tx *Transaction, name string) error

DropSequence deletes a sequence from the catalog.

func (*CatalogWriter) DropTable

func (c *CatalogWriter) DropTable(tx *Transaction, tableName string) error

DropTable deletes a table from the catalog

func (*CatalogWriter) Init

func (c *CatalogWriter) Init(tx *Transaction) error

func (*CatalogWriter) RenameTable

func (c *CatalogWriter) RenameTable(tx *Transaction, oldName, newName string) error

RenameTable renames a table. If it doesn't exist, it returns errs.ErrTableNotFound.

type ColumnConstraint added in v0.17.0

type ColumnConstraint struct {
	Position     int
	Column       string
	Type         types.Type
	IsNotNull    bool
	DefaultValue TableExpression
}

ColumnConstraint describes constraints on a particular column.

func (*ColumnConstraint) IsEmpty added in v0.17.0

func (f *ColumnConstraint) IsEmpty() bool

func (*ColumnConstraint) String added in v0.17.0

func (f *ColumnConstraint) String() string

type ColumnConstraints added in v0.17.0

type ColumnConstraints struct {
	Ordered  []*ColumnConstraint
	ByColumn map[string]*ColumnConstraint
}

ColumnConstraints is a list of column constraints.

func MustNewColumnConstraints added in v0.17.0

func MustNewColumnConstraints(constraints ...*ColumnConstraint) ColumnConstraints

func NewColumnConstraints added in v0.17.0

func NewColumnConstraints(constraints ...*ColumnConstraint) (ColumnConstraints, error)

func (*ColumnConstraints) Add added in v0.17.0

func (f *ColumnConstraints) Add(newCc *ColumnConstraint) error

Add a column constraint to the list. If another constraint exists for the same path and they are equal, an error is returned.

func (ColumnConstraints) GetColumnConstraint added in v0.17.0

func (f ColumnConstraints) GetColumnConstraint(column string) *ColumnConstraint

type Connection added in v0.17.0

type Connection struct {
	// contains filtered or unexported fields
}

func (*Connection) BeginTx added in v0.17.0

func (c *Connection) BeginTx(opts *TxOptions) (*Transaction, error)

BeginTx starts a new transaction with the given options. If opts is empty, it will use the default options. The returned transaction must be closed either by calling Rollback or Commit.

func (*Connection) Close added in v0.17.0

func (c *Connection) Close() error

func (*Connection) GetTx added in v0.17.0

func (c *Connection) GetTx() *Transaction

GetAttachedTx returns the transaction attached to the connection, if any. The returned transaction is not thread safe.

func (*Connection) Reset added in v0.17.0

func (c *Connection) Reset() error

type ConstraintViolationError

type ConstraintViolationError struct {
	Constraint string
	Columns    []string
	Key        *tree.Key
}

func (ConstraintViolationError) Error

func (c ConstraintViolationError) Error() string

type Database

type Database struct {

	// Underlying kv store.
	Engine engine.Engine
	// contains filtered or unexported fields
}

func Open

func Open(path string, opts *Options) (*Database, error)

func (*Database) Begin

func (db *Database) Begin(writable bool) (*Transaction, error)

Begin starts a new transaction with default options. The returned transaction must be closed either by calling Rollback or Commit.

func (*Database) Catalog

func (db *Database) Catalog() *Catalog

func (*Database) Close

func (db *Database) Close() error

Close the database.

func (*Database) Connect added in v0.17.0

func (db *Database) Connect() (*Connection, error)

Connect returns a new connection to the database. The returned connection is not thread safe. It is the caller's responsibility to close the connection.

func (*Database) SetCatalog

func (db *Database) SetCatalog(c *Catalog)

type EncodedRow added in v0.17.0

type EncodedRow struct {
	// contains filtered or unexported fields
}

func NewEncodedRow added in v0.17.0

func NewEncodedRow(ccs *ColumnConstraints, data []byte) *EncodedRow

func RowIsEncoded added in v0.17.0

func RowIsEncoded(r row.Row, ccs *ColumnConstraints) (*EncodedRow, bool)

func (*EncodedRow) Get added in v0.17.0

func (e *EncodedRow) Get(column string) (v types.Value, err error)

Get decodes the selected column from the buffer.

func (*EncodedRow) Iterate added in v0.17.0

func (e *EncodedRow) Iterate(fn func(column string, value types.Value) error) error

Iterate decodes each columns one by one and passes them to fn until the end of the row or until fn returns an error.

func (*EncodedRow) ResetWith added in v0.17.0

func (e *EncodedRow) ResetWith(ccs *ColumnConstraints, data []byte)

type Index

type Index struct {
	// How many values the index is operating on.
	// For example, an index created with `CREATE INDEX idx_a_b ON foo (a, b)` has an arity of 2.
	Arity int
	Tree  *tree.Tree
}

An Index associates encoded values with keys.

The association is performed by encoding the values in a binary format that preserve ordering when compared lexicographically. For the implementation, see the binarysort package and the types.ValueEncoder.

func NewIndex

func NewIndex(tr *tree.Tree, opts IndexInfo) *Index

NewIndex creates an index that associates values with a list of keys.

func (*Index) Delete

func (idx *Index) Delete(vs []types.Value, key []byte) error

Delete all the references to the key from the index.

func (*Index) Exists

func (idx *Index) Exists(vs []types.Value) (bool, *tree.Key, error)

Exists iterates over the index and check if the value exists

func (*Index) Iterator added in v0.17.0

func (idx *Index) Iterator(rng *tree.Range) (*IndexIterator, error)

func (*Index) Set

func (idx *Index) Set(vs []types.Value, key []byte) error

Set associates values with a key. If Unique is set to false, it is possible to associate multiple keys for the same value but a key can be associated to only one value.

Values are stored in the index following the "index format". Every record is stored like this:

k: <encoded values><primary key>
v: length of the encoded value, as an unsigned varint

func (*Index) Truncate

func (idx *Index) Truncate() error

Truncate deletes all the index data.

type IndexInfo

type IndexInfo struct {
	// namespace of the store associated with the index.
	StoreNamespace tree.Namespace
	IndexName      string
	Columns        []string

	// Sort order of each indexed field.
	KeySortOrder tree.SortOrder

	// If set to true, values will be associated with at most one key. False by default.
	Unique bool

	// If set, this index has been created from a table constraint
	// i.e CREATE TABLE tbl(a INT UNIQUE)
	// The path refers to the path this index is related to.
	Owner Owner
}

IndexInfo holds the configuration of an index.

func (IndexInfo) Clone

func (i IndexInfo) Clone() *IndexInfo

Clone returns a copy of the index information.

func (*IndexInfo) String

func (idx *IndexInfo) String() string

String returns a SQL representation.

type IndexInfoRelation

type IndexInfoRelation struct {
	Info *IndexInfo
}

func (*IndexInfoRelation) Clone

func (r *IndexInfoRelation) Clone() Relation

func (*IndexInfoRelation) GenerateBaseName

func (r *IndexInfoRelation) GenerateBaseName() string

func (*IndexInfoRelation) Name

func (r *IndexInfoRelation) Name() string

func (*IndexInfoRelation) SetName

func (r *IndexInfoRelation) SetName(name string)

func (*IndexInfoRelation) Type

func (r *IndexInfoRelation) Type() string

type IndexIterator added in v0.17.0

type IndexIterator struct {
	*tree.Iterator
}

func (*IndexIterator) Value added in v0.17.0

func (it *IndexIterator) Value() (*tree.Key, error)

type Iterator added in v0.17.0

type Iterator interface {
	// Next moves the iterator to the next row.
	Next() bool

	// Row returns the current row.
	Row() (Row, error)

	// Close closes the iterator.
	Close() error

	// Error returns any error that occurred during iteration.
	Error() error
}

type LazyRow

type LazyRow struct {
	// contains filtered or unexported fields
}

LazyRow holds an LazyRow key and lazily loads the LazyRow on demand when the Iterate or Get method is called. It implements the Row and the row.Keyer interfaces.

func (*LazyRow) Get

func (r *LazyRow) Get(name string) (types.Value, error)

func (*LazyRow) Iterate

func (r *LazyRow) Iterate(fn func(name string, value types.Value) error) error

func (*LazyRow) Key

func (r *LazyRow) Key() *tree.Key

func (*LazyRow) ResetWith

func (r *LazyRow) ResetWith(table *Table, key *tree.Key)

func (*LazyRow) TableName

func (r *LazyRow) TableName() string

type OnConflictAction

type OnConflictAction int

OnConflictAction is a function triggered when trying to insert a row that already exists. This function is triggered if the key is duplicated or if there is a unique constraint violation on one of the columns of the row.

func (OnConflictAction) String

func (o OnConflictAction) String() string

type Options

type Options struct {
	CatalogLoader func(tx *Transaction) error
}

Options are passed to Open to control how the database is loaded.

type Owner

type Owner struct {
	TableName string
	Columns   []string
}

Owner is used to determine who owns a relation. If the relation has been created by a table (for rowids for example), only the TableName is filled. If it has been created by a field constraint (for identities for example), the path must also be filled.

type Pivot

type Pivot []types.Value

type PrimaryKey

type PrimaryKey struct {
	Columns   []string
	Types     []types.Type
	SortOrder tree.SortOrder
}

type Range

type Range struct {
	Min, Max  Pivot
	Exclusive bool
	Exact     bool
}

func (*Range) IsEqual

func (r *Range) IsEqual(other *Range) bool

func (*Range) ToTreeRange

func (r *Range) ToTreeRange(constraints *ColumnConstraints, columns []string) (*tree.Range, error)

type Relation

type Relation interface {
	Type() string
	Name() string
	SetName(name string)
	GenerateBaseName() string
	Clone() Relation
}

type Result added in v0.17.0

type Result interface {
	// Iterator returns an iterator over the rows in the result.
	Iterator() (Iterator, error)
}

type Row

type Row interface {
	// Iterate goes through all the columns of the row and calls the given function
	// by passing the column name
	Iterate(fn func(column string, value types.Value) error) error

	// Get returns the value of the given column.
	// If the column does not exist, it returns ErrColumnNotFound.
	Get(name string) (types.Value, error)

	// TableName returns the name of the table the row belongs to.
	TableName() string

	// Key returns the row key.
	Key() *tree.Key
}

type Sequence

type Sequence struct {
	Info *SequenceInfo

	CurrentValue *int64
	Cached       uint64
	Key          *tree.Key
}

A Sequence manages a sequence of numbers. It is not thread safe.

func NewSequence

func NewSequence(info *SequenceInfo, currentValue *int64) Sequence

NewSequence creates a new or existing sequence. If currentValue is not nil next call to Next will increase the lease.

func (*Sequence) Clone

func (s *Sequence) Clone() Relation

func (*Sequence) Drop

func (s *Sequence) Drop(tx *Transaction, catalog *Catalog) error

func (*Sequence) GenerateBaseName

func (s *Sequence) GenerateBaseName() string

func (*Sequence) GetOrCreateTable

func (s *Sequence) GetOrCreateTable(tx *Transaction) (*Table, error)

func (*Sequence) Init

func (s *Sequence) Init(tx *Transaction) error

func (*Sequence) Name

func (s *Sequence) Name() string

func (*Sequence) Next

func (s *Sequence) Next(tx *Transaction) (int64, error)

func (*Sequence) Release

func (s *Sequence) Release(tx *Transaction) error

Release the sequence by storing the actual current value to the sequence table. If the sequence has cache, the cached value is overwritten.

func (*Sequence) SetLease

func (s *Sequence) SetLease(tx *Transaction, name string, v int64) error

func (*Sequence) SetName

func (s *Sequence) SetName(name string)

func (*Sequence) Type

func (s *Sequence) Type() string

type SequenceInfo

type SequenceInfo struct {
	Name        string
	IncrementBy int64
	Min, Max    int64
	Start       int64
	Cache       uint64
	Cycle       bool
	Owner       Owner
}

SequenceInfo holds the configuration of a sequence.

func (SequenceInfo) Clone

func (s SequenceInfo) Clone() *SequenceInfo

Clone returns a copy of the sequence information.

func (*SequenceInfo) String

func (s *SequenceInfo) String() string

String returns a SQL representation.

type Table

type Table struct {
	Tx   *Transaction
	Tree *tree.Tree
	// Table information.
	// May not represent the most up to date data.
	// Always get a fresh Table instance before relying on this field.
	Info *TableInfo
}

A Table represents a collection of objects.

func (*Table) Delete

func (t *Table) Delete(key *tree.Key) error

Delete a object by key.

func (*Table) Exists added in v0.17.0

func (t *Table) Exists(key *tree.Key) (bool, error)

Exists checks if a row exists by key.

func (*Table) GenerateKey added in v0.17.0

func (t *Table) GenerateKey(r row.Row) (*tree.Key, bool, error)

GenerateKey generates a key for o based on the table configuration. if the table has a primary key, it extracts the field from the object, converts it to the targeted type and returns its encoded version. if there are no primary key in the table, a default key is generated, called the rowid. It returns a boolean indicating whether the key is a rowid or not.

func (*Table) GetRow

func (t *Table) GetRow(key *tree.Key) (Row, error)

GetRow returns one row by key.

func (*Table) Insert

func (t *Table) Insert(r row.Row) (*tree.Key, Row, error)

Insert the object into the table. If a primary key has been specified during the table creation, the field is expected to be present in the given row. If no primary key has been selected, a monotonic autoincremented integer key will be generated. It returns the inserted object alongside its key.

func (*Table) Iterator added in v0.17.0

func (t *Table) Iterator(rng *Range) (*TableIterator, error)

func (*Table) Put

func (t *Table) Put(key *tree.Key, r row.Row) (Row, error)

Put a row by key

func (*Table) Replace

func (t *Table) Replace(key *tree.Key, r row.Row) (Row, error)

Replace a row by key. An error is returned if the key doesn't exist.

func (*Table) Truncate

func (t *Table) Truncate() error

Truncate deletes all the objects from the table.

type TableConstraint

type TableConstraint struct {
	Name       string
	Columns    []string
	Check      TableExpression
	Unique     bool
	PrimaryKey bool
	SortOrder  tree.SortOrder
}

A TableConstraint represent a constraint specific to a table and not necessarily to a single field path.

func (*TableConstraint) String

func (t *TableConstraint) String() string

type TableConstraints

type TableConstraints []*TableConstraint

TableConstraints holds the list of CHECK constraints.

func (*TableConstraints) ValidateRow

func (t *TableConstraints) ValidateRow(tx *Transaction, r row.Row) error

ValidateRow checks all the table constraint for the given row.

type TableExpression

type TableExpression interface {
	Eval(tx *Transaction, o row.Row) (types.Value, error)
	Validate(info *TableInfo) error
	String() string
}

type TableInfo

type TableInfo struct {
	// name of the table.
	TableName string
	// namespace of the store associated with the table.
	StoreNamespace tree.Namespace
	ReadOnly       bool

	// Name of the rowid sequence if any.
	RowidSequenceName string

	ColumnConstraints ColumnConstraints
	TableConstraints  TableConstraints

	PrimaryKey *PrimaryKey
}

TableInfo contains information about a table.

func (*TableInfo) AddColumnConstraint added in v0.17.0

func (ti *TableInfo) AddColumnConstraint(newCc *ColumnConstraint) error

func (*TableInfo) AddTableConstraint

func (ti *TableInfo) AddTableConstraint(newTc *TableConstraint) error

func (*TableInfo) BuildPrimaryKey

func (ti *TableInfo) BuildPrimaryKey()

func (*TableInfo) Clone

func (ti *TableInfo) Clone() *TableInfo

Clone creates another tableInfo with the same values.

func (*TableInfo) EncodeKey

func (ti *TableInfo) EncodeKey(key *tree.Key) ([]byte, error)

func (*TableInfo) EncodeRow added in v0.17.0

func (t *TableInfo) EncodeRow(tx *Transaction, dst []byte, r row.Row) ([]byte, error)

EncodeRow validates a row against all the constraints of the table and encodes it.

func (*TableInfo) GetColumnConstraint added in v0.17.0

func (ti *TableInfo) GetColumnConstraint(column string) *ColumnConstraint

func (*TableInfo) PrimaryKeySortOrder

func (ti *TableInfo) PrimaryKeySortOrder() tree.SortOrder

func (*TableInfo) String

func (ti *TableInfo) String() string

String returns a SQL representation.

func (*TableInfo) Validate added in v0.17.0

func (ti *TableInfo) Validate() error

Validate ensures the constraints are valid.

type TableInfoRelation

type TableInfoRelation struct {
	Info *TableInfo
}

func (*TableInfoRelation) Clone

func (r *TableInfoRelation) Clone() Relation

func (*TableInfoRelation) GenerateBaseName

func (r *TableInfoRelation) GenerateBaseName() string

func (*TableInfoRelation) Name

func (r *TableInfoRelation) Name() string

func (*TableInfoRelation) SetName

func (r *TableInfoRelation) SetName(name string)

func (*TableInfoRelation) Type

func (r *TableInfoRelation) Type() string

type TableIterator added in v0.17.0

type TableIterator struct {
	*tree.Iterator
	// contains filtered or unexported fields
}

func (*TableIterator) Value added in v0.17.0

func (it *TableIterator) Value() (Row, error)

type Transaction

type Transaction struct {

	// Timestamp at which the transaction was created.
	// The timestamp must use the local timezone.
	TxStart time.Time

	Session   engine.Session
	Engine    engine.Engine
	ID        uint64
	Writable  bool
	WriteTxMu *sync.Mutex
	// these functions are run after a successful rollback.
	OnRollbackHooks []func()
	// these functions are run after a successful commit.
	OnCommitHooks []func()

	Catalog *Catalog
	// contains filtered or unexported fields
}

Transaction represents a database transaction. It provides methods for managing the collection of tables and the transaction itself. Transaction is either read-only or read/write. Read-only can be used to read tables and read/write can be used to read, create, delete and modify tables.

func (*Transaction) CatalogWriter

func (tx *Transaction) CatalogWriter() *CatalogWriter

func (*Transaction) Commit

func (tx *Transaction) Commit() error

Commit the transaction. Calling this method on read-only transactions will return an error.

func (*Transaction) Connection added in v0.17.0

func (tx *Transaction) Connection() *Connection

func (*Transaction) Rollback

func (tx *Transaction) Rollback() error

Rollback the transaction. Can be used safely after commit.

type TxOptions

type TxOptions struct {
	// Open a read-only transaction.
	ReadOnly bool
}

TxOptions are passed to Begin to configure transactions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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