mysql

package
v0.51.5 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const TableColumnMaxSize = 2e4 // 20kb

TableColumnMaxSize is the maximum size of the data field, if larger than this size, data will be stored in a block referenced by "data_ref".

Variables

View Source
var (
	// ErrEmptyDatabaseName is returned if an empty string is found where a db name is expected.
	ErrEmptyDatabaseName = errors.New("empty database name is invalid")
	// ErrDatabaseExists is returned if the database already exists.
	ErrDatabaseExists = errors.New("database already exists")
	// ErrDatabaseNotFound is returned if the database does not exist.
	ErrDatabaseNotFound = sql.ErrDatabaseNotFound
	// ErrEmptyTableName is returned if an empty string is found where a table name is expected.
	ErrEmptyTableName = errors.New("empty table name is invalid")
	// ErrEmptyTable is returned if an empty table is found where at least one column is expected.
	ErrEmptyTable = errors.New("empty table with no columns is invalid")
	// ErrEmptyTableColumn is returned if an empty table column is found where one is expected.
	ErrEmptyTableColumn = errors.New("empty table column schema is invalid")
	// ErrEmptyTableColumnName is returned if an empty table column name is found where one is expected.
	ErrEmptyTableColumnName = errors.New("empty table column name is invalid")
	// ErrUnexpectedType is returned if a type assertion failed.
	ErrUnexpectedType = errors.New("sql db unexpected object type")
)
View Source
var TableRowKeyEndian = binary.BigEndian

TableRowKeyEndian is the endian-ness to use for table keys. Note: this is selected to make keys sort in the correct order.

Functions

func BuildTable

func BuildTable(
	ctx context.Context,
	bcs *block.Cursor,
	name string,
	schema sql.PrimaryKeySchema,
	numPartitions int,
	collationID sql.CollationID,
	comment string,
) (*TableRoot, *Table, error)

BuildTable constructs a new table, storing it in the block cursor (if set).

if bcs is nil, the returned *Table will also be nil.

func GetDbContext

func GetDbContext(ctx *sql.Context) context.Context

GetDbContext gets the sql context or returns background.

func MarshalTableRowKey

func MarshalTableRowKey(nonce uint64) []byte

MarshalTableRowKey marshals the key for a table row.

func NewDatabaseRootBlock

func NewDatabaseRootBlock() block.Block

NewDatabaseRootBlock constructs a new db root block.

func NewMysqlGorm

func NewMysqlGorm(ctx context.Context, le *logrus.Entry, tx *Tx, conf *gorm.Config, dsn string) (*gorm.DB, *sql.DB, error)

NewMysqlGorm constructs a go-orm instance from a Mysql transaction. dsn allows specifying the database name and/or other parameters.

func NewRootBlock

func NewRootBlock() block.Block

NewRootBlock constructs a new root block.

func NewSqlConnector

func NewSqlConnector(ctx context.Context, tx *Tx, dsn string) (driver.Connector, error)

NewSqlConnector constructs a new sql conn from a transaction. NOTE: dsn is used to specify arguments and is NOT the db name. ctx is used for the driver Resolve() function.

func NewSqlDb

func NewSqlDb(ctx context.Context, tx *Tx, dsn string) (*sql.DB, error)

NewSqlDb opens the sql database driver. NOTE: dsn is used to specify arguments and is NOT the db name. ctx is used for the provider Resolve function.

func NewSqlDriver

func NewSqlDriver(ctx context.Context, tx *Tx, driverOpts *gdriver.Options) *gdriver.Driver

NewSqlDriver constructs a sql driver from a transaction.

ctx is used for the driver Resolve() function.

func NewTableRootBlock

func NewTableRootBlock() block.Block

NewTableRootBlock constructs a new db root block.

func NewTableRowBlock

func NewTableRowBlock() block.Block

NewTableRowBlock constructs a new db root block.

func ParseColumnType

func ParseColumnType(typeStr string) (*sqlparser.ColumnType, error)

ParseColumnType parses a column type string to a sqlparser.ColumnType.

func UnmarshalTableRowKey

func UnmarshalTableRowKey(dat []byte) (uint64, error)

UnmarshalTableRowKey unmarshals the nonce for a table row.

Types

type CommitFn

type CommitFn func(nref *bucket.ObjectRef) error

CommitFn is a function to call with the updated root before confirming it. Should be used to write the updated state back to storage. Note: engine rmtx is locked while cb is called, do not block or call engine funcs! If an error is returned the change will be rolled back. Do not change the nrootBcs during this call.

type Database

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

Database is the block-graph backed SQL db cursor. NOTE: calls are not concurrency-safe.

func NewDatabase

func NewDatabase(ctx context.Context, name string, readOnly bool, bcs *block.Cursor) (*Database, error)

NewDatabase constructs a new database handle.

func (*Database) CreateTable

func (d *Database) CreateTable(ctx *sql.Context, name string, schema sql.PrimaryKeySchema, collation sql.CollationID, comment string) error

Creates the table with the given name and schema. If a table with that name already exists, must return sql.ErrTableAlreadyExists.

func (*Database) DropTable

func (d *Database) DropTable(ctx *sql.Context, name string) error

DropTable deletes a table, if it exists.

func (*Database) GetTableInsensitive

func (d *Database) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error)

GetTableInsensitive retrieves a table by its case insensitive name. Implementations should look for exact (case-sensitive matches) first. If no exact matches are found then any table matching the name case insensitively should be returned. If there is more than one table that matches a case insensitive comparison the resolution strategy is not defined.

func (*Database) GetTableNames

func (d *Database) GetTableNames(ctx *sql.Context) ([]string, error)

GetTableNames returns the table names of every table in the database

func (*Database) IsReadOnly

func (d *Database) IsReadOnly() bool

IsReadOnly returns whether this database is read-only.

func (*Database) MarkDirty added in v0.51.0

func (d *Database) MarkDirty()

MarkDirty marks the database root dirty for the next transaction write.

func (*Database) Name

func (d *Database) Name() string

Name returns the name.

func (*Database) RenameTable

func (d *Database) RenameTable(ctx *sql.Context, oldName, newName string) error

Renames a table from oldName to newName as given. If a table with newName already exists, must return sql.ErrTableAlreadyExists.

func (*Database) TableCount

func (d *Database) TableCount() int

TableCount returns the count of tables in the database.

type DatabaseRoot

type DatabaseRoot struct {

	// Tables contains the table list sorted by name.
	Tables []*DatabaseRootTable `protobuf:"bytes,1,rep,name=tables,proto3" json:"tables,omitempty"`
	// contains filtered or unexported fields
}

DatabaseRoot is the root object of the database.

func LoadDatabaseRoot

func LoadDatabaseRoot(ctx context.Context, cursor *block.Cursor) (*DatabaseRoot, error)

LoadDatabaseRoot follows the database root cursor. may return nil

func (*DatabaseRoot) ApplySubBlock

func (r *DatabaseRoot) ApplySubBlock(id uint32, next block.SubBlock) error

ApplySubBlock applies a sub-block change with a field id.

func (*DatabaseRoot) CloneMessageVT

func (m *DatabaseRoot) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*DatabaseRoot) CloneVT

func (m *DatabaseRoot) CloneVT() *DatabaseRoot

func (*DatabaseRoot) EqualMessageVT

func (this *DatabaseRoot) EqualMessageVT(thatMsg any) bool

func (*DatabaseRoot) EqualVT

func (this *DatabaseRoot) EqualVT(that *DatabaseRoot) bool

func (*DatabaseRoot) GetRootTableSet

func (r *DatabaseRoot) GetRootTableSet(bcs *block.Cursor) *namedsbset.NamedSubBlockSet

GetRootTableSet returns the root table set sub-block.

bcs is optional

func (*DatabaseRoot) GetSubBlockCtor

func (r *DatabaseRoot) GetSubBlockCtor(id uint32) block.SubBlockCtor

GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.

func (*DatabaseRoot) GetSubBlocks

func (r *DatabaseRoot) GetSubBlocks() map[uint32]block.SubBlock

GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.

func (*DatabaseRoot) GetTables

func (x *DatabaseRoot) GetTables() []*DatabaseRootTable

func (*DatabaseRoot) InsertTable

func (r *DatabaseRoot) InsertTable(name string, ref *block.BlockRef, bcs *block.Cursor) (*block.Cursor, bool)

InsertTable inserts a new table. Caller should check if it doesn't exist before calling.

Returns new cursor, added. bcs can be nil, or should be located at root.

func (*DatabaseRoot) IsNil

func (r *DatabaseRoot) IsNil() bool

IsNil returns if the object is nil.

func (*DatabaseRoot) MarshalBlock

func (r *DatabaseRoot) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*DatabaseRoot) MarshalJSON

func (x *DatabaseRoot) MarshalJSON() ([]byte, error)

MarshalJSON marshals the DatabaseRoot to JSON.

func (*DatabaseRoot) MarshalProtoJSON

func (x *DatabaseRoot) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the DatabaseRoot message to JSON.

func (*DatabaseRoot) MarshalProtoText

func (x *DatabaseRoot) MarshalProtoText() string

func (*DatabaseRoot) MarshalToSizedBufferVT

func (m *DatabaseRoot) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DatabaseRoot) MarshalToVT

func (m *DatabaseRoot) MarshalToVT(dAtA []byte) (int, error)

func (*DatabaseRoot) MarshalVT

func (m *DatabaseRoot) MarshalVT() (dAtA []byte, err error)

func (*DatabaseRoot) ProtoMessage

func (*DatabaseRoot) ProtoMessage()

func (*DatabaseRoot) Reset

func (x *DatabaseRoot) Reset()

func (*DatabaseRoot) SizeVT

func (m *DatabaseRoot) SizeVT() (n int)

func (*DatabaseRoot) String

func (x *DatabaseRoot) String() string

func (*DatabaseRoot) UnmarshalBlock

func (r *DatabaseRoot) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*DatabaseRoot) UnmarshalJSON

func (x *DatabaseRoot) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the DatabaseRoot from JSON.

func (*DatabaseRoot) UnmarshalProtoJSON

func (x *DatabaseRoot) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the DatabaseRoot message from JSON.

func (*DatabaseRoot) UnmarshalVT

func (m *DatabaseRoot) UnmarshalVT(dAtA []byte) error

func (*DatabaseRoot) Validate

func (r *DatabaseRoot) Validate() error

Validate validates the database root block.

type DatabaseRootTable

type DatabaseRootTable struct {

	// Name is the unique name of the table.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Ref is the block reference to the table root.
	// Type: TableRoot.
	Ref *block.BlockRef `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"`
	// contains filtered or unexported fields
}

DatabaseRootTable contains the reference to the TableRoot.

func (*DatabaseRootTable) ApplyBlockRef

func (r *DatabaseRootTable) ApplyBlockRef(id uint32, ptr *block.BlockRef) error

ApplyBlockRef applies a ref change with a field id. The reference may be nil if the child block is nil.

func (*DatabaseRootTable) CloneMessageVT

func (m *DatabaseRootTable) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*DatabaseRootTable) CloneVT

func (m *DatabaseRootTable) CloneVT() *DatabaseRootTable

func (*DatabaseRootTable) EqualMessageVT

func (this *DatabaseRootTable) EqualMessageVT(thatMsg any) bool

func (*DatabaseRootTable) EqualVT

func (this *DatabaseRootTable) EqualVT(that *DatabaseRootTable) bool

func (*DatabaseRootTable) GetBlockRefCtor

func (r *DatabaseRootTable) GetBlockRefCtor(id uint32) block.Ctor

GetBlockRefCtor returns the constructor for the block at the ref id. Return nil to indicate invalid ref ID or unknown.

func (*DatabaseRootTable) GetBlockRefs

func (r *DatabaseRootTable) GetBlockRefs() (map[uint32]*block.BlockRef, error)

GetBlockRefs returns all block references by ID. May return nil, and values may also be nil. Note: this does not include pending references (in a cursor)

func (*DatabaseRootTable) GetName

func (x *DatabaseRootTable) GetName() string

func (*DatabaseRootTable) GetRef

func (x *DatabaseRootTable) GetRef() *block.BlockRef

func (*DatabaseRootTable) IsNil

func (r *DatabaseRootTable) IsNil() bool

IsNil returns if the object is nil.

func (*DatabaseRootTable) MarshalJSON

func (x *DatabaseRootTable) MarshalJSON() ([]byte, error)

MarshalJSON marshals the DatabaseRootTable to JSON.

func (*DatabaseRootTable) MarshalProtoJSON

func (x *DatabaseRootTable) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the DatabaseRootTable message to JSON.

func (*DatabaseRootTable) MarshalProtoText

func (x *DatabaseRootTable) MarshalProtoText() string

func (*DatabaseRootTable) MarshalToSizedBufferVT

func (m *DatabaseRootTable) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DatabaseRootTable) MarshalToVT

func (m *DatabaseRootTable) MarshalToVT(dAtA []byte) (int, error)

func (*DatabaseRootTable) MarshalVT

func (m *DatabaseRootTable) MarshalVT() (dAtA []byte, err error)

func (*DatabaseRootTable) ProtoMessage

func (*DatabaseRootTable) ProtoMessage()

func (*DatabaseRootTable) Reset

func (x *DatabaseRootTable) Reset()

func (*DatabaseRootTable) SizeVT

func (m *DatabaseRootTable) SizeVT() (n int)

func (*DatabaseRootTable) String

func (x *DatabaseRootTable) String() string

func (*DatabaseRootTable) UnmarshalJSON

func (x *DatabaseRootTable) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the DatabaseRootTable from JSON.

func (*DatabaseRootTable) UnmarshalProtoJSON

func (x *DatabaseRootTable) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the DatabaseRootTable message from JSON.

func (*DatabaseRootTable) UnmarshalVT

func (m *DatabaseRootTable) UnmarshalVT(dAtA []byte) error

func (*DatabaseRootTable) Validate

func (r *DatabaseRootTable) Validate() error

Validate performs cursory validation.

type DriverProvider

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

DriverProvider implements the Provider interface for the sql driver.

func NewDriverProvider

func NewDriverProvider(ctx context.Context, sqlTx *Tx) *DriverProvider

NewDriverProvider constructs a driver provider.

ctx is used for the Resolve() function.

func (*DriverProvider) NewContext

func (p *DriverProvider) NewContext(
	ctx context.Context,
	conn *gdriver.Conn,
	opts ...sql.ContextOption,
) (*sql.Context, error)

NewContext constructs the SQL context for the conn.

func (*DriverProvider) NewSession

func (p *DriverProvider) NewSession(
	ctx context.Context,
	id uint32,
	conn *gdriver.Connector,
) (sql.Session, error)

NewSession builds a session for the connection.

func (*DriverProvider) Resolve

func (p *DriverProvider) Resolve(name string, options *gdriver.Options) (string, sql.DatabaseProvider, error)

Resolve is called in OpenConnector to lookup the database with the given name.

type Mysql

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

Mysql is the root of a mysql server data structure, containing named databases.

func NewMysql

func NewMysql(rootCursor RootCursor, commitFn CommitFn) *Mysql

NewMysql creates a handle with an optional root object cursor pointing to the tree. The cursor ref can be empty to indicate a new tree.

func (*Mysql) GetRootNodeRef

func (t *Mysql) GetRootNodeRef() *bucket.ObjectRef

GetRootNodeRef returns the reference to the root node.

func (*Mysql) NewMysqlTransaction

func (t *Mysql) NewMysqlTransaction(ctx context.Context, write bool) (*Tx, error)

NewMysqlTransaction returns a transaction against the db.

func (*Mysql) NewSqlTransaction

func (t *Mysql) NewSqlTransaction(ctx context.Context, write bool, dsn string) (sql.SqlTransaction, error)

NewTransaction returns a new SqlDB transaction.

type Root

type Root struct {

	// Databases contains the root set of databases, sorted by name.
	Databases []*RootDb `protobuf:"bytes,1,rep,name=databases,proto3" json:"databases,omitempty"`
	// contains filtered or unexported fields
}

Root is the root object of the mysql database.

func LoadRoot

func LoadRoot(ctx context.Context, cursor *block.Cursor) (*Root, error)

LoadRoot follows the root cursor. may return nil

func (*Root) ApplySubBlock

func (n *Root) ApplySubBlock(id uint32, next block.SubBlock) error

ApplySubBlock applies a sub-block change with a field id.

func (*Root) CloneMessageVT

func (m *Root) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Root) CloneVT

func (m *Root) CloneVT() *Root

func (*Root) EqualMessageVT

func (this *Root) EqualMessageVT(thatMsg any) bool

func (*Root) EqualVT

func (this *Root) EqualVT(that *Root) bool

func (*Root) GetDatabases

func (x *Root) GetDatabases() []*RootDb

func (*Root) GetRootDbSet

func (n *Root) GetRootDbSet(bcs *block.Cursor) *namedsbset.NamedSubBlockSet

GetRootDbSet returns the root db set sub-block.

bcs is optional

func (*Root) GetSubBlockCtor

func (n *Root) GetSubBlockCtor(id uint32) block.SubBlockCtor

GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.

func (*Root) GetSubBlocks

func (n *Root) GetSubBlocks() map[uint32]block.SubBlock

GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.

func (*Root) InsertDatabase

func (n *Root) InsertDatabase(name string, ref *block.BlockRef, bcs *block.Cursor) (*RootDb, *block.Cursor)

InsertDatabase inserts a new database. Caller should check if it doesn't exist before calling.

Returns new cursor located at *RootDb, added. bcs can be nil, or should be located at root of db.

func (*Root) MarshalBlock

func (n *Root) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*Root) MarshalJSON

func (x *Root) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Root to JSON.

func (*Root) MarshalProtoJSON

func (x *Root) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Root message to JSON.

func (*Root) MarshalProtoText

func (x *Root) MarshalProtoText() string

func (*Root) MarshalToSizedBufferVT

func (m *Root) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Root) MarshalToVT

func (m *Root) MarshalToVT(dAtA []byte) (int, error)

func (*Root) MarshalVT

func (m *Root) MarshalVT() (dAtA []byte, err error)

func (*Root) ProtoMessage

func (*Root) ProtoMessage()

func (*Root) Reset

func (x *Root) Reset()

func (*Root) SizeVT

func (m *Root) SizeVT() (n int)

func (*Root) String

func (x *Root) String() string

func (*Root) UnmarshalBlock

func (n *Root) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*Root) UnmarshalJSON

func (x *Root) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Root from JSON.

func (*Root) UnmarshalProtoJSON

func (x *Root) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Root message from JSON.

func (*Root) UnmarshalVT

func (m *Root) UnmarshalVT(dAtA []byte) error

func (*Root) Validate

func (n *Root) Validate() error

Validate validates the root block.

type RootCursor added in v0.51.0

type RootCursor interface {
	BuildTransaction(*block.PutOpts) (*block.Transaction, *block.Cursor)
	GetRef() *bucket.ObjectRef
	SetRootRef(*block.BlockRef)
}

RootCursor is the minimal cursor surface Mysql needs to read and update the root object reference.

type RootDb

type RootDb struct {

	// Name is the unique name of the database.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Ref is the block reference to the database root.
	// If empty, the database is empty.
	// Type: DatabaseRoot.
	Ref *block.BlockRef `protobuf:"bytes,2,opt,name=ref,proto3" json:"ref,omitempty"`
	// contains filtered or unexported fields
}

RootDb contains the root definition of a database.

func (*RootDb) ApplyBlockRef

func (r *RootDb) ApplyBlockRef(id uint32, ptr *block.BlockRef) error

ApplyBlockRef applies a ref change with a field id. The reference may be nil if the child block is nil.

func (*RootDb) CloneMessageVT

func (m *RootDb) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*RootDb) CloneVT

func (m *RootDb) CloneVT() *RootDb

func (*RootDb) EqualMessageVT

func (this *RootDb) EqualMessageVT(thatMsg any) bool

func (*RootDb) EqualVT

func (this *RootDb) EqualVT(that *RootDb) bool

func (*RootDb) GetBlockRefCtor

func (r *RootDb) GetBlockRefCtor(id uint32) block.Ctor

GetBlockRefCtor returns the constructor for the block at the ref id. Return nil to indicate invalid ref ID or unknown.

func (*RootDb) GetBlockRefs

func (r *RootDb) GetBlockRefs() (map[uint32]*block.BlockRef, error)

GetBlockRefs returns all block references by ID. May return nil, and values may also be nil. Note: this does not include pending references (in a cursor)

func (*RootDb) GetName

func (x *RootDb) GetName() string

func (*RootDb) GetRef

func (x *RootDb) GetRef() *block.BlockRef

func (*RootDb) IsNil

func (r *RootDb) IsNil() bool

IsNil returns if the object is nil.

func (*RootDb) MarshalJSON

func (x *RootDb) MarshalJSON() ([]byte, error)

MarshalJSON marshals the RootDb to JSON.

func (*RootDb) MarshalProtoJSON

func (x *RootDb) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the RootDb message to JSON.

func (*RootDb) MarshalProtoText

func (x *RootDb) MarshalProtoText() string

func (*RootDb) MarshalToSizedBufferVT

func (m *RootDb) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*RootDb) MarshalToVT

func (m *RootDb) MarshalToVT(dAtA []byte) (int, error)

func (*RootDb) MarshalVT

func (m *RootDb) MarshalVT() (dAtA []byte, err error)

func (*RootDb) ProtoMessage

func (*RootDb) ProtoMessage()

func (*RootDb) Reset

func (x *RootDb) Reset()

func (*RootDb) SizeVT

func (m *RootDb) SizeVT() (n int)

func (*RootDb) String

func (x *RootDb) String() string

func (*RootDb) UnmarshalJSON

func (x *RootDb) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the RootDb from JSON.

func (*RootDb) UnmarshalProtoJSON

func (x *RootDb) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the RootDb message from JSON.

func (*RootDb) UnmarshalVT

func (m *RootDb) UnmarshalVT(dAtA []byte) error

func (*RootDb) Validate

func (r *RootDb) Validate() error

Validate performs cursory checks on the RootDb.

type SqlConn

type SqlConn interface {
	driver.Conn
	hydra_sql.SqlOps
}

SqlConn is the set of interfaces the mysql driver conn implements.

func NewSqlConn

func NewSqlConn(ctx context.Context, tx *Tx, dsn string) (SqlConn, error)

NewSqlConn creates a sql conn from a transaction and dsn. NOTE: dsn is used to specify arguments and is NOT the db name.

type SqlTx

type SqlTx struct {
	*Tx
	// contains filtered or unexported fields
}

SqlTx implements sql.Transaction with a *Tx.

func NewSqlTx

func NewSqlTx(ctx context.Context, tx *Tx, dsn string) (*SqlTx, error)

NewSqlTx constructs a new SqlTx.

func (*SqlTx) GetReadOnly

func (r *SqlTx) GetReadOnly() bool

GetReadOnly returns if the transaction is read-only.

func (*SqlTx) GetSqlOps

func (r *SqlTx) GetSqlOps(ctx context.Context) (hydra_sql.SqlOps, error)

GetSqlOps returns the sql operations interface.

type Table

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

Table is the block-graph backed data table cursor. NOTE: calls are not concurrency-safe.

func LoadTable

func LoadTable(ctx context.Context, name string, bcs *block.Cursor) (*Table, error)

LoadTable constructs a new table handle, loading the root block.

func (*Table) AutoIncrementSetter

func (t *Table) AutoIncrementSetter(sqlCtx *sql.Context) sql.AutoIncrementSetter

AutoIncrementSetter returns an AutoIncrementSetter.

func (*Table) Collation

func (t *Table) Collation() sql.CollationID

Collation returns the collation type ID.

func (*Table) GetNextAutoIncrementValue

func (t *Table) GetNextAutoIncrementValue(sqlCtx *sql.Context, insertVal any) (uint64, error)

GetNextAutoIncrementValue gets the next AUTO_INCREMENT value. In the case that a table with an autoincrement column is passed in a row with the autoinc column failed, the next auto increment value must update its internal state accordingly and use the insert val at runtime. Implementations are responsible for updating their state to provide the correct values.

func (*Table) Inserter

func (t *Table) Inserter(sqlCtx *sql.Context) sql.RowInserter

Inserter returns a row inserter for the table.

func (*Table) Name

func (t *Table) Name() string

Name returns the name.

func (*Table) NewTableEditor

func (t *Table) NewTableEditor(sqlCtx *sql.Context) *TableEditor

NewTableEditor constructs a new table editor.

func (*Table) PartitionAtIndex

func (t *Table) PartitionAtIndex(ix int) (*TablePartition, error)

PartitionAtIndex returns the partition at an index.

Returns io.EOF if out of range.

func (*Table) PartitionCount

func (t *Table) PartitionCount(*sql.Context) (int64, error)

PartitionCount returns the number of partitions.

func (*Table) PartitionRows

func (t *Table) PartitionRows(ctx *sql.Context, part sql.Partition) (sql.RowIter, error)

PartitionRows returns a table iterator for the rows in a partition.

func (*Table) Partitions

func (t *Table) Partitions(ctx *sql.Context) (sql.PartitionIter, error)

Partitions returns an iterator for the table partitions.

func (*Table) PeekNextAutoIncrementValue

func (t *Table) PeekNextAutoIncrementValue(*sql.Context) (uint64, error)

PeekNextAutoIncrementValue peeks at the next AUTO_INCREMENT value

func (*Table) PrimaryKeySchema

func (t *Table) PrimaryKeySchema(*sql.Context) sql.PrimaryKeySchema

PrimaryKeySchema returns this table's PrimaryKeySchema

func (*Table) Schema

func (t *Table) Schema(*sql.Context) sql.Schema

Schema returns the table's SQL schema.

func (*Table) SelectPartition

func (t *Table) SelectPartition(nonce uint64) (*TablePartition, int, error)

SelectPartition selects the partition based on the index (round-robin).

func (*Table) SetIndexLookup

func (t *Table) SetIndexLookup(lookup *sql.IndexLookup)

SetIndexLookup sets the index lookup.

func (*Table) String

func (t *Table) String() string

String returns the table in string form.

type TableColumn

type TableColumn struct {

	// Value contains the SQL value. If no field is set, the column is NULL.
	//
	// Types that are assignable to Value:
	//
	//	*TableColumn_BoolValue
	//	*TableColumn_IntValue
	//	*TableColumn_UintValue
	//	*TableColumn_FloatValue
	//	*TableColumn_StringBlob
	//	*TableColumn_BytesBlob
	//	*TableColumn_JsonBlob
	//	*TableColumn_TimestampValue
	//	*TableColumn_TimespanMicros
	Value isTableColumn_Value `protobuf_oneof:"value"`
	// contains filtered or unexported fields
}

TableColumn is an entry in a table row.

func BuildTableColumn

func BuildTableColumn(
	ctx context.Context,
	bcs *block.Cursor,
	opts *blob.BuildBlobOpts,
	col any,
) (*TableColumn, error)

BuildTableColumn constructs a TableColumn by marshaling a col.

bcs must be set.

func (*TableColumn) ApplySubBlock

func (t *TableColumn) ApplySubBlock(id uint32, next block.SubBlock) error

ApplySubBlock applies a sub-block change with a field id.

func (*TableColumn) CloneMessageVT

func (m *TableColumn) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*TableColumn) CloneVT

func (m *TableColumn) CloneVT() *TableColumn

func (*TableColumn) EqualMessageVT

func (this *TableColumn) EqualMessageVT(thatMsg any) bool

func (*TableColumn) EqualVT

func (this *TableColumn) EqualVT(that *TableColumn) bool

func (*TableColumn) FetchSqlColumn

func (t *TableColumn) FetchSqlColumn(ctx context.Context, bcs *block.Cursor) (any, error)

FetchSqlColumn converts the row back into a sql column.

func (*TableColumn) GetBoolValue

func (x *TableColumn) GetBoolValue() bool

func (*TableColumn) GetBytesBlob

func (x *TableColumn) GetBytesBlob() *blob.Blob

func (*TableColumn) GetFloatValue

func (x *TableColumn) GetFloatValue() float64

func (*TableColumn) GetIntValue

func (x *TableColumn) GetIntValue() int64

func (*TableColumn) GetJsonBlob

func (x *TableColumn) GetJsonBlob() *blob.Blob

func (*TableColumn) GetStringBlob

func (x *TableColumn) GetStringBlob() *blob.Blob

func (*TableColumn) GetSubBlockCtor

func (t *TableColumn) GetSubBlockCtor(id uint32) block.SubBlockCtor

GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.

func (*TableColumn) GetSubBlocks

func (t *TableColumn) GetSubBlocks() map[uint32]block.SubBlock

GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.

func (*TableColumn) GetTimespanMicros

func (x *TableColumn) GetTimespanMicros() int64

func (*TableColumn) GetTimestampValue

func (x *TableColumn) GetTimestampValue() *TableTimestamp

func (*TableColumn) GetUintValue

func (x *TableColumn) GetUintValue() uint64

func (*TableColumn) GetValue

func (m *TableColumn) GetValue() isTableColumn_Value

func (*TableColumn) IsEmpty

func (t *TableColumn) IsEmpty() bool

IsEmpty checks if the table column is empty.

func (*TableColumn) IsNil

func (t *TableColumn) IsNil() bool

IsNil returns if the object is nil.

func (*TableColumn) MarshalBlock

func (t *TableColumn) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*TableColumn) MarshalJSON

func (x *TableColumn) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TableColumn to JSON.

func (*TableColumn) MarshalProtoJSON

func (x *TableColumn) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TableColumn message to JSON.

func (*TableColumn) MarshalProtoText

func (x *TableColumn) MarshalProtoText() string

func (*TableColumn) MarshalToSizedBufferVT

func (m *TableColumn) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn) MarshalToVT

func (m *TableColumn) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn) MarshalVT

func (m *TableColumn) MarshalVT() (dAtA []byte, err error)

func (*TableColumn) ProtoMessage

func (*TableColumn) ProtoMessage()

func (*TableColumn) Reset

func (x *TableColumn) Reset()

func (*TableColumn) SizeVT

func (m *TableColumn) SizeVT() (n int)

func (*TableColumn) String

func (x *TableColumn) String() string

func (*TableColumn) UnmarshalBlock

func (t *TableColumn) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*TableColumn) UnmarshalJSON

func (x *TableColumn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TableColumn from JSON.

func (*TableColumn) UnmarshalProtoJSON

func (x *TableColumn) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TableColumn message from JSON.

func (*TableColumn) UnmarshalVT

func (m *TableColumn) UnmarshalVT(dAtA []byte) error

func (*TableColumn) Validate

func (t *TableColumn) Validate() error

Validate performs cursory validation of the table column.

type TableColumn_BoolValue

type TableColumn_BoolValue struct {
	// BoolValue is a boolean SQL value.
	BoolValue bool `protobuf:"varint,2,opt,name=bool_value,json=boolValue,proto3,oneof"`
}

func (*TableColumn_BoolValue) CloneOneofVT

func (m *TableColumn_BoolValue) CloneOneofVT() isTableColumn_Value

func (*TableColumn_BoolValue) CloneVT

func (*TableColumn_BoolValue) EqualVT

func (this *TableColumn_BoolValue) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_BoolValue) MarshalToSizedBufferVT

func (m *TableColumn_BoolValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_BoolValue) MarshalToVT

func (m *TableColumn_BoolValue) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_BoolValue) SizeVT

func (m *TableColumn_BoolValue) SizeVT() (n int)

type TableColumn_BytesBlob

type TableColumn_BytesBlob struct {
	// BytesBlob is a binary SQL value.
	BytesBlob *blob.Blob `protobuf:"bytes,7,opt,name=bytes_blob,json=bytesBlob,proto3,oneof"`
}

func (*TableColumn_BytesBlob) CloneOneofVT

func (m *TableColumn_BytesBlob) CloneOneofVT() isTableColumn_Value

func (*TableColumn_BytesBlob) CloneVT

func (*TableColumn_BytesBlob) EqualVT

func (this *TableColumn_BytesBlob) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_BytesBlob) MarshalToSizedBufferVT

func (m *TableColumn_BytesBlob) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_BytesBlob) MarshalToVT

func (m *TableColumn_BytesBlob) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_BytesBlob) SizeVT

func (m *TableColumn_BytesBlob) SizeVT() (n int)

type TableColumn_FloatValue

type TableColumn_FloatValue struct {
	// FloatValue is a floating-point SQL value.
	FloatValue float64 `protobuf:"fixed64,5,opt,name=float_value,json=floatValue,proto3,oneof"`
}

func (*TableColumn_FloatValue) CloneOneofVT

func (m *TableColumn_FloatValue) CloneOneofVT() isTableColumn_Value

func (*TableColumn_FloatValue) CloneVT

func (*TableColumn_FloatValue) EqualVT

func (this *TableColumn_FloatValue) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_FloatValue) MarshalToSizedBufferVT

func (m *TableColumn_FloatValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_FloatValue) MarshalToVT

func (m *TableColumn_FloatValue) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_FloatValue) SizeVT

func (m *TableColumn_FloatValue) SizeVT() (n int)

type TableColumn_IntValue

type TableColumn_IntValue struct {
	// IntValue is a signed integer SQL value.
	IntValue int64 `protobuf:"varint,3,opt,name=int_value,json=intValue,proto3,oneof"`
}

func (*TableColumn_IntValue) CloneOneofVT

func (m *TableColumn_IntValue) CloneOneofVT() isTableColumn_Value

func (*TableColumn_IntValue) CloneVT

func (*TableColumn_IntValue) EqualVT

func (this *TableColumn_IntValue) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_IntValue) MarshalToSizedBufferVT

func (m *TableColumn_IntValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_IntValue) MarshalToVT

func (m *TableColumn_IntValue) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_IntValue) SizeVT

func (m *TableColumn_IntValue) SizeVT() (n int)

type TableColumn_JsonBlob

type TableColumn_JsonBlob struct {
	// JsonBlob is a JSON SQL value encoded as UTF-8 text.
	JsonBlob *blob.Blob `protobuf:"bytes,8,opt,name=json_blob,json=jsonBlob,proto3,oneof"`
}

func (*TableColumn_JsonBlob) CloneOneofVT

func (m *TableColumn_JsonBlob) CloneOneofVT() isTableColumn_Value

func (*TableColumn_JsonBlob) CloneVT

func (*TableColumn_JsonBlob) EqualVT

func (this *TableColumn_JsonBlob) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_JsonBlob) MarshalToSizedBufferVT

func (m *TableColumn_JsonBlob) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_JsonBlob) MarshalToVT

func (m *TableColumn_JsonBlob) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_JsonBlob) SizeVT

func (m *TableColumn_JsonBlob) SizeVT() (n int)

type TableColumn_StringBlob

type TableColumn_StringBlob struct {
	// StringBlob is a string SQL value encoded as UTF-8 bytes.
	StringBlob *blob.Blob `protobuf:"bytes,6,opt,name=string_blob,json=stringBlob,proto3,oneof"`
}

func (*TableColumn_StringBlob) CloneOneofVT

func (m *TableColumn_StringBlob) CloneOneofVT() isTableColumn_Value

func (*TableColumn_StringBlob) CloneVT

func (*TableColumn_StringBlob) EqualVT

func (this *TableColumn_StringBlob) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_StringBlob) MarshalToSizedBufferVT

func (m *TableColumn_StringBlob) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_StringBlob) MarshalToVT

func (m *TableColumn_StringBlob) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_StringBlob) SizeVT

func (m *TableColumn_StringBlob) SizeVT() (n int)

type TableColumn_TimespanMicros

type TableColumn_TimespanMicros struct {
	// TimespanMicros is a TIME SQL value in microseconds.
	TimespanMicros int64 `protobuf:"varint,10,opt,name=timespan_micros,json=timespanMicros,proto3,oneof"`
}

func (*TableColumn_TimespanMicros) CloneOneofVT

func (m *TableColumn_TimespanMicros) CloneOneofVT() isTableColumn_Value

func (*TableColumn_TimespanMicros) CloneVT

func (*TableColumn_TimespanMicros) EqualVT

func (this *TableColumn_TimespanMicros) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_TimespanMicros) MarshalToSizedBufferVT

func (m *TableColumn_TimespanMicros) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_TimespanMicros) MarshalToVT

func (m *TableColumn_TimespanMicros) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_TimespanMicros) SizeVT

func (m *TableColumn_TimespanMicros) SizeVT() (n int)

type TableColumn_TimestampValue

type TableColumn_TimestampValue struct {
	// TimestampValue is a timestamp, datetime, or date SQL value.
	TimestampValue *TableTimestamp `protobuf:"bytes,9,opt,name=timestamp_value,json=timestampValue,proto3,oneof"`
}

func (*TableColumn_TimestampValue) CloneOneofVT

func (m *TableColumn_TimestampValue) CloneOneofVT() isTableColumn_Value

func (*TableColumn_TimestampValue) CloneVT

func (*TableColumn_TimestampValue) EqualVT

func (this *TableColumn_TimestampValue) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_TimestampValue) MarshalToSizedBufferVT

func (m *TableColumn_TimestampValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_TimestampValue) MarshalToVT

func (m *TableColumn_TimestampValue) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_TimestampValue) SizeVT

func (m *TableColumn_TimestampValue) SizeVT() (n int)

type TableColumn_UintValue

type TableColumn_UintValue struct {
	// UintValue is an unsigned integer SQL value.
	UintValue uint64 `protobuf:"varint,4,opt,name=uint_value,json=uintValue,proto3,oneof"`
}

func (*TableColumn_UintValue) CloneOneofVT

func (m *TableColumn_UintValue) CloneOneofVT() isTableColumn_Value

func (*TableColumn_UintValue) CloneVT

func (*TableColumn_UintValue) EqualVT

func (this *TableColumn_UintValue) EqualVT(thatIface isTableColumn_Value) bool

func (*TableColumn_UintValue) MarshalToSizedBufferVT

func (m *TableColumn_UintValue) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableColumn_UintValue) MarshalToVT

func (m *TableColumn_UintValue) MarshalToVT(dAtA []byte) (int, error)

func (*TableColumn_UintValue) SizeVT

func (m *TableColumn_UintValue) SizeVT() (n int)

type TableEditor

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

TableEditor implements row management operations against a table.

Note: all table operations are (currently) not concurrency safe.

func NewTableEditor

func NewTableEditor(ctx context.Context, t *Table) *TableEditor

NewTableEditor constructs a new table row inserter.

func (*TableEditor) AcquireAutoIncrementLock

func (i *TableEditor) AcquireAutoIncrementLock(ctx *sql.Context) (func(), error)

AcquireAutoIncrementLock acquires (if necessary) an exclusive lock on generating auto-increment values for the underlying table. This is called when @@innodb_autoinc_lock_mode is set to 0 (traditional) or 1 (consecutive), in order to guarantee that insert operations get a consecutive range of generated ids. The function returns a callback to release the lock.

func (*TableEditor) Close

func (i *TableEditor) Close(sqlCtx *sql.Context) error

Close finalizes the operation, persisting its result.

func (*TableEditor) DiscardChanges

func (i *TableEditor) DiscardChanges(ctx *sql.Context, errorEncountered error) error

DiscardChanges is called if a statement encounters an error, and all current changes since the statement beginning should be discarded.

func (*TableEditor) Insert

func (i *TableEditor) Insert(sqlCtx *sql.Context, row sql.Row) error

Insert inserts the row given, returning an error if it cannot. Insert will be called once for each row to process for the insert operation, which may involve many rows. After all rows in an operation have been processed, Close is called.

func (*TableEditor) SetAutoIncrementValue

func (i *TableEditor) SetAutoIncrementValue(sqlCtx *sql.Context, val uint64) error

SetAutoIncrementValue sets a new AUTO_INCREMENT value.

func (*TableEditor) SetBuildBlobOpts

func (i *TableEditor) SetBuildBlobOpts(opts *blob.BuildBlobOpts)

SetBuildBlobOpts sets the build blob options.

func (*TableEditor) StatementBegin

func (i *TableEditor) StatementBegin(ctx *sql.Context)

StatementBegin is called before the first operation of a statement. Integrators should mark the state of the data in some way that it may be returned to in the case of an error.

func (*TableEditor) StatementComplete

func (i *TableEditor) StatementComplete(ctx *sql.Context) error

StatementComplete is called after the last operation of the statement, indicating that it has successfully completed. The mark set in StatementBegin may be removed, and a new one should be created on the next StatementBegin.

type TablePartition

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

TablePartition is a table partition handle.

func NewTablePartition

func NewTablePartition(
	idx int,
	t *TablePartitionRoot, bcs *block.Cursor,
	schema sql.Schema,
	lookup sql.IndexLookup,
) (*TablePartition, error)

NewTablePartition constructs a table partition handle.

bcs should be located at the TablePartitionRoot sub-block. lookup can be nil

func (*TablePartition) BuildTreeTx

func (p *TablePartition) BuildTreeTx(ctx context.Context, detach, write bool) (kvtx.BlockTx, error)

BuildTreeTx builds the avl tree transaction.

func (*TablePartition) IterateRows

func (p *TablePartition) IterateRows(ctx *sql.Context) (sql.RowIter, error)

IterateRows returns a row iterator.

func (*TablePartition) Key

func (p *TablePartition) Key() []byte

Key returns the partition key.

type TablePartitionIter

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

TablePartitionIter is a table partition iterator.

func NewTablePartitionIter

func NewTablePartitionIter(t *Table) *TablePartitionIter

NewTablePartitionIter constructs a new PartitionIter.

func (*TablePartitionIter) Close

func (i *TablePartitionIter) Close(sctx *sql.Context) error

Close closes the iterator.

func (*TablePartitionIter) Next

func (i *TablePartitionIter) Next(sctx *sql.Context) (sql.Partition, error)

Next iterates to the next partition.

type TablePartitionRoot

type TablePartitionRoot struct {

	// RowKeyValue is the key/value tree of objects.
	// Key: row_nonce uint64 encoded with big endian
	// Value: cid.BlockRef -> Object
	RowKeyValue *block1.KeyValueStore `protobuf:"bytes,1,opt,name=row_key_value,json=rowKeyValue,proto3" json:"rowKeyValue,omitempty"`
	// contains filtered or unexported fields
}

TablePartitionRoot contains the root of a table partition.

func NewTablePartitionRoot

func NewTablePartitionRoot() *TablePartitionRoot

NewTablePartitionRoot constructs a new table partition root object.

func (*TablePartitionRoot) ApplySubBlock

func (r *TablePartitionRoot) ApplySubBlock(id uint32, next block.SubBlock) error

ApplySubBlock applies a sub-block change with a field id.

func (*TablePartitionRoot) CloneMessageVT

func (m *TablePartitionRoot) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*TablePartitionRoot) CloneVT

func (m *TablePartitionRoot) CloneVT() *TablePartitionRoot

func (*TablePartitionRoot) EqualMessageVT

func (this *TablePartitionRoot) EqualMessageVT(thatMsg any) bool

func (*TablePartitionRoot) EqualVT

func (this *TablePartitionRoot) EqualVT(that *TablePartitionRoot) bool

func (*TablePartitionRoot) GetRowKeyValue

func (x *TablePartitionRoot) GetRowKeyValue() *block1.KeyValueStore

func (*TablePartitionRoot) GetSubBlockCtor

func (r *TablePartitionRoot) GetSubBlockCtor(id uint32) block.SubBlockCtor

GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.

func (*TablePartitionRoot) GetSubBlocks

func (r *TablePartitionRoot) GetSubBlocks() map[uint32]block.SubBlock

GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.

func (*TablePartitionRoot) IsNil

func (r *TablePartitionRoot) IsNil() bool

IsNil returns if the object is nil.

func (*TablePartitionRoot) MarshalJSON

func (x *TablePartitionRoot) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TablePartitionRoot to JSON.

func (*TablePartitionRoot) MarshalProtoJSON

func (x *TablePartitionRoot) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TablePartitionRoot message to JSON.

func (*TablePartitionRoot) MarshalProtoText

func (x *TablePartitionRoot) MarshalProtoText() string

func (*TablePartitionRoot) MarshalToSizedBufferVT

func (m *TablePartitionRoot) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TablePartitionRoot) MarshalToVT

func (m *TablePartitionRoot) MarshalToVT(dAtA []byte) (int, error)

func (*TablePartitionRoot) MarshalVT

func (m *TablePartitionRoot) MarshalVT() (dAtA []byte, err error)

func (*TablePartitionRoot) ProtoMessage

func (*TablePartitionRoot) ProtoMessage()

func (*TablePartitionRoot) Reset

func (x *TablePartitionRoot) Reset()

func (*TablePartitionRoot) SizeVT

func (m *TablePartitionRoot) SizeVT() (n int)

func (*TablePartitionRoot) String

func (x *TablePartitionRoot) String() string

func (*TablePartitionRoot) UnmarshalJSON

func (x *TablePartitionRoot) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TablePartitionRoot from JSON.

func (*TablePartitionRoot) UnmarshalProtoJSON

func (x *TablePartitionRoot) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TablePartitionRoot message from JSON.

func (*TablePartitionRoot) UnmarshalVT

func (m *TablePartitionRoot) UnmarshalVT(dAtA []byte) error

func (*TablePartitionRoot) Validate

func (r *TablePartitionRoot) Validate() error

Validate performs cursory validation of the table partition root.

type TablePartitionRowIter

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

TablePartitionRowIter is a table partition iterator.

func NewTablePartitionRowIter

func NewTablePartitionRowIter(
	ctx context.Context,
	tree kvtx.BlockTx,
	schema sql.Schema,
) (*TablePartitionRowIter, error)

NewTablePartitionRowIter constructs a table partition row iterator.

func (*TablePartitionRowIter) Close

func (i *TablePartitionRowIter) Close(sctx *sql.Context) error

Close the iterator.

func (*TablePartitionRowIter) GetRow

func (i *TablePartitionRowIter) GetRow() (sql.Row, error)

GetRow returns the row at the index.

func (*TablePartitionRowIter) Next

func (i *TablePartitionRowIter) Next(sctx *sql.Context) (sql.Row, error)

Next retrieves the next row. It will return io.EOF if it's the last row. After retrieving the last row, Close will be automatically closed.

func (*TablePartitionRowIter) Next2

func (i *TablePartitionRowIter) Next2(ctx *sql.Context, frame *sql.RowFrame) error

Next2 produces the next row, and stores it in the RowFrame provided. It will return io.EOF if it's the last row. After retrieving the last row, Close will be automatically called.

type TableRoot

type TableRoot struct {

	// TableSchema is the table schema.
	TableSchema *TableSchema `protobuf:"bytes,1,opt,name=table_schema,json=tableSchema,proto3" json:"tableSchema,omitempty"`
	// PrimaryKeyOrdinals is the PkOrdinals field of PrimaryKeySchema.
	PrimaryKeyOrdinals []int32 `protobuf:"varint,5,rep,packed,name=primary_key_ordinals,json=primaryKeyOrdinals,proto3" json:"primaryKeyOrdinals,omitempty"`
	// TablePartitions contains the set of table partitions.
	TablePartitions []*TablePartitionRoot `protobuf:"bytes,2,rep,name=table_partitions,json=tablePartitions,proto3" json:"tablePartitions,omitempty"`
	// RowNonce is the row identifier nonce, incremented when a row is inserted.
	RowNonce uint64 `protobuf:"varint,3,opt,name=row_nonce,json=rowNonce,proto3" json:"rowNonce,omitempty"`
	// AutoIncrVal is the auto increment value, if necessary.
	// Typically contains an integer or float.
	// Empty if auto_incr_index is zero.
	AutoIncrVal *TableColumn `protobuf:"bytes,4,opt,name=auto_incr_val,json=autoIncrVal,proto3" json:"autoIncrVal,omitempty"`
	// CollationId is the method ID of the method used to control sorting.
	CollationId uint32 `protobuf:"varint,6,opt,name=collation_id,json=collationId,proto3" json:"collationId,omitempty"`
	// Comment is an additional comment on the table.
	Comment string `protobuf:"bytes,7,opt,name=comment,proto3" json:"comment,omitempty"`
	// contains filtered or unexported fields
}

TableRoot is the root object of the table.

func LoadTableRoot

func LoadTableRoot(ctx context.Context, cursor *block.Cursor) (*TableRoot, error)

LoadTableRoot follows the database root cursor. may return nil

func (*TableRoot) ApplySubBlock

func (r *TableRoot) ApplySubBlock(id uint32, next block.SubBlock) error

ApplySubBlock applies a sub-block change with a field id.

func (*TableRoot) CloneMessageVT

func (m *TableRoot) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*TableRoot) CloneVT

func (m *TableRoot) CloneVT() *TableRoot

func (*TableRoot) EqualMessageVT

func (this *TableRoot) EqualMessageVT(thatMsg any) bool

func (*TableRoot) EqualVT

func (this *TableRoot) EqualVT(that *TableRoot) bool

func (*TableRoot) FetchAutoIncrVal

func (r *TableRoot) FetchAutoIncrVal(
	ctx context.Context,
	bcs *block.Cursor,
	expectedType sql.Type,
) (any, sql.ConvertInRange, error)

FetchAutoIncrVal fetches and checks the auto-increment value

bcs should be located at the table root.

func (*TableRoot) GetAutoIncrVal

func (x *TableRoot) GetAutoIncrVal() *TableColumn

func (*TableRoot) GetCollationId

func (x *TableRoot) GetCollationId() uint32

func (*TableRoot) GetComment

func (x *TableRoot) GetComment() string

func (*TableRoot) GetPrimaryKeyOrdinals

func (x *TableRoot) GetPrimaryKeyOrdinals() []int32

func (*TableRoot) GetRowNonce

func (x *TableRoot) GetRowNonce() uint64

func (*TableRoot) GetSubBlockCtor

func (r *TableRoot) GetSubBlockCtor(id uint32) block.SubBlockCtor

GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.

func (*TableRoot) GetSubBlocks

func (r *TableRoot) GetSubBlocks() map[uint32]block.SubBlock

GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.

func (*TableRoot) GetTablePartitions

func (x *TableRoot) GetTablePartitions() []*TablePartitionRoot

func (*TableRoot) GetTableSchema

func (x *TableRoot) GetTableSchema() *TableSchema

func (*TableRoot) MarshalBlock

func (r *TableRoot) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*TableRoot) MarshalJSON

func (x *TableRoot) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TableRoot to JSON.

func (*TableRoot) MarshalProtoJSON

func (x *TableRoot) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TableRoot message to JSON.

func (*TableRoot) MarshalProtoText

func (x *TableRoot) MarshalProtoText() string

func (*TableRoot) MarshalToSizedBufferVT

func (m *TableRoot) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableRoot) MarshalToVT

func (m *TableRoot) MarshalToVT(dAtA []byte) (int, error)

func (*TableRoot) MarshalVT

func (m *TableRoot) MarshalVT() (dAtA []byte, err error)

func (*TableRoot) ProtoMessage

func (*TableRoot) ProtoMessage()

func (*TableRoot) Reset

func (x *TableRoot) Reset()

func (*TableRoot) SizeVT

func (m *TableRoot) SizeVT() (n int)

func (*TableRoot) StoreAutoIncrVal

func (r *TableRoot) StoreAutoIncrVal(
	ctx context.Context,
	bcs *block.Cursor,
	buildBlobOpts *blob.BuildBlobOpts,
	val any,
) error

StoreAutoIncrVal stores the auto-increment value

bcs should be located at the table root.

func (*TableRoot) String

func (x *TableRoot) String() string

func (*TableRoot) UnmarshalBlock

func (r *TableRoot) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*TableRoot) UnmarshalJSON

func (x *TableRoot) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TableRoot from JSON.

func (*TableRoot) UnmarshalProtoJSON

func (x *TableRoot) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TableRoot message from JSON.

func (*TableRoot) UnmarshalVT

func (m *TableRoot) UnmarshalVT(dAtA []byte) error

func (*TableRoot) Validate

func (r *TableRoot) Validate() error

Validate validates the database root block.

type TableRow

type TableRow struct {

	// Columns contains the set of columns.
	Columns []*TableColumn `protobuf:"bytes,1,rep,name=columns,proto3" json:"columns,omitempty"`
	// contains filtered or unexported fields
}

TableRow is a row in a table.

func BuildTableRow

func BuildTableRow(
	ctx context.Context,
	bcs *block.Cursor,
	row sql.Row,
	buildBlobOpts *blob.BuildBlobOpts,
) (*TableRow, error)

BuildTableRow constructs a TableRow by marshaling cols with msgpack blobs.

Stores sub-blocks and references using the cursor. Sets the block at the cursor. If columns are large enough, they will be sharded into separate blocks. Supports streaming decoding at a later time. buildBlobOpts is optional bcs is required autoIncIdx and autoIncVal are optional.

func UnmarshalTableRow

func UnmarshalTableRow(ctx context.Context, bcs *block.Cursor) (*TableRow, error)

UnmarshalTableRow unmarshals the TableRow block. Returns nil, nil if empty

func (*TableRow) ApplySubBlock

func (r *TableRow) ApplySubBlock(id uint32, next block.SubBlock) error

ApplySubBlock applies a sub-block change with a field id.

func (*TableRow) CloneMessageVT

func (m *TableRow) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*TableRow) CloneVT

func (m *TableRow) CloneVT() *TableRow

func (*TableRow) EqualMessageVT

func (this *TableRow) EqualMessageVT(thatMsg any) bool

func (*TableRow) EqualVT

func (this *TableRow) EqualVT(that *TableRow) bool

func (*TableRow) FetchSqlRow

func (r *TableRow) FetchSqlRow(ctx context.Context, bcs *block.Cursor) (sql.Row, error)

FetchSqlRow fetches columns into a sql.Row structure. This converts the encoded table column values into Go types. The resulting sql.Row should be checked against a schema.

func (*TableRow) GetColumns

func (x *TableRow) GetColumns() []*TableColumn

func (*TableRow) GetSubBlockCtor

func (r *TableRow) GetSubBlockCtor(id uint32) block.SubBlockCtor

GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.

func (*TableRow) GetSubBlocks

func (r *TableRow) GetSubBlocks() map[uint32]block.SubBlock

GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.

func (*TableRow) MarshalBlock

func (r *TableRow) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*TableRow) MarshalJSON

func (x *TableRow) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TableRow to JSON.

func (*TableRow) MarshalProtoJSON

func (x *TableRow) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TableRow message to JSON.

func (*TableRow) MarshalProtoText

func (x *TableRow) MarshalProtoText() string

func (*TableRow) MarshalToSizedBufferVT

func (m *TableRow) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableRow) MarshalToVT

func (m *TableRow) MarshalToVT(dAtA []byte) (int, error)

func (*TableRow) MarshalVT

func (m *TableRow) MarshalVT() (dAtA []byte, err error)

func (*TableRow) ProtoMessage

func (*TableRow) ProtoMessage()

func (*TableRow) Reset

func (x *TableRow) Reset()

func (*TableRow) SizeVT

func (m *TableRow) SizeVT() (n int)

func (*TableRow) String

func (x *TableRow) String() string

func (*TableRow) UnmarshalBlock

func (r *TableRow) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*TableRow) UnmarshalJSON

func (x *TableRow) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TableRow from JSON.

func (*TableRow) UnmarshalProtoJSON

func (x *TableRow) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TableRow message from JSON.

func (*TableRow) UnmarshalVT

func (m *TableRow) UnmarshalVT(dAtA []byte) error

type TableSchema

type TableSchema struct {

	// Columns is the list of columns in the table, sorted by name.
	Columns []*TableSchemaColumn `protobuf:"bytes,1,rep,name=columns,proto3" json:"columns,omitempty"`
	// contains filtered or unexported fields
}

TableSchema is the schema for a table.

func NewTableSchema

func NewTableSchema(schema sql.Schema) *TableSchema

NewTableSchema constructs a table schema from sql schema.

func (*TableSchema) CloneMessageVT

func (m *TableSchema) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*TableSchema) CloneVT

func (m *TableSchema) CloneVT() *TableSchema

func (*TableSchema) EqualMessageVT

func (this *TableSchema) EqualMessageVT(thatMsg any) bool

func (*TableSchema) EqualVT

func (this *TableSchema) EqualVT(that *TableSchema) bool

func (*TableSchema) GetColumns

func (x *TableSchema) GetColumns() []*TableSchemaColumn

func (*TableSchema) MarshalJSON

func (x *TableSchema) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TableSchema to JSON.

func (*TableSchema) MarshalProtoJSON

func (x *TableSchema) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TableSchema message to JSON.

func (*TableSchema) MarshalProtoText

func (x *TableSchema) MarshalProtoText() string

func (*TableSchema) MarshalToSizedBufferVT

func (m *TableSchema) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableSchema) MarshalToVT

func (m *TableSchema) MarshalToVT(dAtA []byte) (int, error)

func (*TableSchema) MarshalVT

func (m *TableSchema) MarshalVT() (dAtA []byte, err error)

func (*TableSchema) ProtoMessage

func (*TableSchema) ProtoMessage()

func (*TableSchema) Reset

func (x *TableSchema) Reset()

func (*TableSchema) SizeVT

func (m *TableSchema) SizeVT() (n int)

func (*TableSchema) String

func (x *TableSchema) String() string

func (*TableSchema) ToSqlSchema

func (s *TableSchema) ToSqlSchema(ctx *sql.Context) (sql.Schema, error)

ToSqlSchema converts to a table sql schema.

ctx is optional.

func (*TableSchema) UnmarshalJSON

func (x *TableSchema) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TableSchema from JSON.

func (*TableSchema) UnmarshalProtoJSON

func (x *TableSchema) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TableSchema message from JSON.

func (*TableSchema) UnmarshalVT

func (m *TableSchema) UnmarshalVT(dAtA []byte) error

func (*TableSchema) Validate

func (s *TableSchema) Validate() error

Validate performs cursory validation of the table schema.

type TableSchemaColumn

type TableSchemaColumn struct {

	// Name is the name of the column.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// ColumnType is the data type of the column.
	ColumnType string `protobuf:"bytes,2,opt,name=column_type,json=columnType,proto3" json:"columnType,omitempty"`
	// DefaultValueExpr is the default value expression, encoded to a string.
	DefaultValueExpr string `protobuf:"bytes,3,opt,name=default_value_expr,json=defaultValueExpr,proto3" json:"defaultValueExpr,omitempty"`
	// AutoIncrement is true if the column auto-increments.
	AutoIncrement bool `protobuf:"varint,4,opt,name=auto_increment,json=autoIncrement,proto3" json:"autoIncrement,omitempty"`
	// Nullable is true if the column can contain NULL values, or false otherwise.
	Nullable bool `protobuf:"varint,5,opt,name=nullable,proto3" json:"nullable,omitempty"`
	// Source is the name of the table this column came from.
	Source string `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"`
	// PrimaryKey is true if the column is part of the primary key for its table.
	PrimaryKey bool `protobuf:"varint,7,opt,name=primary_key,json=primaryKey,proto3" json:"primaryKey,omitempty"`
	// Comment contains the string comment for this column.
	Comment string `protobuf:"bytes,8,opt,name=comment,proto3" json:"comment,omitempty"`
	// Extra contains any additional information to put in the `extra` column under `information_schema.columns`.
	Extra string `protobuf:"bytes,9,opt,name=extra,proto3" json:"extra,omitempty"`
	// contains filtered or unexported fields
}

TableSchemaColumn is the definition of a column for a table schema.

func NewTableSchemaColumn

func NewTableSchemaColumn(col *sql.Column) *TableSchemaColumn

NewTableSchemaColumn constructs a table column from sql schema.

func (*TableSchemaColumn) CloneMessageVT

func (m *TableSchemaColumn) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*TableSchemaColumn) CloneVT

func (m *TableSchemaColumn) CloneVT() *TableSchemaColumn

func (*TableSchemaColumn) EqualMessageVT

func (this *TableSchemaColumn) EqualMessageVT(thatMsg any) bool

func (*TableSchemaColumn) EqualVT

func (this *TableSchemaColumn) EqualVT(that *TableSchemaColumn) bool

func (*TableSchemaColumn) GetAutoIncrement

func (x *TableSchemaColumn) GetAutoIncrement() bool

func (*TableSchemaColumn) GetColumnType

func (x *TableSchemaColumn) GetColumnType() string

func (*TableSchemaColumn) GetComment

func (x *TableSchemaColumn) GetComment() string

func (*TableSchemaColumn) GetDefaultValueExpr

func (x *TableSchemaColumn) GetDefaultValueExpr() string

func (*TableSchemaColumn) GetExtra

func (x *TableSchemaColumn) GetExtra() string

func (*TableSchemaColumn) GetName

func (x *TableSchemaColumn) GetName() string

func (*TableSchemaColumn) GetNullable

func (x *TableSchemaColumn) GetNullable() bool

func (*TableSchemaColumn) GetPrimaryKey

func (x *TableSchemaColumn) GetPrimaryKey() bool

func (*TableSchemaColumn) GetSource

func (x *TableSchemaColumn) GetSource() string

func (*TableSchemaColumn) MarshalJSON

func (x *TableSchemaColumn) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TableSchemaColumn to JSON.

func (*TableSchemaColumn) MarshalProtoJSON

func (x *TableSchemaColumn) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TableSchemaColumn message to JSON.

func (*TableSchemaColumn) MarshalProtoText

func (x *TableSchemaColumn) MarshalProtoText() string

func (*TableSchemaColumn) MarshalToSizedBufferVT

func (m *TableSchemaColumn) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableSchemaColumn) MarshalToVT

func (m *TableSchemaColumn) MarshalToVT(dAtA []byte) (int, error)

func (*TableSchemaColumn) MarshalVT

func (m *TableSchemaColumn) MarshalVT() (dAtA []byte, err error)

func (*TableSchemaColumn) ParseColumnType

func (t *TableSchemaColumn) ParseColumnType() (sql.Type, error)

ParseColumnType parses the column type to sql type.

func (*TableSchemaColumn) ParseDefaultValueExpr

func (t *TableSchemaColumn) ParseDefaultValueExpr(ctx *sql.Context) (*sql.ColumnDefaultValue, error)

ParseDefaultValueExpr parses the default value expression.

Returns nil if the field is empty. If ctx is nil, uses default context.

func (*TableSchemaColumn) ProtoMessage

func (*TableSchemaColumn) ProtoMessage()

func (*TableSchemaColumn) Reset

func (x *TableSchemaColumn) Reset()

func (*TableSchemaColumn) SizeVT

func (m *TableSchemaColumn) SizeVT() (n int)

func (*TableSchemaColumn) String

func (x *TableSchemaColumn) String() string

func (*TableSchemaColumn) ToSqlColumn

func (t *TableSchemaColumn) ToSqlColumn(ctx *sql.Context) (*sql.Column, error)

ToSqlColumn converts the proto into a sql column.

Ctx is optional

func (*TableSchemaColumn) UnmarshalJSON

func (x *TableSchemaColumn) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TableSchemaColumn from JSON.

func (*TableSchemaColumn) UnmarshalProtoJSON

func (x *TableSchemaColumn) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TableSchemaColumn message from JSON.

func (*TableSchemaColumn) UnmarshalVT

func (m *TableSchemaColumn) UnmarshalVT(dAtA []byte) error

func (*TableSchemaColumn) Validate

func (t *TableSchemaColumn) Validate() error

Validate performs cursory validation of the table column.

type TableTimestamp

type TableTimestamp struct {

	// UnixSeconds is seconds since Unix epoch.
	UnixSeconds int64 `protobuf:"varint,1,opt,name=unix_seconds,json=unixSeconds,proto3" json:"unixSeconds,omitempty"`
	// Nanos is the nanosecond offset within UnixSeconds.
	Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"`
	// contains filtered or unexported fields
}

TableTimestamp is a timestamp-like SQL value.

func (*TableTimestamp) CloneMessageVT

func (m *TableTimestamp) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*TableTimestamp) CloneVT

func (m *TableTimestamp) CloneVT() *TableTimestamp

func (*TableTimestamp) EqualMessageVT

func (this *TableTimestamp) EqualMessageVT(thatMsg any) bool

func (*TableTimestamp) EqualVT

func (this *TableTimestamp) EqualVT(that *TableTimestamp) bool

func (*TableTimestamp) GetNanos

func (x *TableTimestamp) GetNanos() int32

func (*TableTimestamp) GetUnixSeconds

func (x *TableTimestamp) GetUnixSeconds() int64

func (*TableTimestamp) MarshalJSON

func (x *TableTimestamp) MarshalJSON() ([]byte, error)

MarshalJSON marshals the TableTimestamp to JSON.

func (*TableTimestamp) MarshalProtoJSON

func (x *TableTimestamp) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the TableTimestamp message to JSON.

func (*TableTimestamp) MarshalProtoText

func (x *TableTimestamp) MarshalProtoText() string

func (*TableTimestamp) MarshalToSizedBufferVT

func (m *TableTimestamp) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*TableTimestamp) MarshalToVT

func (m *TableTimestamp) MarshalToVT(dAtA []byte) (int, error)

func (*TableTimestamp) MarshalVT

func (m *TableTimestamp) MarshalVT() (dAtA []byte, err error)

func (*TableTimestamp) ProtoMessage

func (*TableTimestamp) ProtoMessage()

func (*TableTimestamp) Reset

func (x *TableTimestamp) Reset()

func (*TableTimestamp) SizeVT

func (m *TableTimestamp) SizeVT() (n int)

func (*TableTimestamp) String

func (x *TableTimestamp) String() string

func (*TableTimestamp) UnmarshalJSON

func (x *TableTimestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the TableTimestamp from JSON.

func (*TableTimestamp) UnmarshalProtoJSON

func (x *TableTimestamp) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the TableTimestamp message from JSON.

func (*TableTimestamp) UnmarshalVT

func (m *TableTimestamp) UnmarshalVT(dAtA []byte) error

type Tx

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

Tx contains a transaction against the mysql data store.

func (*Tx) BuildDatabaseProvider

func (t *Tx) BuildDatabaseProvider(ctx context.Context) (sql.DatabaseProvider, error)

BuildDatabaseProvider builds the database catalog from the available dbs.

func (*Tx) Commit

func (t *Tx) Commit(ctx context.Context) (cerr error)

Commit commits the transaction to storage. Can return an error to indicate tx failure.

func (*Tx) DatabaseCount

func (t *Tx) DatabaseCount() int

DatabaseCount returns the number of databases in the tree.

func (*Tx) Discard

func (t *Tx) Discard()

Discard cancels the transaction. If called after Commit, does nothing. Cannot return an error. Can be called unlimited times.

func (*Tx) GetBlockTransaction

func (t *Tx) GetBlockTransaction() *block.Transaction

GetBlockTransaction returns the underlying block transaction.

func (*Tx) OpenDatabase

func (t *Tx) OpenDatabase(ctx context.Context, name string, create bool) (*Database, error)

OpenDatabase opens a database with the given name.

If not exist, create is set, and tx is a write tx, it will be created.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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