api

package
v0.0.0-...-29d77a8 Latest Latest
Warning

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

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

Documentation

Overview

Package api mirrors Java's fdb-relational-api module.

It defines the public interfaces and types for the relational (SQL) layer: Connection, Statement, ResultSet, DataType, Options, ErrorCode, and related metadata types. Implementations live under pkg/relational/core (embedded) and pkg/relational/sqldriver (database/sql driver adapter).

Package api is a generated GoMock package.

Package api is a generated GoMock package.

Package api is a generated GoMock package.

Index

Constants

View Source
const (
	JDBCBit           int = -7
	JDBCTinyInt       int = -6
	JDBCSmallInt      int = 5
	JDBCInteger       int = 4
	JDBCBigInt        int = -5
	JDBCFloat         int = 6
	JDBCReal          int = 7
	JDBCDouble        int = 8
	JDBCNumeric       int = 2
	JDBCDecimal       int = 3
	JDBCChar          int = 1
	JDBCVarchar       int = 12
	JDBCLongVarchar   int = -1
	JDBCDate          int = 91
	JDBCTime          int = 92
	JDBCTimestamp     int = 93
	JDBCBinary        int = -2
	JDBCVarBinary     int = -3
	JDBCLongVarBinary int = -4
	JDBCNull          int = 0
	JDBCOther         int = 1111
	JDBCJavaObject    int = 2000
	JDBCStruct        int = 2002
	JDBCArray         int = 2003
	JDBCBoolean       int = 16
)

JDBC SQL type constants, mirroring java.sql.Types. Repeated here so callers do not need a separate "jdbc" constants package.

Values come from Java's java.sql.Types and must not change.

View Source
const (
	// ColumnNoNulls means the column disallows NULL.
	ColumnNoNulls int = 0
	// ColumnNullable means the column allows NULL.
	ColumnNullable int = 1
	// ColumnNullableUnknown means nullability is unknown.
	ColumnNullableUnknown int = 2
)

ResultSetMetaData column-nullability flags, matching JDBC's java.sql.ResultSetMetaData constants.

Variables

This section is empty.

Functions

func AtBeginning

func AtBeginning(c Continuation) bool

AtBeginning reports whether the continuation is at the beginning of the cursor (nil execution state). Default behavior matches Java's Continuation.atBeginning.

func AtEnd

func AtEnd(c Continuation) bool

AtEnd reports whether the continuation is past the last row (empty but non-nil execution state). Matches Java's Continuation.atEnd.

func DefaultOptionValues

func DefaultOptionValues() map[OptionName]any

DefaultOptionValues returns a copy of the default value map. Mutating the returned map does not affect defaults.

func JDBCFromSQLTypeName

func JDBCFromSQLTypeName(name SQLTypeName) int

JDBCFromSQLTypeName returns the JDBC type code for a display name. Returns -1 for unrecognised names. Java throws IllegalStateException; we prefer a sentinel so callers can decide.

func JDBCType

func JDBCType(c Code) int

JDBCType returns the JDBC-compatible SQL type code for a DataType Code. Mirrors Java's DataType.getJdbcSqlCode() table.

func VisitSchemaTemplateTree

func VisitSchemaTemplateTree(s SchemaTemplate, v Visitor)

VisitSchemaTemplateTree mirrors Java's default SchemaTemplate.accept(): startVisit → visit → finishVisit.

func VisitTableTree

func VisitTableTree(t Table, v Visitor)

VisitTableTree calls v.VisitTable(t) then recurses into t's indexes and columns. Mirrors Java's default Table.accept().

Types

type Array

type Array interface {
	// MetaData returns the array's metadata (base type + element count).
	MetaData() ArrayMetaData

	// BaseType returns the JDBC type code of the array element type
	// (matches java.sql.Array.getBaseType()).
	BaseType() int
	// BaseTypeName returns the display name of the element type.
	BaseTypeName() string

	// Length returns the number of elements.
	Length() int

	// Element returns the element at oneBasedIndex (1-indexed per
	// JDBC convention). Returns ErrCodeInvalidColumnReference if out
	// of range.
	Element(oneBasedIndex int) (any, error)
	// Elements returns every element in order. Convenience wrapper
	// around repeated Element calls.
	Elements() []any
}

Array is a typed SQL array column value. Mirrors Java's RelationalArray — lean Go shape, no java.sql.Array inheritance.

Array is homogeneous: every element has the declared BaseType(). Element values returned by Elements follow the driver.Value conventions — primitives map to Go-native types, nested STRUCTs become Struct, nested arrays become Array.

type ArrayMetaData

type ArrayMetaData interface {
	// ElementType returns the JDBC type code of elements.
	ElementType() int
	// ElementTypeName returns the display name of the element type.
	ElementTypeName() string
	// ElementDataType returns the full DataType — carries struct/enum
	// detail that the JDBC code alone can't convey. Relational-specific
	// extension over JDBC's ArrayMetaData.
	ElementDataType() DataType
	// Nullable reports whether elements may be NULL. One of the
	// ColumnNullable* constants.
	Nullable() int
}

ArrayMetaData describes an Array's element shape. Mirrors Java's ArrayMetaData.

type ArrayType

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

func NewArrayType

func NewArrayType(elementType DataType, isNullable bool) *ArrayType

NewArrayType returns an ArrayType whose elements have the given type. Java's ArrayType.from(DataType) defaults isNullable=false.

func (ArrayType) Code

func (b ArrayType) Code() Code

func (*ArrayType) ElementType

func (t *ArrayType) ElementType() DataType

func (*ArrayType) Equal

func (t *ArrayType) Equal(other DataType) bool

func (*ArrayType) HasIdenticalStructure

func (t *ArrayType) HasIdenticalStructure(other any) bool

HasIdenticalStructure treats ArrayTypes with structurally-identical element types as identical, matching Java's CompositeType contract.

func (ArrayType) IsNullable

func (b ArrayType) IsNullable() bool

func (ArrayType) IsPrimitive

func (b ArrayType) IsPrimitive() bool

func (*ArrayType) IsResolved

func (t *ArrayType) IsResolved() bool

func (*ArrayType) Resolve

func (t *ArrayType) Resolve(resolution map[string]Named) DataType

func (*ArrayType) String

func (t *ArrayType) String() string

func (*ArrayType) WithNullable

func (t *ArrayType) WithNullable(isNullable bool) DataType

type BooleanType

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

func NewBooleanType

func NewBooleanType(isNullable bool) *BooleanType

NewBooleanType returns the singleton BooleanType for the given nullability.

func (BooleanType) Code

func (b BooleanType) Code() Code

func (*BooleanType) Equal

func (t *BooleanType) Equal(other DataType) bool

func (BooleanType) IsNullable

func (b BooleanType) IsNullable() bool

func (BooleanType) IsPrimitive

func (b BooleanType) IsPrimitive() bool

func (*BooleanType) IsResolved

func (t *BooleanType) IsResolved() bool

func (*BooleanType) Resolve

func (t *BooleanType) Resolve(_ map[string]Named) DataType

func (*BooleanType) String

func (t *BooleanType) String() string

func (*BooleanType) WithNullable

func (t *BooleanType) WithNullable(isNullable bool) DataType

type BytesType

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

func NewBytesType

func NewBytesType(isNullable bool) *BytesType

func (BytesType) Code

func (b BytesType) Code() Code

func (*BytesType) Equal

func (t *BytesType) Equal(other DataType) bool

func (BytesType) IsNullable

func (b BytesType) IsNullable() bool

func (BytesType) IsPrimitive

func (b BytesType) IsPrimitive() bool

func (*BytesType) IsResolved

func (t *BytesType) IsResolved() bool

func (*BytesType) Resolve

func (t *BytesType) Resolve(_ map[string]Named) DataType

func (*BytesType) String

func (t *BytesType) String() string

func (*BytesType) WithNullable

func (t *BytesType) WithNullable(isNullable bool) DataType

type Code

type Code uint8

Code is the closed set of discriminators for DataType. Matches Java's enum DataType.Code 1:1.

const (
	CodeBoolean Code = iota
	CodeLong
	CodeInteger
	CodeFloat
	CodeDouble
	CodeString
	CodeBytes
	CodeVersion
	CodeEnum
	CodeUUID
	CodeStruct
	CodeArray
	CodeUnknown
	CodeNull
	CodeVector
	CodeDate
	CodeTimestamp
)

func (Code) String

func (c Code) String() string

String returns the enum name (matches Java's Code.name()).

type Column

type Column interface {
	Metadata
	// DataType returns the column's declared type.
	DataType() DataType
}

Column is one column of a Table. Mirrors Java's Column.

type CompositeType

type CompositeType interface {
	// HasIdenticalStructure reports structural compatibility. Unlike
	// Equal, this treats composites with the same shape as identical
	// regardless of name identity. Default behavior delegates to Equal.
	HasIdenticalStructure(other any) bool
}

CompositeType is a DataType with nested structure (ArrayType, StructType).

type Connection

type Connection interface {
	// CreateStatement constructs an empty RelationalStatement. Matches
	// Java's createStatement(). The statement shares the connection's
	// lifecycle — closing the connection invalidates it.
	CreateStatement(ctx context.Context) (Statement, error)

	// PrepareStatement compiles sql (with `?` placeholders) into a
	// reusable prepared statement. Matches Java's
	// prepareStatement(String).
	PrepareStatement(ctx context.Context, sql string) (PreparedStatement, error)

	// Options returns the current options map. Matches Java's
	// getOptions().
	Options() *Options
	// SetOption applies name=value to the connection-level options.
	// Matches Java's setOption(Name, Object).
	SetOption(name OptionName, value any) error

	// Path returns the database path this connection targets (matches
	// Java's getPath() returning a URI).
	Path() *url.URL

	// SetAutoCommit toggles auto-commit mode. Matches JDBC's
	// Connection.setAutoCommit.
	SetAutoCommit(autoCommit bool) error
	// AutoCommit reports the current auto-commit mode.
	AutoCommit() bool

	// Commit / Rollback end the current explicit transaction. Return
	// ErrCodeCannotCommitRollbackWithAutocommit if called with
	// auto-commit enabled (matches Java's behavior).
	Commit() error
	Rollback() error

	// SetSchema selects the default schema. Matches JDBC's
	// setSchema(String).
	SetSchema(schema string) error
	// Schema returns the current default schema name. Empty if none.
	Schema() string

	// Close releases the connection. Idempotent — close twice must
	// not panic.
	Close() error
	// IsClosed reports whether Close has been called.
	IsClosed() bool
}

Connection is the Go-native connection interface. Mirrors Java's RelationalConnection, minus the JDBC legacy surface.

Match methods use context.Context for cancellation, return typed errors instead of throwing, and return concrete Statement / PreparedStatement / ResultSet interfaces. The adapter in pkg/relational/sqldriver wraps this into a database/sql/driver.Conn.

type Continuation

type Continuation interface {
	// Serialize returns a wire-compatible representation that encodes
	// the continuation's full state. Must be round-trippable by
	// implementations.
	Serialize() []byte

	// ExecutionState returns the underlying cursor state bytes. A nil
	// result means "at the beginning"; an empty (length-0) result
	// means "at the end".
	ExecutionState() []byte

	// Reason explains why the continuation was generated.
	Reason() ContinuationReason
}

Continuation is a serialized pointer into a result set that a client can use to resume iteration in a later transaction.

Mirrors Java's com.apple.foundationdb.relational.api.Continuation. Implementations live closer to the cursor layer.

type ContinuationReason

type ContinuationReason int

ContinuationReason tags the cause of a continuation. Matches Java's Continuation.Reason enum 1:1.

const (
	// ContinuationUserRequested means getContinuation was called
	// before the ResultSet was exhausted.
	ContinuationUserRequested ContinuationReason = iota
	// ContinuationTransactionLimitReached fires when the byte / row /
	// time scan budget inside a transaction was hit.
	ContinuationTransactionLimitReached
	// ContinuationQueryExecutionLimitReached fires when a per-query
	// row cap was hit.
	ContinuationQueryExecutionLimitReached
	// ContinuationCursorAfterLast indicates the result set was fully
	// exhausted (no more rows).
	ContinuationCursorAfterLast
)

func (ContinuationReason) String

func (r ContinuationReason) String() string

String returns the Java enum name (for logging / debug output).

type DataType

type DataType interface {
	// Code returns the type's discriminator.
	Code() Code
	// IsNullable reports whether the type admits NULL.
	IsNullable() bool
	// IsPrimitive reports whether the type is a flat scalar.
	IsPrimitive() bool
	// IsResolved reports whether this type and all of its constituent
	// types are resolved (no UnresolvedType anywhere in the tree).
	IsResolved() bool
	// WithNullable returns a copy of the type with the given nullability.
	// For singleton primitives it returns the corresponding cached
	// instance; for composites it returns a new value.
	WithNullable(isNullable bool) DataType
	// Resolve replaces UnresolvedType references anywhere in this
	// type's tree using the given resolution map. If the type is
	// already resolved, returns the receiver unchanged.
	Resolve(resolution map[string]Named) DataType
	// Equal reports structural equality. Matches Java's equals()
	// override on each concrete type.
	Equal(other DataType) bool
	// String renders the type as human-readable text. The exact format
	// matches Java's toString() — "int", "int ∪ ∅", "[int]", etc.
	String() string
}

DataType represents a relational SQL data type. Mirrors Java's com.apple.foundationdb.relational.api.metadata.DataType.

Implementations are in this package. The set is closed — matching Java's sealed subclasses.

A DataType is:

  • either flat (primitive) or nested (composite),
  • maps to a JDBC SQL type code (see JDBCType),
  • carries a nullability flag,
  • is immutable,
  • may be unresolved (see UnresolvedType) until fixed up via Resolve.

func DataTypeFromSQLTypeName

func DataTypeFromSQLTypeName(name SQLTypeName) DataType

DataTypeFromSQLTypeName returns the non-nullable DataType for a display name, or nil if no primitive mapping applies (STRUCT / ARRAY cannot be reconstructed from a name alone — Java also returns null in those cases).

type DatabaseMetaData

type DatabaseMetaData interface {
	// Schemas returns every schema in every catalog.
	//
	// Columns:
	//   1 TABLE_SCHEM   string
	//   2 TABLE_CATALOG string
	Schemas(ctx context.Context) (ResultSet, error)

	// SchemasFiltered returns schemas matching the SQL LIKE
	// catalog + schemaPattern filters. Empty patterns match anything.
	SchemasFiltered(ctx context.Context, catalog, schemaPattern string) (ResultSet, error)

	// Tables returns tables matching the patterns. types is an
	// optional list of table types ("TABLE", "VIEW", "SYSTEM TABLE");
	// nil or empty returns all types.
	//
	// Columns (matching JDBC's DatabaseMetaData.getTables):
	//   1 TABLE_CAT   string  2 TABLE_SCHEM string  3 TABLE_NAME string
	//   4 TABLE_TYPE  string  5 REMARKS string      6 TYPE_CAT string
	//   7 TYPE_SCHEM  string  8 TYPE_NAME string    9 SELF_REFERENCING_COL_NAME string
	//  10 REF_GENERATION string
	Tables(ctx context.Context, catalog, schemaPattern, tableNamePattern string, types []string) (ResultSet, error)

	// Columns returns column metadata matching the patterns.
	//
	// Columns (matching JDBC's DatabaseMetaData.getColumns):
	//   1 TABLE_CAT  2 TABLE_SCHEM  3 TABLE_NAME  4 COLUMN_NAME
	//   5 DATA_TYPE (int, JDBC type code)  6 TYPE_NAME
	//   7 COLUMN_SIZE  8 BUFFER_LENGTH  9 DECIMAL_DIGITS 10 NUM_PREC_RADIX
	//  11 NULLABLE  12 REMARKS  13 COLUMN_DEF  14 SQL_DATA_TYPE
	//  15 SQL_DATETIME_SUB  16 CHAR_OCTET_LENGTH  17 ORDINAL_POSITION
	//  18 IS_NULLABLE  19 SCOPE_CATALOG  20 SCOPE_SCHEMA  21 SCOPE_TABLE
	//  22 SOURCE_DATA_TYPE  23 IS_AUTOINCREMENT  24 IS_GENERATEDCOLUMN
	Columns(ctx context.Context, catalog, schemaPattern, tableNamePattern, columnNamePattern string) (ResultSet, error)

	// IndexInfo returns secondary-index metadata for a table. If
	// unique is true, only unique indexes are returned. The
	// approximate flag tells the driver whether it may return stale
	// statistics (speed vs. freshness).
	//
	// Columns: 1 TABLE_CAT  2 TABLE_SCHEM  3 TABLE_NAME
	//          4 NON_UNIQUE  5 INDEX_QUALIFIER  6 INDEX_NAME
	//          7 TYPE  8 ORDINAL_POSITION  9 COLUMN_NAME
	//         10 ASC_OR_DESC  11 CARDINALITY  12 PAGES  13 FILTER_CONDITION
	IndexInfo(ctx context.Context, catalog, schema, table string, unique, approximate bool) (ResultSet, error)

	// PrimaryKeys returns the primary-key columns of the given table.
	//
	// Columns: 1 TABLE_CAT  2 TABLE_SCHEM  3 TABLE_NAME
	//          4 COLUMN_NAME  5 KEY_SEQ  6 PK_NAME
	PrimaryKeys(ctx context.Context, catalog, schema, table string) (ResultSet, error)

	// URL returns the JDBC-style URL this connection was opened with.
	URL() string
	// UserName returns the authenticated user, or empty if none.
	UserName() string
	// IsReadOnly reports whether the underlying database is read-only.
	IsReadOnly() bool

	// DatabaseProductName returns a human-readable database name
	// ("FoundationDB Relational"). Tools use this to route
	// dialect-specific quirks.
	DatabaseProductName() string
	// DatabaseProductVersion is the database version string.
	DatabaseProductVersion() string
	// DriverName is the relational-layer driver name.
	DriverName() string
	// DriverVersion is the driver version string.
	DriverVersion() string
}

DatabaseMetaData is a read-only view over the database's catalog suitable for exposing to tools (schema browsers, JDBC introspection, etc.). Mirrors Java's RelationalDatabaseMetaData — lean Go subset.

We keep only the essential discovery surface (Schemas, Tables, Columns, IndexInfo, PrimaryKeys) plus product-identification getters. The java.sql.DatabaseMetaData inheritance chain has ~100 additional methods that Java throws SQLFeatureNotSupportedException on; Go has no equivalent, so those don't exist here.

All discovery methods return a ResultSet whose column shape matches JDBC's schemas for the same method name — client tools assume that layout, and Java↔Go cross-compatibility requires we match it byte-for-byte. See each method's doc comment for the column list.

type DateType

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

func NewDateType

func NewDateType(isNullable bool) *DateType

func (DateType) Code

func (b DateType) Code() Code

func (*DateType) Equal

func (t *DateType) Equal(other DataType) bool

func (DateType) IsNullable

func (b DateType) IsNullable() bool

func (DateType) IsPrimitive

func (b DateType) IsPrimitive() bool

func (*DateType) IsResolved

func (t *DateType) IsResolved() bool

func (*DateType) Resolve

func (t *DateType) Resolve(_ map[string]Named) DataType

func (*DateType) String

func (t *DateType) String() string

func (*DateType) WithNullable

func (t *DateType) WithNullable(isNullable bool) DataType

type DirectAccessStatement

type DirectAccessStatement interface {
	// ExecuteScan scans a contiguous range of rows in tableName,
	// using keyPrefix as a PK-prefix. keyPrefix may be EmptyKeySet to
	// scan the full table. Fails if keyPrefix columns are not a
	// prefix of the table's primary key.
	ExecuteScan(ctx context.Context, tableName string, keyPrefix *KeySet, opts *Options) (ResultSet, error)

	// ExecuteGet returns a single row by its primary key. Returns an
	// empty ResultSet (Next()=false) if the row does not exist.
	ExecuteGet(ctx context.Context, tableName string, key *KeySet, opts *Options) (ResultSet, error)

	// ExecuteInsert inserts one or more rows. Returns the number of
	// rows actually inserted (may be 0 for IF-NOT-EXISTS semantics
	// with REPLACE_ON_DUPLICATE_PK=false).
	ExecuteInsert(ctx context.Context, tableName string, data []Struct, opts *Options) (int64, error)

	// ExecuteDelete deletes a single row by primary key. Returns the
	// number of rows deleted (0 or 1).
	ExecuteDelete(ctx context.Context, tableName string, key *KeySet, opts *Options) (int64, error)

	// ExecuteDeleteRange bulk-deletes every row matching the
	// keyPrefix. Equivalent to DELETE FROM tableName WHERE PK-prefix
	// matches. Returns the number of rows removed.
	ExecuteDeleteRange(ctx context.Context, tableName string, keyPrefix *KeySet, opts *Options) (int64, error)
}

DirectAccessStatement provides primary-key-direct access to tables that bypasses the SQL compiler — Scan, Get, Insert, Delete on a named table identified by a KeySet. Mirrors Java's RelationalDirectAccessStatement.

Java's RelationalStatement extends this interface (statements are also direct-access) but in Go we keep the two concerns split; a Statement impl can optionally expose DirectAccessStatement via type assertion.

type DoubleType

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

func NewDoubleType

func NewDoubleType(isNullable bool) *DoubleType

func (DoubleType) Code

func (b DoubleType) Code() Code

func (*DoubleType) Equal

func (t *DoubleType) Equal(other DataType) bool

func (DoubleType) IsNullable

func (b DoubleType) IsNullable() bool

func (DoubleType) IsPrimitive

func (b DoubleType) IsPrimitive() bool

func (*DoubleType) IsResolved

func (t *DoubleType) IsResolved() bool

func (*DoubleType) Resolve

func (t *DoubleType) Resolve(_ map[string]Named) DataType

func (*DoubleType) String

func (t *DoubleType) String() string

func (*DoubleType) WithNullable

func (t *DoubleType) WithNullable(isNullable bool) DataType

type Driver

type Driver interface {
	// Connect opens a connection to the database described by url
	// with the given options. ctx propagates cancellation/deadlines.
	// Mirrors Java's RelationalDriver.connect(URI, Options).
	Connect(ctx context.Context, url *url.URL, opts *Options) (Connection, error)

	// MajorVersion / MinorVersion report the driver version. Java
	// exposes these via java.sql.Driver; kept here because our
	// DatabaseMetaData will surface them.
	MajorVersion() int
	MinorVersion() int
}

Driver is the relational-layer driver. Mirrors Java's com.apple.foundationdb.relational.api.RelationalDriver.

This is the Go-native driver surface. The database/sql adapter lives in pkg/relational/sqldriver and delegates to an implementation of this interface.

Deliberate deviation from Java: we drop the java.sql.Driver inheritance (getPropertyInfo / jdbcCompliant / getParentLogger / accepts / DriverPropertyInfo[]) — those are JDBC boilerplate that Go's database/sql doesn't need.

type EnumType

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

func NewEnumType

func NewEnumType(name string, values []EnumValue, isNullable bool) *EnumType

NewEnumType constructs a named enum type. Panics with ErrCodeInternalError if name is empty or values is empty — matches Java's Assert.thatUnchecked in EnumType.from.

func (EnumType) Code

func (b EnumType) Code() Code

func (*EnumType) Equal

func (t *EnumType) Equal(other DataType) bool

func (EnumType) IsNullable

func (b EnumType) IsNullable() bool

func (EnumType) IsPrimitive

func (b EnumType) IsPrimitive() bool

func (*EnumType) IsResolved

func (t *EnumType) IsResolved() bool

func (*EnumType) Name

func (t *EnumType) Name() string

func (*EnumType) Resolve

func (t *EnumType) Resolve(_ map[string]Named) DataType

func (*EnumType) String

func (t *EnumType) String() string

String mirrors Java's EnumType.toString(): "enum(Name){V1,V2}". Notably Java does NOT append the "∪ ∅" nullability suffix on EnumType (unlike primitives), so neither do we — wire-format compatibility takes precedence over surface regularity.

func (*EnumType) Values

func (t *EnumType) Values() []EnumValue

Values returns a copy of the enum values. The internal slice is not exposed to preserve immutability.

func (*EnumType) WithNullable

func (t *EnumType) WithNullable(isNullable bool) DataType

type EnumValue

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

EnumValue is a single entry in an EnumType. Name and number are both identity-bearing — equality requires both to match.

func NewEnumValue

func NewEnumValue(name string, number int) EnumValue

NewEnumValue constructs an EnumValue.

func (EnumValue) Name

func (v EnumValue) Name() string

func (EnumValue) Number

func (v EnumValue) Number() int

func (EnumValue) String

func (v EnumValue) String() string

type Error

type Error struct {
	// Code is the SQLSTATE error code.
	Code ErrorCode
	// Message is the human-readable error description.
	Message string
	// Cause is the underlying error, if any. Unwrap returns it.
	Cause error
	// Context carries optional structured logging fields (table name,
	// column name, etc.). Corresponds to Java's errorContext map.
	Context map[string]any
}

Error is the Go equivalent of Java's com.apple.foundationdb.relational.api.exceptions.RelationalException.

It carries a SQLSTATE-formatted ErrorCode, a human message, and an optional wrapped cause + structured context map. Match with errors.As:

var e *api.Error
if errors.As(err, &e) && e.Code == api.ErrCodeUndefinedTable {
    // handle undefined-table specifically
}

Do NOT string-match on Error() output — the wording is not API.

func AsError

func AsError(err error) *Error

AsError extracts an *Error from the chain, or returns nil if there is none. Convenience around errors.As.

func NewError

func NewError(code ErrorCode, message string) *Error

NewError returns a new Error with the given code and message.

func NewErrorf

func NewErrorf(code ErrorCode, format string, args ...any) *Error

NewErrorf is NewError with fmt.Sprintf formatting.

func WrapError

func WrapError(code ErrorCode, message string, cause error) *Error

WrapError wraps cause with a relational error code and message.

func WrapErrorf

func WrapErrorf(cause error, code ErrorCode, format string, args ...any) *Error

WrapErrorf is WrapError with fmt.Sprintf formatting for the message. Use instead of fmt.Errorf("context: %w", err) at API boundaries so the error carries a SQLSTATE that errors.As can match.

func (*Error) Error

func (e *Error) Error() string

Error renders the error in the form "SQLSTATE: message: cause" with the context fields appended. The wording is informational — callers must not parse it.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped cause, enabling errors.Is / errors.As through the chain.

func (*Error) WithContext

func (e *Error) WithContext(key string, value any) *Error

WithContext returns a copy of e with the given key/value added to the context map. Matches Java's RelationalException.addContext(). The receiver is not mutated.

type ErrorCode

type ErrorCode string

ErrorCode is a 5-character SQLSTATE-formatted error code.

Codes follow SQLSTATE format: first 2 characters are the class, remaining 3 describe the error. Matches Java's com.apple.foundationdb.relational.api.exceptions.ErrorCode enum 1:1 — new codes on either side must be added to both.

Class codes:

00 Success
01 Warning
02 No Data
08 Connection Exception
0A Unsupported Operation
22 Data Exception
23 Integrity Constraint Violation
24 Invalid Cursor State
25 Invalid Transaction State
40 Transaction Rollback
42 Syntax Error or Access Rule Violation
53 Insufficient Resources
54 Program Limit Exceeded
55 Object Not in Prerequisite State
58 System Error
XX Internal Error
const (
	// Class 00 — Successful Completion
	ErrCodeSuccess ErrorCode = "00000"

	// Class 02 — No Data
	ErrCodeNoResultSet ErrorCode = "02F01"

	// Class 08 — Connection Exception
	ErrCodeUnableToEstablishSQLConnection     ErrorCode = "08001"
	ErrCodeConnectionDoesNotExist             ErrorCode = "08003"
	ErrCodeInvalidPath                        ErrorCode = "08F01"
	ErrCodeCannotCommitRollbackWithAutocommit ErrorCode = "08F02"

	// Class 0A — Feature Not Supported
	ErrCodeUnsupportedOperation ErrorCode = "0A000"
	ErrCodeUnsupportedQuery     ErrorCode = "0AF00"
	ErrCodeUnsupportedSort      ErrorCode = "0AF01"

	// Class 21 — Cardinality Violation
	ErrCodeCardinalityViolation ErrorCode = "21000"

	// Class 22 — Data Exception
	ErrCodeCannotConvertType            ErrorCode = "22000"
	ErrCodeNumericValueOutOfRange       ErrorCode = "22003"
	ErrCodeDivisionByZero               ErrorCode = "22012"
	ErrCodeInvalidRowCountInLimitClause ErrorCode = "2201W"
	ErrCodeInvalidParameter             ErrorCode = "22023"
	ErrCodeArrayElementError            ErrorCode = "2202E"
	ErrCodeInvalidBinaryRepresentation  ErrorCode = "22F03"
	ErrCodeInvalidArgumentForFunction   ErrorCode = "22F00"
	ErrCodeInvalidCast                  ErrorCode = "22F3H"
	ErrCodeCopySerializationError       ErrorCode = "22F04"
	ErrCodeCopyImportValidationError    ErrorCode = "22F08"

	// Class 23 — Integrity Constraint Violation
	ErrCodeNotNullViolation          ErrorCode = "23502"
	ErrCodeUniqueConstraintViolation ErrorCode = "23505"

	// Class 24 — Invalid Cursor State
	ErrCodeInvalidCursorState  ErrorCode = "24000"
	ErrCodeInvalidContinuation ErrorCode = "24F00"

	// Class 25 — Invalid Transaction State
	ErrCodeInvalidTransactionState ErrorCode = "25000"
	ErrCodeTransactionInactive     ErrorCode = "25F01"

	// Class 40 — Transaction Rollback
	ErrCodeSerializationFailure ErrorCode = "40001"

	// Class 42 — Syntax Error or Access Rule Violation
	ErrCodeSyntaxOrAccessViolation           ErrorCode = "42000"
	ErrCodeInsufficientPrivilege             ErrorCode = "42501"
	ErrCodeSyntaxError                       ErrorCode = "42601"
	ErrCodeInvalidName                       ErrorCode = "42602"
	ErrCodeColumnAlreadyExists               ErrorCode = "42701"
	ErrCodeAmbiguousColumn                   ErrorCode = "42702"
	ErrCodeUndefinedColumn                   ErrorCode = "42703"
	ErrCodeDuplicateAlias                    ErrorCode = "42712"
	ErrCodeDuplicateFunction                 ErrorCode = "42723"
	ErrCodeGroupingError                     ErrorCode = "42803"
	ErrCodeDatatypeMismatch                  ErrorCode = "42804"
	ErrCodeWrongObjectType                   ErrorCode = "42809"
	ErrCodeUndefinedFunction                 ErrorCode = "42883"
	ErrCodeUndefinedDatabase                 ErrorCode = "42F00"
	ErrCodeUndefinedTable                    ErrorCode = "42F01"
	ErrCodeUndefinedParameter                ErrorCode = "42F02"
	ErrCodeDatabaseAlreadyExists             ErrorCode = "42F04"
	ErrCodeSchemaAlreadyExists               ErrorCode = "42F06"
	ErrCodeTableAlreadyExists                ErrorCode = "42F07"
	ErrCodeInvalidColumnReference            ErrorCode = "42F10"
	ErrCodeInvalidFunctionDefinition         ErrorCode = "42F13"
	ErrCodeInvalidTableDefinition            ErrorCode = "42F16"
	ErrCodeUnknownType                       ErrorCode = "42F18"
	ErrCodeInvalidRecursion                  ErrorCode = "42F19"
	ErrCodeIncompatibleTableAlias            ErrorCode = "42F20"
	ErrCodeWindowingError                    ErrorCode = "42F21"
	ErrCodeSchemaMappingAlreadyExists        ErrorCode = "42F50"
	ErrCodeUndefinedSchema                   ErrorCode = "42F51"
	ErrCodeUndefinedIndex                    ErrorCode = "42F54"
	ErrCodeUnknownSchemaTemplate             ErrorCode = "42F55"
	ErrCodeAnnotationAlreadyExists           ErrorCode = "42F56"
	ErrCodeIndexAlreadyExists                ErrorCode = "42F57"
	ErrCodeIncorrectMetadataTableVersion     ErrorCode = "42F58"
	ErrCodeInvalidSchemaTemplate             ErrorCode = "42F59"
	ErrCodeInvalidPreparedStatementParameter ErrorCode = "42F60"
	ErrCodeExecuteUpdateReturnedResultSet    ErrorCode = "42F61"
	ErrCodeDuplicateSchemaTemplate           ErrorCode = "42F62"
	ErrCodeUnknownDatabase                   ErrorCode = "42F63"
	ErrCodeUnionIncorrectColumnCount         ErrorCode = "42F64"
	ErrCodeUnionIncompatibleColumns          ErrorCode = "42F65"
	ErrCodeInvalidDatabase                   ErrorCode = "42F66"

	// Class 53 — Insufficient Resources
	ErrCodeTransactionTimeout ErrorCode = "53F00"

	// Class 54 — Program Limit Exceeded
	ErrCodeTooManyColumns        ErrorCode = "54011"
	ErrCodeExecutionLimitReached ErrorCode = "54F01"

	// Class 55 — Object Not In Prerequisite State
	ErrCodeStatementClosed ErrorCode = "55F00"

	// Class 58 — System Error
	ErrCodeUndefinedFile ErrorCode = "58F01"

	// Class XX — Internal Error
	ErrCodeUnknown                ErrorCode = "XXXXX"
	ErrCodeInternalError          ErrorCode = "XX000"
	ErrCodeDeserializationFailure ErrorCode = "XXF01"
)

SQLSTATE error codes, matching Java's ErrorCode enum exactly.

func ErrorCodeFromString

func ErrorCodeFromString(s string) ErrorCode

ErrorCodeFromString looks up an ErrorCode by its 5-character SQLSTATE string. Unknown codes return ErrCodeUnknown (matches Java's ErrorCode.get() fallback).

func (ErrorCode) Class

func (c ErrorCode) Class() string

Class returns the 2-character SQLSTATE class prefix (e.g. "42" for syntax errors). Returns empty string if the code is shorter than 2 characters (should never happen for well-formed codes).

func (ErrorCode) String

func (c ErrorCode) String() string

String returns the 5-character SQLSTATE representation.

type FloatType

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

func NewFloatType

func NewFloatType(isNullable bool) *FloatType

func (FloatType) Code

func (b FloatType) Code() Code

func (*FloatType) Equal

func (t *FloatType) Equal(other DataType) bool

func (FloatType) IsNullable

func (b FloatType) IsNullable() bool

func (FloatType) IsPrimitive

func (b FloatType) IsPrimitive() bool

func (*FloatType) IsResolved

func (t *FloatType) IsResolved() bool

func (*FloatType) Resolve

func (t *FloatType) Resolve(_ map[string]Named) DataType

func (*FloatType) String

func (t *FloatType) String() string

func (*FloatType) WithNullable

func (t *FloatType) WithNullable(isNullable bool) DataType

type Index

type Index interface {
	Metadata
	// TableName returns the name of the owning table.
	TableName() string
	// IndexType returns the index-type string (VALUE, COUNT, RANK,
	// VERSION, TEXT, VECTOR, ...). Matches Java IndexTypes constants.
	IndexType() string
	// IsUnique reports whether the index rejects duplicate entries.
	IsUnique() bool
	// IsSparse reports whether the index skips rows where the
	// expression evaluates to null.
	IsSparse() bool
}

Index is a secondary index metadata. Mirrors Java's Index.

IndexType is represented as a string here because Java does the same (it references string constants from com.apple.foundationdb.record.metadata.IndexTypes). When we port IndexTypes to a Go enum we will update this interface accordingly.

type IndexFetchMethod

type IndexFetchMethod int

IndexFetchMethod mirrors Java's Options.IndexFetchMethod enum.

const (
	IndexFetchScanAndFetch IndexFetchMethod = iota
	IndexFetchUseRemoteFetch
	IndexFetchUseRemoteFetchWithFallback
)

func (IndexFetchMethod) String

func (m IndexFetchMethod) String() string

String returns the enum name matching Java.

type IntegerType

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

func NewIntegerType

func NewIntegerType(isNullable bool) *IntegerType

func (IntegerType) Code

func (b IntegerType) Code() Code

func (*IntegerType) Equal

func (t *IntegerType) Equal(other DataType) bool

func (IntegerType) IsNullable

func (b IntegerType) IsNullable() bool

func (IntegerType) IsPrimitive

func (b IntegerType) IsPrimitive() bool

func (*IntegerType) IsResolved

func (t *IntegerType) IsResolved() bool

func (*IntegerType) Resolve

func (t *IntegerType) Resolve(_ map[string]Named) DataType

func (*IntegerType) String

func (t *IntegerType) String() string

func (*IntegerType) WithNullable

func (t *IntegerType) WithNullable(isNullable bool) DataType

type InvokedRoutine

type InvokedRoutine interface {
	Metadata
}

InvokedRoutine is a stored routine (function / procedure). Mirrors Java's InvokedRoutine. Minimal today.

type KeySet

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

KeySet names a set of key-column bindings used by the direct-access API to identify a row. Mirrors Java's com.apple.foundationdb.relational.api.KeySet.

KeySet is **mutable**. `SetKeyColumn` and `SetKeyColumns` update the receiver in place and return it for chaining, not a new value. The returned pointer is always the same as the receiver on success — this matches Java's `return this` idiom. `EmptyKeySet()` returns an immutable singleton; calling `SetKey*` on it returns an error and does not produce a new mutable copy.

If you need copy-on-write semantics, construct a fresh `NewKeySet()` and populate it.

func EmptyKeySet

func EmptyKeySet() *KeySet

EmptyKeySet returns the immutable empty KeySet (matches Java's KeySet.EMPTY).

func NewKeySet

func NewKeySet() *KeySet

NewKeySet returns an empty, mutable KeySet.

func (*KeySet) NumColumns

func (k *KeySet) NumColumns() int

NumColumns returns the number of bound columns without allocating.

func (*KeySet) SetKeyColumn

func (k *KeySet) SetKeyColumn(columnName string, value any) (*KeySet, error)

SetKeyColumn sets columnName=value, returning the receiver for chaining. Returns ErrCodeUnsupportedOperation if the receiver is frozen (i.e. the EmptyKeySet sentinel).

func (*KeySet) SetKeyColumns

func (k *KeySet) SetKeyColumns(keyMap map[string]any) (*KeySet, error)

SetKeyColumns merges keyMap into the receiver. Returns ErrCodeUnsupportedOperation on a frozen KeySet.

func (*KeySet) ToMap

func (k *KeySet) ToMap() map[string]any

ToMap returns a read-only copy of the column bindings. Mutating the returned map does not affect the KeySet.

type LongType

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

func NewLongType

func NewLongType(isNullable bool) *LongType

func (LongType) Code

func (b LongType) Code() Code

func (*LongType) Equal

func (t *LongType) Equal(other DataType) bool

func (LongType) IsNullable

func (b LongType) IsNullable() bool

func (LongType) IsPrimitive

func (b LongType) IsPrimitive() bool

func (*LongType) IsResolved

func (t *LongType) IsResolved() bool

func (*LongType) Resolve

func (t *LongType) Resolve(_ map[string]Named) DataType

func (*LongType) String

func (t *LongType) String() string

func (*LongType) WithNullable

func (t *LongType) WithNullable(isNullable bool) DataType

type Metadata

type Metadata interface {
	// MetadataName returns the node's own name. Named "MetadataName"
	// rather than "Name" so embeddings keep Name() free for other
	// uses (e.g. ColumnName() on Column).
	MetadataName() string
	// Accept dispatches through the given Visitor. Implementations
	// should call the appropriate v.Visit* method for their type
	// and (for composite nodes) recurse into children.
	Accept(v Visitor)
}

Metadata is the base interface for every relational metadata node (Table, Column, Index, Schema, SchemaTemplate, View, InvokedRoutine). Mirrors Java's com.apple.foundationdb.relational.api.metadata.Metadata.

type MockColumn

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

MockColumn is a mock of Column interface.

func NewMockColumn

func NewMockColumn(ctrl *gomock.Controller) *MockColumn

NewMockColumn creates a new mock instance.

func (*MockColumn) Accept

func (m *MockColumn) Accept(v Visitor)

Accept mocks base method.

func (*MockColumn) DataType

func (m *MockColumn) DataType() DataType

DataType mocks base method.

func (*MockColumn) EXPECT

func (m *MockColumn) EXPECT() *MockColumnMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockColumn) MetadataName

func (m *MockColumn) MetadataName() string

MetadataName mocks base method.

type MockColumnMockRecorder

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

MockColumnMockRecorder is the mock recorder for MockColumn.

func (*MockColumnMockRecorder) Accept

func (mr *MockColumnMockRecorder) Accept(v any) *gomock.Call

Accept indicates an expected call of Accept.

func (*MockColumnMockRecorder) DataType

func (mr *MockColumnMockRecorder) DataType() *gomock.Call

DataType indicates an expected call of DataType.

func (*MockColumnMockRecorder) MetadataName

func (mr *MockColumnMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

type MockIndex

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

MockIndex is a mock of Index interface.

func NewMockIndex

func NewMockIndex(ctrl *gomock.Controller) *MockIndex

NewMockIndex creates a new mock instance.

func (*MockIndex) Accept

func (m *MockIndex) Accept(v Visitor)

Accept mocks base method.

func (*MockIndex) EXPECT

func (m *MockIndex) EXPECT() *MockIndexMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIndex) IndexType

func (m *MockIndex) IndexType() string

IndexType mocks base method.

func (*MockIndex) IsSparse

func (m *MockIndex) IsSparse() bool

IsSparse mocks base method.

func (*MockIndex) IsUnique

func (m *MockIndex) IsUnique() bool

IsUnique mocks base method.

func (*MockIndex) MetadataName

func (m *MockIndex) MetadataName() string

MetadataName mocks base method.

func (*MockIndex) TableName

func (m *MockIndex) TableName() string

TableName mocks base method.

type MockIndexMockRecorder

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

MockIndexMockRecorder is the mock recorder for MockIndex.

func (*MockIndexMockRecorder) Accept

func (mr *MockIndexMockRecorder) Accept(v any) *gomock.Call

Accept indicates an expected call of Accept.

func (*MockIndexMockRecorder) IndexType

func (mr *MockIndexMockRecorder) IndexType() *gomock.Call

IndexType indicates an expected call of IndexType.

func (*MockIndexMockRecorder) IsSparse

func (mr *MockIndexMockRecorder) IsSparse() *gomock.Call

IsSparse indicates an expected call of IsSparse.

func (*MockIndexMockRecorder) IsUnique

func (mr *MockIndexMockRecorder) IsUnique() *gomock.Call

IsUnique indicates an expected call of IsUnique.

func (*MockIndexMockRecorder) MetadataName

func (mr *MockIndexMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

func (*MockIndexMockRecorder) TableName

func (mr *MockIndexMockRecorder) TableName() *gomock.Call

TableName indicates an expected call of TableName.

type MockInvokedRoutine

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

MockInvokedRoutine is a mock of InvokedRoutine interface.

func NewMockInvokedRoutine

func NewMockInvokedRoutine(ctrl *gomock.Controller) *MockInvokedRoutine

NewMockInvokedRoutine creates a new mock instance.

func (*MockInvokedRoutine) Accept

func (m *MockInvokedRoutine) Accept(v Visitor)

Accept mocks base method.

func (*MockInvokedRoutine) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockInvokedRoutine) MetadataName

func (m *MockInvokedRoutine) MetadataName() string

MetadataName mocks base method.

type MockInvokedRoutineMockRecorder

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

MockInvokedRoutineMockRecorder is the mock recorder for MockInvokedRoutine.

func (*MockInvokedRoutineMockRecorder) Accept

Accept indicates an expected call of Accept.

func (*MockInvokedRoutineMockRecorder) MetadataName

func (mr *MockInvokedRoutineMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

type MockMetadata

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

MockMetadata is a mock of Metadata interface.

func NewMockMetadata

func NewMockMetadata(ctrl *gomock.Controller) *MockMetadata

NewMockMetadata creates a new mock instance.

func (*MockMetadata) Accept

func (m *MockMetadata) Accept(v Visitor)

Accept mocks base method.

func (*MockMetadata) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockMetadata) MetadataName

func (m *MockMetadata) MetadataName() string

MetadataName mocks base method.

type MockMetadataMockRecorder

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

MockMetadataMockRecorder is the mock recorder for MockMetadata.

func (*MockMetadataMockRecorder) Accept

func (mr *MockMetadataMockRecorder) Accept(v any) *gomock.Call

Accept indicates an expected call of Accept.

func (*MockMetadataMockRecorder) MetadataName

func (mr *MockMetadataMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

type MockResultSet

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

MockResultSet is a mock of ResultSet interface.

func NewMockResultSet

func NewMockResultSet(ctrl *gomock.Controller) *MockResultSet

NewMockResultSet creates a new mock instance.

func (*MockResultSet) Boolean

func (m *MockResultSet) Boolean(columnIndex int) (bool, error)

Boolean mocks base method.

func (*MockResultSet) BooleanByName

func (m *MockResultSet) BooleanByName(columnName string) (bool, error)

BooleanByName mocks base method.

func (*MockResultSet) Bytes

func (m *MockResultSet) Bytes(columnIndex int) ([]byte, error)

Bytes mocks base method.

func (*MockResultSet) BytesByName

func (m *MockResultSet) BytesByName(columnName string) ([]byte, error)

BytesByName mocks base method.

func (*MockResultSet) Close

func (m *MockResultSet) Close() error

Close mocks base method.

func (*MockResultSet) Continuation

func (m *MockResultSet) Continuation() (Continuation, error)

Continuation mocks base method.

func (*MockResultSet) Double

func (m *MockResultSet) Double(columnIndex int) (float64, error)

Double mocks base method.

func (*MockResultSet) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockResultSet) Err

func (m *MockResultSet) Err() error

Err mocks base method.

func (*MockResultSet) Float

func (m *MockResultSet) Float(columnIndex int) (float32, error)

Float mocks base method.

func (*MockResultSet) Long

func (m *MockResultSet) Long(columnIndex int) (int64, error)

Long mocks base method.

func (*MockResultSet) LongByName

func (m *MockResultSet) LongByName(columnName string) (int64, error)

LongByName mocks base method.

func (*MockResultSet) MetaData

func (m *MockResultSet) MetaData() ResultSetMetaData

MetaData mocks base method.

func (*MockResultSet) Next

func (m *MockResultSet) Next() bool

Next mocks base method.

func (*MockResultSet) Object

func (m *MockResultSet) Object(columnIndex int) (any, error)

Object mocks base method.

func (*MockResultSet) ObjectByName

func (m *MockResultSet) ObjectByName(columnName string) (any, error)

ObjectByName mocks base method.

func (*MockResultSet) String

func (m *MockResultSet) String(columnIndex int) (string, error)

String mocks base method.

func (*MockResultSet) StringByName

func (m *MockResultSet) StringByName(columnName string) (string, error)

StringByName mocks base method.

func (*MockResultSet) WasNull

func (m *MockResultSet) WasNull() bool

WasNull mocks base method.

type MockResultSetMetaData

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

MockResultSetMetaData is a mock of ResultSetMetaData interface.

func NewMockResultSetMetaData

func NewMockResultSetMetaData(ctrl *gomock.Controller) *MockResultSetMetaData

NewMockResultSetMetaData creates a new mock instance.

func (*MockResultSetMetaData) ColumnCount

func (m *MockResultSetMetaData) ColumnCount() int

ColumnCount mocks base method.

func (*MockResultSetMetaData) ColumnDataType

func (m *MockResultSetMetaData) ColumnDataType(columnIndex int) (DataType, error)

ColumnDataType mocks base method.

func (*MockResultSetMetaData) ColumnLabel

func (m *MockResultSetMetaData) ColumnLabel(columnIndex int) (string, error)

ColumnLabel mocks base method.

func (*MockResultSetMetaData) ColumnName

func (m *MockResultSetMetaData) ColumnName(columnIndex int) (string, error)

ColumnName mocks base method.

func (*MockResultSetMetaData) ColumnNullable

func (m *MockResultSetMetaData) ColumnNullable(columnIndex int) (int, error)

ColumnNullable mocks base method.

func (*MockResultSetMetaData) ColumnType

func (m *MockResultSetMetaData) ColumnType(columnIndex int) (int, error)

ColumnType mocks base method.

func (*MockResultSetMetaData) ColumnTypeName

func (m *MockResultSetMetaData) ColumnTypeName(columnIndex int) (string, error)

ColumnTypeName mocks base method.

func (*MockResultSetMetaData) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockResultSetMetaDataMockRecorder

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

MockResultSetMetaDataMockRecorder is the mock recorder for MockResultSetMetaData.

func (*MockResultSetMetaDataMockRecorder) ColumnCount

func (mr *MockResultSetMetaDataMockRecorder) ColumnCount() *gomock.Call

ColumnCount indicates an expected call of ColumnCount.

func (*MockResultSetMetaDataMockRecorder) ColumnDataType

func (mr *MockResultSetMetaDataMockRecorder) ColumnDataType(columnIndex any) *gomock.Call

ColumnDataType indicates an expected call of ColumnDataType.

func (*MockResultSetMetaDataMockRecorder) ColumnLabel

func (mr *MockResultSetMetaDataMockRecorder) ColumnLabel(columnIndex any) *gomock.Call

ColumnLabel indicates an expected call of ColumnLabel.

func (*MockResultSetMetaDataMockRecorder) ColumnName

func (mr *MockResultSetMetaDataMockRecorder) ColumnName(columnIndex any) *gomock.Call

ColumnName indicates an expected call of ColumnName.

func (*MockResultSetMetaDataMockRecorder) ColumnNullable

func (mr *MockResultSetMetaDataMockRecorder) ColumnNullable(columnIndex any) *gomock.Call

ColumnNullable indicates an expected call of ColumnNullable.

func (*MockResultSetMetaDataMockRecorder) ColumnType

func (mr *MockResultSetMetaDataMockRecorder) ColumnType(columnIndex any) *gomock.Call

ColumnType indicates an expected call of ColumnType.

func (*MockResultSetMetaDataMockRecorder) ColumnTypeName

func (mr *MockResultSetMetaDataMockRecorder) ColumnTypeName(columnIndex any) *gomock.Call

ColumnTypeName indicates an expected call of ColumnTypeName.

type MockResultSetMockRecorder

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

MockResultSetMockRecorder is the mock recorder for MockResultSet.

func (*MockResultSetMockRecorder) Boolean

func (mr *MockResultSetMockRecorder) Boolean(columnIndex any) *gomock.Call

Boolean indicates an expected call of Boolean.

func (*MockResultSetMockRecorder) BooleanByName

func (mr *MockResultSetMockRecorder) BooleanByName(columnName any) *gomock.Call

BooleanByName indicates an expected call of BooleanByName.

func (*MockResultSetMockRecorder) Bytes

func (mr *MockResultSetMockRecorder) Bytes(columnIndex any) *gomock.Call

Bytes indicates an expected call of Bytes.

func (*MockResultSetMockRecorder) BytesByName

func (mr *MockResultSetMockRecorder) BytesByName(columnName any) *gomock.Call

BytesByName indicates an expected call of BytesByName.

func (*MockResultSetMockRecorder) Close

func (mr *MockResultSetMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockResultSetMockRecorder) Continuation

func (mr *MockResultSetMockRecorder) Continuation() *gomock.Call

Continuation indicates an expected call of Continuation.

func (*MockResultSetMockRecorder) Double

func (mr *MockResultSetMockRecorder) Double(columnIndex any) *gomock.Call

Double indicates an expected call of Double.

func (*MockResultSetMockRecorder) Err

Err indicates an expected call of Err.

func (*MockResultSetMockRecorder) Float

func (mr *MockResultSetMockRecorder) Float(columnIndex any) *gomock.Call

Float indicates an expected call of Float.

func (*MockResultSetMockRecorder) Long

func (mr *MockResultSetMockRecorder) Long(columnIndex any) *gomock.Call

Long indicates an expected call of Long.

func (*MockResultSetMockRecorder) LongByName

func (mr *MockResultSetMockRecorder) LongByName(columnName any) *gomock.Call

LongByName indicates an expected call of LongByName.

func (*MockResultSetMockRecorder) MetaData

func (mr *MockResultSetMockRecorder) MetaData() *gomock.Call

MetaData indicates an expected call of MetaData.

func (*MockResultSetMockRecorder) Next

Next indicates an expected call of Next.

func (*MockResultSetMockRecorder) Object

func (mr *MockResultSetMockRecorder) Object(columnIndex any) *gomock.Call

Object indicates an expected call of Object.

func (*MockResultSetMockRecorder) ObjectByName

func (mr *MockResultSetMockRecorder) ObjectByName(columnName any) *gomock.Call

ObjectByName indicates an expected call of ObjectByName.

func (*MockResultSetMockRecorder) String

func (mr *MockResultSetMockRecorder) String(columnIndex any) *gomock.Call

String indicates an expected call of String.

func (*MockResultSetMockRecorder) StringByName

func (mr *MockResultSetMockRecorder) StringByName(columnName any) *gomock.Call

StringByName indicates an expected call of StringByName.

func (*MockResultSetMockRecorder) WasNull

func (mr *MockResultSetMockRecorder) WasNull() *gomock.Call

WasNull indicates an expected call of WasNull.

type MockSchema

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

MockSchema is a mock of Schema interface.

func NewMockSchema

func NewMockSchema(ctrl *gomock.Controller) *MockSchema

NewMockSchema creates a new mock instance.

func (*MockSchema) Accept

func (m *MockSchema) Accept(v Visitor)

Accept mocks base method.

func (*MockSchema) DatabaseName

func (m *MockSchema) DatabaseName() string

DatabaseName mocks base method.

func (*MockSchema) EXPECT

func (m *MockSchema) EXPECT() *MockSchemaMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSchema) Indexes

func (m *MockSchema) Indexes() (map[string][]string, error)

Indexes mocks base method.

func (*MockSchema) InvokedRoutines

func (m *MockSchema) InvokedRoutines() ([]InvokedRoutine, error)

InvokedRoutines mocks base method.

func (*MockSchema) MetadataName

func (m *MockSchema) MetadataName() string

MetadataName mocks base method.

func (*MockSchema) SchemaTemplate

func (m *MockSchema) SchemaTemplate() SchemaTemplate

SchemaTemplate mocks base method.

func (*MockSchema) Tables

func (m *MockSchema) Tables() ([]Table, error)

Tables mocks base method.

func (*MockSchema) Views

func (m *MockSchema) Views() ([]View, error)

Views mocks base method.

type MockSchemaMockRecorder

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

MockSchemaMockRecorder is the mock recorder for MockSchema.

func (*MockSchemaMockRecorder) Accept

func (mr *MockSchemaMockRecorder) Accept(v any) *gomock.Call

Accept indicates an expected call of Accept.

func (*MockSchemaMockRecorder) DatabaseName

func (mr *MockSchemaMockRecorder) DatabaseName() *gomock.Call

DatabaseName indicates an expected call of DatabaseName.

func (*MockSchemaMockRecorder) Indexes

func (mr *MockSchemaMockRecorder) Indexes() *gomock.Call

Indexes indicates an expected call of Indexes.

func (*MockSchemaMockRecorder) InvokedRoutines

func (mr *MockSchemaMockRecorder) InvokedRoutines() *gomock.Call

InvokedRoutines indicates an expected call of InvokedRoutines.

func (*MockSchemaMockRecorder) MetadataName

func (mr *MockSchemaMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

func (*MockSchemaMockRecorder) SchemaTemplate

func (mr *MockSchemaMockRecorder) SchemaTemplate() *gomock.Call

SchemaTemplate indicates an expected call of SchemaTemplate.

func (*MockSchemaMockRecorder) Tables

func (mr *MockSchemaMockRecorder) Tables() *gomock.Call

Tables indicates an expected call of Tables.

func (*MockSchemaMockRecorder) Views

func (mr *MockSchemaMockRecorder) Views() *gomock.Call

Views indicates an expected call of Views.

type MockSchemaTemplate

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

MockSchemaTemplate is a mock of SchemaTemplate interface.

func NewMockSchemaTemplate

func NewMockSchemaTemplate(ctrl *gomock.Controller) *MockSchemaTemplate

NewMockSchemaTemplate creates a new mock instance.

func (*MockSchemaTemplate) Accept

func (m *MockSchemaTemplate) Accept(v Visitor)

Accept mocks base method.

func (*MockSchemaTemplate) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSchemaTemplate) EnableLongRows

func (m *MockSchemaTemplate) EnableLongRows() bool

EnableLongRows mocks base method.

func (*MockSchemaTemplate) FindInvokedRoutine

func (m *MockSchemaTemplate) FindInvokedRoutine(name string) (InvokedRoutine, error)

FindInvokedRoutine mocks base method.

func (*MockSchemaTemplate) FindTable

func (m *MockSchemaTemplate) FindTable(name string) (Table, error)

FindTable mocks base method.

func (*MockSchemaTemplate) FindView

func (m *MockSchemaTemplate) FindView(name string) (View, error)

FindView mocks base method.

func (*MockSchemaTemplate) GenerateSchema

func (m *MockSchemaTemplate) GenerateSchema(databaseID, schemaName string) Schema

GenerateSchema mocks base method.

func (*MockSchemaTemplate) Indexes

func (m *MockSchemaTemplate) Indexes() ([]string, error)

Indexes mocks base method.

func (*MockSchemaTemplate) IntermingleTables

func (m *MockSchemaTemplate) IntermingleTables() bool

IntermingleTables mocks base method.

func (*MockSchemaTemplate) InvokedRoutines

func (m *MockSchemaTemplate) InvokedRoutines() ([]InvokedRoutine, error)

InvokedRoutines mocks base method.

func (*MockSchemaTemplate) MetadataName

func (m *MockSchemaTemplate) MetadataName() string

MetadataName mocks base method.

func (*MockSchemaTemplate) StoreRowVersions

func (m *MockSchemaTemplate) StoreRowVersions() bool

StoreRowVersions mocks base method.

func (*MockSchemaTemplate) TableIndexMapping

func (m *MockSchemaTemplate) TableIndexMapping() (map[string][]string, error)

TableIndexMapping mocks base method.

func (*MockSchemaTemplate) Tables

func (m *MockSchemaTemplate) Tables() ([]Table, error)

Tables mocks base method.

func (*MockSchemaTemplate) TemporaryInvokedRoutines

func (m *MockSchemaTemplate) TemporaryInvokedRoutines() ([]InvokedRoutine, error)

TemporaryInvokedRoutines mocks base method.

func (*MockSchemaTemplate) TransactionBoundMetadataAsString

func (m *MockSchemaTemplate) TransactionBoundMetadataAsString() (string, error)

TransactionBoundMetadataAsString mocks base method.

func (*MockSchemaTemplate) Version

func (m *MockSchemaTemplate) Version() int

Version mocks base method.

func (*MockSchemaTemplate) Views

func (m *MockSchemaTemplate) Views() ([]View, error)

Views mocks base method.

type MockSchemaTemplateMockRecorder

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

MockSchemaTemplateMockRecorder is the mock recorder for MockSchemaTemplate.

func (*MockSchemaTemplateMockRecorder) Accept

Accept indicates an expected call of Accept.

func (*MockSchemaTemplateMockRecorder) EnableLongRows

func (mr *MockSchemaTemplateMockRecorder) EnableLongRows() *gomock.Call

EnableLongRows indicates an expected call of EnableLongRows.

func (*MockSchemaTemplateMockRecorder) FindInvokedRoutine

func (mr *MockSchemaTemplateMockRecorder) FindInvokedRoutine(name any) *gomock.Call

FindInvokedRoutine indicates an expected call of FindInvokedRoutine.

func (*MockSchemaTemplateMockRecorder) FindTable

func (mr *MockSchemaTemplateMockRecorder) FindTable(name any) *gomock.Call

FindTable indicates an expected call of FindTable.

func (*MockSchemaTemplateMockRecorder) FindView

func (mr *MockSchemaTemplateMockRecorder) FindView(name any) *gomock.Call

FindView indicates an expected call of FindView.

func (*MockSchemaTemplateMockRecorder) GenerateSchema

func (mr *MockSchemaTemplateMockRecorder) GenerateSchema(databaseID, schemaName any) *gomock.Call

GenerateSchema indicates an expected call of GenerateSchema.

func (*MockSchemaTemplateMockRecorder) Indexes

Indexes indicates an expected call of Indexes.

func (*MockSchemaTemplateMockRecorder) IntermingleTables

func (mr *MockSchemaTemplateMockRecorder) IntermingleTables() *gomock.Call

IntermingleTables indicates an expected call of IntermingleTables.

func (*MockSchemaTemplateMockRecorder) InvokedRoutines

func (mr *MockSchemaTemplateMockRecorder) InvokedRoutines() *gomock.Call

InvokedRoutines indicates an expected call of InvokedRoutines.

func (*MockSchemaTemplateMockRecorder) MetadataName

func (mr *MockSchemaTemplateMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

func (*MockSchemaTemplateMockRecorder) StoreRowVersions

func (mr *MockSchemaTemplateMockRecorder) StoreRowVersions() *gomock.Call

StoreRowVersions indicates an expected call of StoreRowVersions.

func (*MockSchemaTemplateMockRecorder) TableIndexMapping

func (mr *MockSchemaTemplateMockRecorder) TableIndexMapping() *gomock.Call

TableIndexMapping indicates an expected call of TableIndexMapping.

func (*MockSchemaTemplateMockRecorder) Tables

Tables indicates an expected call of Tables.

func (*MockSchemaTemplateMockRecorder) TemporaryInvokedRoutines

func (mr *MockSchemaTemplateMockRecorder) TemporaryInvokedRoutines() *gomock.Call

TemporaryInvokedRoutines indicates an expected call of TemporaryInvokedRoutines.

func (*MockSchemaTemplateMockRecorder) TransactionBoundMetadataAsString

func (mr *MockSchemaTemplateMockRecorder) TransactionBoundMetadataAsString() *gomock.Call

TransactionBoundMetadataAsString indicates an expected call of TransactionBoundMetadataAsString.

func (*MockSchemaTemplateMockRecorder) Version

Version indicates an expected call of Version.

func (*MockSchemaTemplateMockRecorder) Views

Views indicates an expected call of Views.

type MockTable

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

MockTable is a mock of Table interface.

func NewMockTable

func NewMockTable(ctrl *gomock.Controller) *MockTable

NewMockTable creates a new mock instance.

func (*MockTable) Accept

func (m *MockTable) Accept(v Visitor)

Accept mocks base method.

func (*MockTable) Columns

func (m *MockTable) Columns() []Column

Columns mocks base method.

func (*MockTable) EXPECT

func (m *MockTable) EXPECT() *MockTableMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTable) Indexes

func (m *MockTable) Indexes() []Index

Indexes mocks base method.

func (*MockTable) MetadataName

func (m *MockTable) MetadataName() string

MetadataName mocks base method.

func (*MockTable) StructDataType

func (m *MockTable) StructDataType() *StructType

StructDataType mocks base method.

type MockTableMockRecorder

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

MockTableMockRecorder is the mock recorder for MockTable.

func (*MockTableMockRecorder) Accept

func (mr *MockTableMockRecorder) Accept(v any) *gomock.Call

Accept indicates an expected call of Accept.

func (*MockTableMockRecorder) Columns

func (mr *MockTableMockRecorder) Columns() *gomock.Call

Columns indicates an expected call of Columns.

func (*MockTableMockRecorder) Indexes

func (mr *MockTableMockRecorder) Indexes() *gomock.Call

Indexes indicates an expected call of Indexes.

func (*MockTableMockRecorder) MetadataName

func (mr *MockTableMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

func (*MockTableMockRecorder) StructDataType

func (mr *MockTableMockRecorder) StructDataType() *gomock.Call

StructDataType indicates an expected call of StructDataType.

type MockTransaction

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

MockTransaction is a mock of Transaction interface.

func NewMockTransaction

func NewMockTransaction(ctrl *gomock.Controller) *MockTransaction

NewMockTransaction creates a new mock instance.

func (*MockTransaction) Abort

func (m *MockTransaction) Abort() error

Abort mocks base method.

func (*MockTransaction) BoundSchemaTemplate

func (m *MockTransaction) BoundSchemaTemplate() SchemaTemplate

BoundSchemaTemplate mocks base method.

func (*MockTransaction) Close

func (m *MockTransaction) Close() error

Close mocks base method.

func (*MockTransaction) Commit

func (m *MockTransaction) Commit() error

Commit mocks base method.

func (*MockTransaction) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockTransaction) IsClosed

func (m *MockTransaction) IsClosed() bool

IsClosed mocks base method.

func (*MockTransaction) SetBoundSchemaTemplate

func (m *MockTransaction) SetBoundSchemaTemplate(template SchemaTemplate)

SetBoundSchemaTemplate mocks base method.

func (*MockTransaction) UnsetBoundSchemaTemplate

func (m *MockTransaction) UnsetBoundSchemaTemplate()

UnsetBoundSchemaTemplate mocks base method.

func (*MockTransaction) Unwrap

func (m *MockTransaction) Unwrap() any

Unwrap mocks base method.

type MockTransactionMockRecorder

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

MockTransactionMockRecorder is the mock recorder for MockTransaction.

func (*MockTransactionMockRecorder) Abort

Abort indicates an expected call of Abort.

func (*MockTransactionMockRecorder) BoundSchemaTemplate

func (mr *MockTransactionMockRecorder) BoundSchemaTemplate() *gomock.Call

BoundSchemaTemplate indicates an expected call of BoundSchemaTemplate.

func (*MockTransactionMockRecorder) Close

Close indicates an expected call of Close.

func (*MockTransactionMockRecorder) Commit

func (mr *MockTransactionMockRecorder) Commit() *gomock.Call

Commit indicates an expected call of Commit.

func (*MockTransactionMockRecorder) IsClosed

func (mr *MockTransactionMockRecorder) IsClosed() *gomock.Call

IsClosed indicates an expected call of IsClosed.

func (*MockTransactionMockRecorder) SetBoundSchemaTemplate

func (mr *MockTransactionMockRecorder) SetBoundSchemaTemplate(template any) *gomock.Call

SetBoundSchemaTemplate indicates an expected call of SetBoundSchemaTemplate.

func (*MockTransactionMockRecorder) UnsetBoundSchemaTemplate

func (mr *MockTransactionMockRecorder) UnsetBoundSchemaTemplate() *gomock.Call

UnsetBoundSchemaTemplate indicates an expected call of UnsetBoundSchemaTemplate.

func (*MockTransactionMockRecorder) Unwrap

func (mr *MockTransactionMockRecorder) Unwrap() *gomock.Call

Unwrap indicates an expected call of Unwrap.

type MockView

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

MockView is a mock of View interface.

func NewMockView

func NewMockView(ctrl *gomock.Controller) *MockView

NewMockView creates a new mock instance.

func (*MockView) Accept

func (m *MockView) Accept(v Visitor)

Accept mocks base method.

func (*MockView) EXPECT

func (m *MockView) EXPECT() *MockViewMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockView) MetadataName

func (m *MockView) MetadataName() string

MetadataName mocks base method.

type MockViewMockRecorder

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

MockViewMockRecorder is the mock recorder for MockView.

func (*MockViewMockRecorder) Accept

func (mr *MockViewMockRecorder) Accept(v any) *gomock.Call

Accept indicates an expected call of Accept.

func (*MockViewMockRecorder) MetadataName

func (mr *MockViewMockRecorder) MetadataName() *gomock.Call

MetadataName indicates an expected call of MetadataName.

type MockVisitor

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

MockVisitor is a mock of Visitor interface.

func NewMockVisitor

func NewMockVisitor(ctrl *gomock.Controller) *MockVisitor

NewMockVisitor creates a new mock instance.

func (*MockVisitor) EXPECT

func (m *MockVisitor) EXPECT() *MockVisitorMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockVisitor) FinishVisitSchemaTemplate

func (m *MockVisitor) FinishVisitSchemaTemplate(s SchemaTemplate)

FinishVisitSchemaTemplate mocks base method.

func (*MockVisitor) StartVisitSchemaTemplate

func (m *MockVisitor) StartVisitSchemaTemplate(s SchemaTemplate)

StartVisitSchemaTemplate mocks base method.

func (*MockVisitor) VisitColumn

func (m *MockVisitor) VisitColumn(c Column)

VisitColumn mocks base method.

func (*MockVisitor) VisitIndex

func (m *MockVisitor) VisitIndex(i Index)

VisitIndex mocks base method.

func (*MockVisitor) VisitInvokedRoutine

func (m *MockVisitor) VisitInvokedRoutine(r InvokedRoutine)

VisitInvokedRoutine mocks base method.

func (*MockVisitor) VisitSchema

func (m *MockVisitor) VisitSchema(s Schema)

VisitSchema mocks base method.

func (*MockVisitor) VisitSchemaTemplate

func (m *MockVisitor) VisitSchemaTemplate(s SchemaTemplate)

VisitSchemaTemplate mocks base method.

func (*MockVisitor) VisitTable

func (m *MockVisitor) VisitTable(t Table)

VisitTable mocks base method.

func (*MockVisitor) VisitView

func (m *MockVisitor) VisitView(v View)

VisitView mocks base method.

type MockVisitorMockRecorder

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

MockVisitorMockRecorder is the mock recorder for MockVisitor.

func (*MockVisitorMockRecorder) FinishVisitSchemaTemplate

func (mr *MockVisitorMockRecorder) FinishVisitSchemaTemplate(s any) *gomock.Call

FinishVisitSchemaTemplate indicates an expected call of FinishVisitSchemaTemplate.

func (*MockVisitorMockRecorder) StartVisitSchemaTemplate

func (mr *MockVisitorMockRecorder) StartVisitSchemaTemplate(s any) *gomock.Call

StartVisitSchemaTemplate indicates an expected call of StartVisitSchemaTemplate.

func (*MockVisitorMockRecorder) VisitColumn

func (mr *MockVisitorMockRecorder) VisitColumn(c any) *gomock.Call

VisitColumn indicates an expected call of VisitColumn.

func (*MockVisitorMockRecorder) VisitIndex

func (mr *MockVisitorMockRecorder) VisitIndex(i any) *gomock.Call

VisitIndex indicates an expected call of VisitIndex.

func (*MockVisitorMockRecorder) VisitInvokedRoutine

func (mr *MockVisitorMockRecorder) VisitInvokedRoutine(r any) *gomock.Call

VisitInvokedRoutine indicates an expected call of VisitInvokedRoutine.

func (*MockVisitorMockRecorder) VisitSchema

func (mr *MockVisitorMockRecorder) VisitSchema(s any) *gomock.Call

VisitSchema indicates an expected call of VisitSchema.

func (*MockVisitorMockRecorder) VisitSchemaTemplate

func (mr *MockVisitorMockRecorder) VisitSchemaTemplate(s any) *gomock.Call

VisitSchemaTemplate indicates an expected call of VisitSchemaTemplate.

func (*MockVisitorMockRecorder) VisitTable

func (mr *MockVisitorMockRecorder) VisitTable(t any) *gomock.Call

VisitTable indicates an expected call of VisitTable.

func (*MockVisitorMockRecorder) VisitView

func (mr *MockVisitorMockRecorder) VisitView(v any) *gomock.Call

VisitView indicates an expected call of VisitView.

type Named

type Named interface {
	Name() string
}

Named is a DataType that carries a user-visible name (EnumType, StructType, UnresolvedType).

type NullType

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

func NewNullType

func NewNullType() *NullType

NewNullType returns the singleton NULL type.

func (NullType) Code

func (b NullType) Code() Code

func (*NullType) Equal

func (*NullType) Equal(other DataType) bool

Equal: NullType is a singleton (NewNullType returns the same pointer every time, WithNullable(false) panics). Type assertion is the only condition needed — any *NullType is the singleton, so the previous `o.isNullable == t.isNullable` check was unreachable dead code (always `true == true`). Pin the singleton invariant in the test instead.

func (NullType) IsNullable

func (b NullType) IsNullable() bool

func (NullType) IsPrimitive

func (b NullType) IsPrimitive() bool

func (*NullType) IsResolved

func (t *NullType) IsResolved() bool

func (*NullType) Resolve

func (t *NullType) Resolve(_ map[string]Named) DataType

func (*NullType) String

func (t *NullType) String() string

func (*NullType) WithNullable

func (t *NullType) WithNullable(isNullable bool) DataType

WithNullable panics on false — NULL is always nullable. Matches Java's behavior of throwing INTERNAL_ERROR.

type OptionName

type OptionName string

OptionName is the name of a relational option. String-backed to match Java's Options.Name enum; values MUST match Java exactly so DSN query parameters and properties are wire-compatible.

const (
	OptContinuation OptionName = "CONTINUATION"
	OptIndexHint    OptionName = "INDEX_HINT"
	OptMaxRows      OptionName = "MAX_ROWS"
	// OptMaxStatementMemoryBytes is the statement-wide memory byte budget
	// (RFC-130). It bounds the in-memory buffering operators (NLJ inner, UNION
	// buffered, sort buffers, distinct/dedup seen-sets, recursive-CTE working
	// sets, temp tables, DML echoes) by BYTES, where MaterializationLimit only
	// bounds them by ROW COUNT — so 100k large rows can no longer OOM. Default
	// 0 = unlimited (today's behaviour); a positive value caps the statement's
	// accounted buffering and a breach errors with 54F01. This is a Go-only
	// extension Java lacks, so it is deliberately NOT in defaultOptionValues
	// (the wire/plan-cache-sensitive default map): an absent option reads back
	// as 0 via the optInt64 fallback, keeping the default path identical to
	// pre-RFC-130 and the default option set byte-identical to Java's.
	OptMaxStatementMemoryBytes            OptionName = "MAX_STATEMENT_MEMORY_BYTES"
	OptRequiredMetadataTableVersion       OptionName = "REQUIRED_METADATA_TABLE_VERSION"
	OptTransactionTimeout                 OptionName = "TRANSACTION_TIMEOUT"
	OptReplaceOnDuplicatePK               OptionName = "REPLACE_ON_DUPLICATE_PK"
	OptPlanCachePrimaryMaxEntries         OptionName = "PLAN_CACHE_PRIMARY_MAX_ENTRIES"
	OptPlanCacheSecondaryMaxEntries       OptionName = "PLAN_CACHE_SECONDARY_MAX_ENTRIES"
	OptPlanCacheTertiaryMaxEntries        OptionName = "PLAN_CACHE_TERTIARY_MAX_ENTRIES"
	OptPlanCachePrimaryTimeToLiveMillis   OptionName = "PLAN_CACHE_PRIMARY_TIME_TO_LIVE_MILLIS"
	OptPlanCacheSecondaryTimeToLiveMillis OptionName = "PLAN_CACHE_SECONDARY_TIME_TO_LIVE_MILLIS"
	OptPlanCacheTertiaryTimeToLiveMillis  OptionName = "PLAN_CACHE_TERTIARY_TIME_TO_LIVE_MILLIS"
	OptIndexFetchMethod                   OptionName = "INDEX_FETCH_METHOD"
	OptDisabledPlannerRules               OptionName = "DISABLED_PLANNER_RULES"
	OptDisablePlannerRewriting            OptionName = "DISABLE_PLANNER_REWRITING"
	// OptLogQuery gates the SLF4J log level in Java. Go has no ambient
	// log-level concept: the planning-metrics hook (RFC-034) always emits a
	// record and the handler owns level + sampling, so this option is
	// intentionally not consumed by the embedded engine pending the
	// options-plumbing work for the gRPC/REPL frontends.
	OptLogQuery OptionName = "LOG_QUERY"
	// OptLogSlowQueryThresholdMicros is the canonical default source for the
	// connection's slow-query threshold (RFC-034); see
	// embedded.defaultSlowQueryThresholdMicros.
	OptLogSlowQueryThresholdMicros  OptionName = "LOG_SLOW_QUERY_THRESHOLD_MICROS"
	OptExecutionTimeLimit           OptionName = "EXECUTION_TIME_LIMIT"
	OptExecutionScannedBytesLimit   OptionName = "EXECUTION_SCANNED_BYTES_LIMIT"
	OptExecutionScannedRowsLimit    OptionName = "EXECUTION_SCANNED_ROWS_LIMIT"
	OptDryRun                       OptionName = "DRY_RUN"
	OptCaseSensitiveIdentifiers     OptionName = "CASE_SENSITIVE_IDENTIFIERS"
	OptCurrentPlanHashMode          OptionName = "CURRENT_PLAN_HASH_MODE"
	OptValidPlanHashModes           OptionName = "VALID_PLAN_HASH_MODES"
	OptAsyncOperationsTimeoutMillis OptionName = "ASYNC_OPERATIONS_TIMEOUT_MILLIS"
	OptEncryptWhenSerializing       OptionName = "ENCRYPT_WHEN_SERIALIZING"
	OptEncryptionKeyStore           OptionName = "ENCRYPTION_KEY_STORE"
	OptEncryptionKeyEntry           OptionName = "ENCRYPTION_KEY_ENTRY"
	OptEncryptionKeyEntryList       OptionName = "ENCRYPTION_KEY_ENTRY_LIST"
	OptEncryptionKeyPassword        OptionName = "ENCRYPTION_KEY_PASSWORD"
	OptCompressWhenSerializing      OptionName = "COMPRESS_WHEN_SERIALIZING"
)

Option names, matching Java's Options.Name enum 1:1. New names must be added here AND in Java simultaneously.

type Options

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

Options carries per-connection / per-statement / per-engine configuration values, keyed by OptionName.

Mirrors Java's com.apple.foundationdb.relational.api.Options. The semantics are:

  • Options are immutable; With returns a new Options.
  • An Options may have a parent; Get walks the parent chain, then falls back to the default value.
  • Nil values are stored explicitly (via a sentinel) so that a set-to-nil in a child masks a parent value.

Deviations from Java:

  • No Properties serialization (JDBC-specific; Go users pass values through context / DSN query params instead).
  • Option validation contracts are minimal — full OptionContract DSL deferred until needed.

func NoOptions

func NoOptions() *Options

NoOptions returns the empty Options (corresponds to Java's Options.NONE singleton).

func (*Options) AllEntries

func (o *Options) AllEntries() map[OptionName]any

AllEntries returns the effective values (child overriding parent). Defaults are NOT included; iterate DefaultOptionValues separately to reason about them.

func (*Options) Entries

func (o *Options) Entries() map[OptionName]any

Entries returns a copy of this Options' own values (parent values are not included). For parent-inclusive traversal, use AllEntries.

func (*Options) Equal

func (o *Options) Equal(other *Options) bool

Equal reports structural equality: same own values AND a structurally equal parent chain. Matches Java's Options.equals() which does a recursive Objects.equals() on parent — not pointer identity.

func (*Options) Get

func (o *Options) Get(name OptionName) any

Get returns the value for name, walking the parent chain, then falling back to the default. Returns nil if the option has been explicitly set to nil in this or a parent Options, or if no default exists for name. The nil-unset-default and nil-explicit cases are indistinguishable via Get alone — Entries can be used to check whether an option was explicitly set to nil on this specific Options instance.

func (*Options) With

func (o *Options) With(name OptionName, value any) *Options

With returns a new Options with name=value applied on top of o. Explicit nil values are preserved via the null sentinel.

func (*Options) WithChild

func (o *Options) WithChild(child *Options) (*Options, error)

WithChild returns a new Options whose parent is o and whose own values are those of child. Matches Java's Options.combine. Returns an error if child already has a parent.

type OptionsBuilder

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

OptionsBuilder builds an Options.

func NewOptionsBuilder

func NewOptionsBuilder() *OptionsBuilder

NewOptionsBuilder starts a builder atop NoOptions().

func (*OptionsBuilder) Build

func (b *OptionsBuilder) Build() *Options

Build returns the accumulated Options. The builder may be reused (the returned Options does not alias the builder's internal map).

func (*OptionsBuilder) From

func (b *OptionsBuilder) From(o *Options) *OptionsBuilder

From starts a builder atop the given Options (its own values are preserved; its parent chain is carried through).

func (*OptionsBuilder) Set

func (b *OptionsBuilder) Set(name OptionName, value any) *OptionsBuilder

Set applies name=value to the builder. Returns the builder for chaining. Nil values are stored as an explicit "masked" flag so they shadow parent/default values.

type ParseTreeInfo

type ParseTreeInfo interface {
	// QueryType returns the top-level query kind.
	QueryType() QueryType
}

ParseTreeInfo is the minimal shape of a parsed SQL query exposed to SDK callers. Mirrors Java's com.apple.foundationdb.relational.api.ParseTreeInfo.

Concrete ANTLR parse-tree types live in pkg/relational/core/parser; callers who want the full AST type-assert on the concrete type.

type PreparedStatement

type PreparedStatement interface {
	Statement

	// SetObject binds value to parameter at parameterIndex
	// (1-indexed per JDBC convention, not 0-indexed).
	SetObject(parameterIndex int, value any) error
	// ClearParameters unbinds every parameter.
	ClearParameters() error

	// ExecuteQueryPrepared runs the statement with the currently-bound
	// parameters.
	ExecuteQueryPrepared(ctx context.Context) (ResultSet, error)
	// ExecuteUpdatePrepared runs the statement with bound parameters
	// as an update.
	ExecuteUpdatePrepared(ctx context.Context) (int64, error)
}

PreparedStatement is a parameterised SQL statement. Mirrors Java's RelationalPreparedStatement — lean Go subset.

type QueryType

type QueryType int

QueryType is the top-level SQL statement kind. Mirrors Java's ParseTreeInfo.QueryType enum.

const (
	QueryTypeSelect QueryType = iota
	QueryTypeInsert
	QueryTypeUpdate
	QueryTypeDelete
	QueryTypeCreate
)

func (QueryType) String

func (q QueryType) String() string

String returns the Java enum name for logging / display.

type ResultSet

type ResultSet interface {
	// Next advances to the next row. Returns true if there is one,
	// false on end-of-rows or error. Call Err() after Next()=false to
	// check for an error vs. a clean end-of-cursor.
	Next() bool
	// Err returns any error that terminated iteration, or nil on a
	// clean EOF. Idiomatic Go — matches sql.Rows.Err() shape.
	Err() error

	// Close releases resources. Safe to call multiple times.
	Close() error

	// MetaData returns the ResultSetMetaData describing columns.
	MetaData() ResultSetMetaData

	// Typed column getters. columnIndex is 1-based per JDBC. Return
	// ErrCodeInvalidColumnReference for out-of-range index and
	// ErrCodeCannotConvertType for unsupported coercion.
	Long(columnIndex int) (int64, error)
	Float(columnIndex int) (float32, error)
	Double(columnIndex int) (float64, error)
	String(columnIndex int) (string, error)
	Bytes(columnIndex int) ([]byte, error)
	Boolean(columnIndex int) (bool, error)
	Object(columnIndex int) (any, error)

	// WasNull reports whether the last column read was SQL NULL.
	// Matches JDBC's wasNull() protocol.
	WasNull() bool

	// Continuation returns the current cursor position, suitable for
	// resumption in a later transaction.
	Continuation() (Continuation, error)

	// LongByName / StringByName / etc. accept a column name instead of
	// a numeric index. Convenience accessors on top of the positional
	// ones — implementations should use MetaData to resolve names.
	LongByName(columnName string) (int64, error)
	StringByName(columnName string) (string, error)
	BytesByName(columnName string) ([]byte, error)
	BooleanByName(columnName string) (bool, error)
	ObjectByName(columnName string) (any, error)
}

ResultSet is a cursor over rows produced by a query. Mirrors Java's RelationalResultSet — lean Go subset.

The shape is iterator-style: Next advances, then typed accessors read the current row's columns. Accessors are 1-indexed (column 1 is the first column) to match JDBC/Java convention exactly so that migrating Java code is frictionless.

type ResultSetMetaData

type ResultSetMetaData interface {
	// ColumnCount returns the number of columns.
	ColumnCount() int
	// ColumnName returns the column name at columnIndex.
	ColumnName(columnIndex int) (string, error)
	// ColumnLabel returns the alias used in the query (fallback:
	// ColumnName). Matches JDBC's ResultSetMetaData.getColumnLabel.
	ColumnLabel(columnIndex int) (string, error)
	// ColumnType returns the JDBC type code for columnIndex.
	ColumnType(columnIndex int) (int, error)
	// ColumnTypeName returns the SQL display name ("INTEGER", ...).
	ColumnTypeName(columnIndex int) (string, error)
	// ColumnNullable reports whether the column admits NULL. Value
	// is one of the JDBC ColumnNullable* constants.
	ColumnNullable(columnIndex int) (int, error)
	// ColumnDataType returns the richer DataType for the column.
	// Does not exist in JDBC — relational-specific extension to
	// carry struct/array/enum detail.
	ColumnDataType(columnIndex int) (DataType, error)
}

ResultSetMetaData describes the shape of a ResultSet's columns. Mirrors Java's RelationalResultSetMetaData — lean Go subset.

columnIndex parameters are 1-based per JDBC convention.

type Row

type Row interface {
	// NumFields returns the field count.
	NumFields() int

	// Long returns the value at position as an int64. Returns
	// ErrCodeCannotConvertType if the field is not integer-coercible,
	// or ErrCodeInvalidColumnReference if position is out of range.
	Long(position int) (int64, error)

	// Float returns the value at position as a float32.
	Float(position int) (float32, error)

	// Double returns the value at position as a float64.
	Double(position int) (float64, error)

	// String returns the value at position as a string.
	String(position int) (string, error)

	// Bytes returns the value at position as []byte.
	Bytes(position int) ([]byte, error)

	// Row returns the value at position as a nested Row (STRUCT).
	Row(position int) (Row, error)

	// Array returns the value at position as a sequence of Rows
	// (ARRAY). Callers iterate with the returned Iterable.
	Array(position int) (RowIterable, error)

	// Object returns the value at position as an untyped any.
	// Returns ErrCodeInvalidColumnReference if position is out of range.
	Object(position int) (any, error)

	// StartsWith reports whether the receiver begins with the given
	// prefix row (element-wise comparison of the first len(prefix)
	// fields).
	StartsWith(prefix Row) bool

	// Prefix returns a view of this row's first length fields.
	Prefix(length int) Row
}

Row is a single row returned from a scan or query.

Mirrors Java's com.apple.foundationdb.relational.api.Row. Fields may themselves be nested Rows (for STRUCT types) or iterables of Rows (for ARRAY types).

Accessors return an error (wrapping ErrCodeInvalidColumnReference or ErrCodeCannotConvertType) instead of throwing, matching the Go error idiom.

type RowIterable

type RowIterable interface {
	// Next advances the cursor. Returns false when exhausted.
	Next() bool
	// Row returns the current row. Undefined if Next returned false.
	Row() Row
	// Close releases any resources. Idempotent.
	Close() error
}

RowIterable is a cursor over nested rows (for ARRAY-typed fields). Idiomatic Go: return io.EOF-equivalent via Next returning false.

type SQLTypeName

type SQLTypeName string

SQLTypeName is a type-safe alias for SQL type display names.

const (
	SQLTypeNameInteger   SQLTypeName = "INTEGER"
	SQLTypeNameBigInt    SQLTypeName = "BIGINT"
	SQLTypeNameFloat     SQLTypeName = "FLOAT"
	SQLTypeNameDouble    SQLTypeName = "DOUBLE"
	SQLTypeNameString    SQLTypeName = "STRING"
	SQLTypeNameStruct    SQLTypeName = "STRUCT"
	SQLTypeNameArray     SQLTypeName = "ARRAY"
	SQLTypeNameBinary    SQLTypeName = "BINARY"
	SQLTypeNameNull      SQLTypeName = "NULL"
	SQLTypeNameOther     SQLTypeName = "OTHER"
	SQLTypeNameBoolean   SQLTypeName = "BOOLEAN"
	SQLTypeNameDate      SQLTypeName = "DATE"
	SQLTypeNameTimestamp SQLTypeName = "TIMESTAMP"
)

SQLTypeName is a display name used in DDL ("INTEGER", "BIGINT", ...).

Values are uppercase, matching Java's switch arm labels.

func SQLTypeNameFromJDBC

func SQLTypeNameFromJDBC(jdbcCode int) SQLTypeName

SQLTypeNameFromJDBC returns the display name for a JDBC type code. Returns an empty string for unrecognised codes (Java throws IllegalStateException; Go-idiomatic is an empty return — callers check with name == "").

type Schema

type Schema interface {
	Metadata
	// SchemaTemplate returns the template this schema was generated
	// from. Matches Java's Schema.getSchemaTemplate().
	SchemaTemplate() SchemaTemplate
	// DatabaseName returns the owning database's name.
	DatabaseName() string
	// Tables delegates to SchemaTemplate.Tables — convenience matching
	// Java's default Schema.getTables().
	Tables() ([]Table, error)
	// Views delegates to SchemaTemplate.Views.
	Views() ([]View, error)
	// Indexes returns the (tableName -> indexNames) mapping — matches
	// Java's Schema.getIndexes() default which delegates to the
	// template's TableIndexMapping. NOT the same shape as
	// SchemaTemplate.Indexes (which returns a flat []string).
	Indexes() (map[string][]string, error)
	// InvokedRoutines delegates to SchemaTemplate.InvokedRoutines.
	InvokedRoutines() ([]InvokedRoutine, error)
}

Schema is an instantiated schema (one per database/namespace). Mirrors Java's Schema. The Tables / Views / Indexes / InvokedRoutines methods are intentionally delegated to the underlying SchemaTemplate in every current implementation — matches Java's Schema default method bodies. They're part of the interface (not package-level helpers) because Java's static type system puts them on Schema, and consumers call schema.getTables() rather than schema.getSchemaTemplate().getTables().

type SchemaTemplate

type SchemaTemplate interface {
	Metadata
	// Version is the schema version; incremented on every metadata
	// change. Matches RecordMetaData.version semantics.
	Version() int
	// EnableLongRows allows records larger than 100 KB via split
	// records (matches RecordMetaData.splitLongRecords).
	EnableLongRows() bool
	// StoreRowVersions indicates each row carries a monotonically
	// increasing version (matches Java's storeRowVersions).
	StoreRowVersions() bool
	// IntermingleTables reports whether rows from different record
	// types share the same keyspace prefix (no RecordTypeKey prefix
	// on primary keys). Matches Java's
	// RecordLayerSchemaTemplate.isIntermingleTables() which is
	// derived from `!primaryKeyHasRecordTypePrefix()`.
	IntermingleTables() bool
	// Tables returns the tables defined in this template. Error is
	// reserved for I/O / catalog-access failures; an empty template
	// returns a nil slice and nil error.
	Tables() ([]Table, error)
	// Views returns the views defined in this template. Same error
	// semantics as Tables.
	Views() ([]View, error)
	// FindTable looks up a table by name. Returns (nil, nil) when the
	// name is not found; returns an error only on a catalog access
	// failure.
	FindTable(name string) (Table, error)
	// FindView looks up a view by name; same not-found semantics as
	// FindTable.
	FindView(name string) (View, error)
	// TableIndexMapping returns (tableName → []indexName) mapping
	// (Java returns Guava Multimap; Go idiom is a map-of-slices).
	TableIndexMapping() (map[string][]string, error)
	// Indexes returns the names of every index declared in this
	// template.
	Indexes() ([]string, error)
	// InvokedRoutines returns every routine declared in this template.
	InvokedRoutines() ([]InvokedRoutine, error)
	// FindInvokedRoutine looks up a routine by name; nil if not found.
	FindInvokedRoutine(name string) (InvokedRoutine, error)
	// TemporaryInvokedRoutines returns transient routines added during
	// the current transaction.
	TemporaryInvokedRoutines() ([]InvokedRoutine, error)
	// TransactionBoundMetadataAsString is a diagnostic string
	// representation of the transaction-bound metadata.
	TransactionBoundMetadataAsString() (string, error)
	// GenerateSchema materializes a Schema from this template.
	GenerateSchema(databaseID, schemaName string) Schema
}

SchemaTemplate is the versioned schema shape (tables + views + indexes). Mirrors Java's SchemaTemplate.

type SchemaTemplateCatalog

type SchemaTemplateCatalog interface {
	// DoesSchemaTemplateExist checks whether any version of the given
	// template name exists in the catalog.
	DoesSchemaTemplateExist(txn Transaction, templateName string) (bool, error)
	// DoesSchemaTemplateExistAtVersion checks whether a specific
	// (name, version) is present. Java overloads the method name; Go
	// splits the two paths to avoid optional-argument hacks.
	DoesSchemaTemplateExistAtVersion(txn Transaction, templateName string, version int) (bool, error)
	// LoadSchemaTemplate loads the latest version of templateName.
	// Returns an *Error with Code == ErrCodeUnknownSchemaTemplate
	// when templateName is not found.
	LoadSchemaTemplate(txn Transaction, templateName string) (SchemaTemplate, error)
	// LoadSchemaTemplateAtVersion loads a specific version. Same
	// not-found semantics as LoadSchemaTemplate.
	LoadSchemaTemplateAtVersion(txn Transaction, templateName string, version int) (SchemaTemplate, error)
	// CreateTemplate persists a new template version. Returns an
	// *Error with ErrCodeDuplicateSchemaTemplate when (name, version)
	// already exists.
	CreateTemplate(txn Transaction, newTemplate SchemaTemplate) error
	// ListTemplates returns a ResultSet over every template version
	// in the catalog.
	ListTemplates(txn Transaction) (ResultSet, error)
	// DeleteTemplate removes ALL versions of templateName. When
	// throwIfDoesNotExist is true and the template is missing, an
	// *Error with ErrCodeUnknownSchemaTemplate is returned.
	DeleteTemplate(txn Transaction, templateName string, throwIfDoesNotExist bool) error
	// DeleteTemplateVersion removes one specific (name, version).
	DeleteTemplateVersion(txn Transaction, templateName string, version int, throwIfDoesNotExist bool) error
}

SchemaTemplateCatalog stores schema-template metadata keyed by template name and version. Mirrors Java's com.apple.foundationdb.relational.api.catalog.SchemaTemplateCatalog.

type Statement

type Statement interface {
	// ExecuteQuery runs a SELECT and returns a ResultSet. The cursor
	// owns the underlying FDB transaction for its lifetime (auto-close
	// when the ResultSet is closed).
	ExecuteQuery(ctx context.Context, sql string) (ResultSet, error)

	// ExecuteUpdate runs a DML statement (INSERT/UPDATE/DELETE) or DDL
	// and returns the number of affected rows (matching Java's
	// executeUpdate / Statement.executeUpdate).
	ExecuteUpdate(ctx context.Context, sql string) (int64, error)

	// Execute runs an arbitrary statement. Returns true if it produces
	// a ResultSet; false if it returns an update count. After calling,
	// use ResultSet() / UpdateCount() to retrieve the result.
	Execute(ctx context.Context, sql string) (bool, error)

	// ResultSet returns the ResultSet from the last Execute, or nil.
	ResultSet() ResultSet
	// UpdateCount returns the row count from the last Execute, or -1
	// if the last operation produced a ResultSet.
	UpdateCount() int64

	// Close releases the statement. Idempotent.
	Close() error
	// IsClosed reports whether Close has been called.
	IsClosed() bool
}

Statement is a SQL execution context. Mirrors Java's RelationalStatement — lean Go subset.

type StoreCatalog

type StoreCatalog interface {
	// SchemaTemplateCatalog returns the nested template catalog used
	// by this store. Schemas reference their template by (name,
	// version) via the template catalog.
	SchemaTemplateCatalog() SchemaTemplateCatalog

	// LoadSchema returns the Schema for (databaseID, schemaName).
	// Returns *Error with ErrCodeUndefinedSchema if not found.
	LoadSchema(txn Transaction, databaseID, schemaName string) (Schema, error)

	// SaveSchema persists or updates a Schema. If
	// createDatabaseIfNecessary is true and the owning database does
	// not yet exist, it is created atomically with the schema. Java
	// raises on transaction-level conflicts; in Go those surface as
	// errors returned by the Transaction.Commit call, not from here.
	SaveSchema(txn Transaction, dataToWrite Schema, createDatabaseIfNecessary bool) error

	// RepairSchema rebinds schemaName in databaseID to the latest
	// version of its owning template. Matches Java's
	// repairSchema — a no-op when the schema is already on the
	// latest template version.
	RepairSchema(txn Transaction, databaseID, schemaName string) error

	// CreateDatabase records a new database entry keyed by dbURI.
	// Returns an error when the database already exists.
	CreateDatabase(txn Transaction, dbURI string) error

	// ListDatabases returns a ResultSet over every database entry.
	ListDatabases(txn Transaction, continuation Continuation) (ResultSet, error)

	// ListSchemas returns a ResultSet over every schema in every
	// database. Matches Java's listSchemas(txn, continuation).
	ListSchemas(txn Transaction, continuation Continuation) (ResultSet, error)

	// ListSchemasInDatabase narrows ListSchemas to a single database.
	// Java overloads listSchemas; Go splits for clarity.
	ListSchemasInDatabase(txn Transaction, databaseID string, continuation Continuation) (ResultSet, error)

	// DeleteSchema removes schemaName from databaseID. Underlying
	// record store data is NOT purged — callers are responsible for
	// that per Java's documented contract.
	DeleteSchema(txn Transaction, dbURI, schemaName string) error

	// DoesDatabaseExist reports whether dbURI is present in the
	// catalog.
	DoesDatabaseExist(txn Transaction, dbURI string) (bool, error)

	// DoesSchemaExist reports whether (dbURI, schemaName) resolves
	// to a Schema.
	DoesSchemaExist(txn Transaction, dbURI, schemaName string) (bool, error)

	// DeleteDatabase removes the database and every schema within.
	// Underlying record-store data is NOT purged — the caller must
	// clear it separately if needed. When throwIfDoesNotExist is
	// false, a missing database is a no-op.
	//
	// Returns (true, nil) on success, (false, nil) when the
	// transaction runs out of time partway through and the caller
	// should retry — matches Java's boolean return.
	DeleteDatabase(txn Transaction, dbURI string, throwIfDoesNotExist bool) (bool, error)
}

StoreCatalog is the top-level relational catalog: maps database + schema identifiers to their Schema metadata.

Mirrors Java's com.apple.foundationdb.relational.api.catalog.StoreCatalog. Method names drop Java's get/is prefixes per Go idiom; signatures follow Java's semantics exactly.

type StringType

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

func NewStringType

func NewStringType(isNullable bool) *StringType

func (StringType) Code

func (b StringType) Code() Code

func (*StringType) Equal

func (t *StringType) Equal(other DataType) bool

func (StringType) IsNullable

func (b StringType) IsNullable() bool

func (StringType) IsPrimitive

func (b StringType) IsPrimitive() bool

func (*StringType) IsResolved

func (t *StringType) IsResolved() bool

func (*StringType) Resolve

func (t *StringType) Resolve(_ map[string]Named) DataType

func (*StringType) String

func (t *StringType) String() string

func (*StringType) WithNullable

func (t *StringType) WithNullable(isNullable bool) DataType

type Struct

type Struct interface {
	// MetaData returns the struct's metadata.
	MetaData() StructMetaData

	// AttributeCount returns the number of attributes without the
	// error return that the getter methods need.
	AttributeCount() int

	// Attribute returns the attribute value at oneBasedIndex (1-indexed
	// per JDBC convention). Returns ErrCodeInvalidColumnReference if
	// out of range.
	Attribute(oneBasedIndex int) (any, error)
	// AttributeByName looks up by name (case-sensitive; uppercasing
	// is caller's responsibility).
	AttributeByName(name string) (any, error)

	// Attributes returns every attribute in declared order.
	Attributes() []any
}

Struct is a SQL STRUCT column value. Mirrors Java's RelationalStruct — lean Go shape, no java.sql.Struct inheritance.

A Struct holds named + ordered attributes (matching StructType metadata). Accessors are 1-indexed per JDBC convention.

type StructField

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

StructField is one field of a StructType. index is the declared position (>= 0); Java's StructType.Field stores it for reporting.

func NewStructField

func NewStructField(name string, typ DataType, index int) StructField

NewStructField constructs a StructField. Panics with ErrCodeInternalError if index < 0 — matches Java's Assert.thatUnchecked.

func (StructField) Equal

func (f StructField) Equal(o StructField) bool

func (StructField) Index

func (f StructField) Index() int

func (StructField) Name

func (f StructField) Name() string

func (StructField) String

func (f StructField) String() string

func (StructField) Type

func (f StructField) Type() DataType

type StructMetaData

type StructMetaData interface {
	// TypeName returns the struct type's user-visible name.
	TypeName() string
	// AttributeCount returns the number of attributes.
	AttributeCount() int
	// AttributeName returns the name of the attribute at oneBasedIndex.
	AttributeName(oneBasedIndex int) (string, error)
	// AttributeType returns the JDBC type code of the attribute.
	AttributeType(oneBasedIndex int) (int, error)
	// AttributeTypeName returns the display name of the attribute
	// type (e.g. "INTEGER", "STRING").
	AttributeTypeName(oneBasedIndex int) (string, error)
	// AttributeDataType returns the full DataType for richer struct/
	// array detail (relational-specific extension over JDBC).
	AttributeDataType(oneBasedIndex int) (DataType, error)
	// AttributeNullable reports whether the attribute admits NULL.
	// One of the ColumnNullable* constants.
	AttributeNullable(oneBasedIndex int) (int, error)
}

StructMetaData describes a Struct's shape. Mirrors Java's StructMetaData.

type StructType

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

func NewStructType

func NewStructType(name string, fields []StructField, isNullable bool) *StructType

NewStructType constructs a struct type. The fields slice is copied defensively.

func (StructType) Code

func (b StructType) Code() Code

func (*StructType) Equal

func (t *StructType) Equal(other DataType) bool

func (*StructType) Field

func (t *StructType) Field(i int) StructField

Field returns the i-th field. Panics if i is out of range.

func (*StructType) Fields

func (t *StructType) Fields() []StructField

Fields returns a copy of the fields. The internal slice is not exposed to preserve immutability.

func (*StructType) HasIdenticalStructure

func (t *StructType) HasIdenticalStructure(other any) bool

HasIdenticalStructure compares struct types ignoring name — same field list (names + indexes + structural types) implies identical.

func (StructType) IsNullable

func (b StructType) IsNullable() bool

func (StructType) IsPrimitive

func (b StructType) IsPrimitive() bool

func (*StructType) IsResolved

func (t *StructType) IsResolved() bool

func (*StructType) Name

func (t *StructType) Name() string

func (*StructType) NumFields

func (t *StructType) NumFields() int

NumFields returns the number of fields without allocating.

func (*StructType) Resolve

func (t *StructType) Resolve(resolution map[string]Named) DataType

func (*StructType) String

func (t *StructType) String() string

String mirrors Java's StructType.toString(): `{name[:5]} { field1:type1,field2:type2 } `. Java does NOT append the nullability suffix, so neither do we.

The name is truncated to the first 5 *runes* — not bytes, to avoid slicing a multibyte character in half. Java's `String.substring(0, 5)` operates on UTF-16 code units; for any name that fits in the BMP the result is byte-identical.

NB: Java's 5-rune truncation can produce false collisions in plan cache keys when two struct types share a 5-rune prefix. This matches Java deliberately — changing it would break wire compatibility.

func (*StructType) WithNullable

func (t *StructType) WithNullable(isNullable bool) DataType

type Table

type Table interface {
	Metadata
	// Indexes returns the indexes defined on this table.
	Indexes() []Index
	// Columns returns the columns in declared order.
	Columns() []Column
	// StructDataType returns the struct type whose fields match this
	// table's columns. Matches Java's Table.getDatatype() returning
	// DataType.StructType.
	StructDataType() *StructType
}

Table is a relational table. Mirrors Java's Table.

type TimestampType

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

func NewTimestampType

func NewTimestampType(isNullable bool) *TimestampType

func (TimestampType) Code

func (b TimestampType) Code() Code

func (*TimestampType) Equal

func (t *TimestampType) Equal(other DataType) bool

func (TimestampType) IsNullable

func (b TimestampType) IsNullable() bool

func (TimestampType) IsPrimitive

func (b TimestampType) IsPrimitive() bool

func (*TimestampType) IsResolved

func (t *TimestampType) IsResolved() bool

func (*TimestampType) Resolve

func (t *TimestampType) Resolve(_ map[string]Named) DataType

func (*TimestampType) String

func (t *TimestampType) String() string

func (*TimestampType) WithNullable

func (t *TimestampType) WithNullable(isNullable bool) DataType

type Transaction

type Transaction interface {
	// Commit finalises the transaction. Returns an error if the
	// commit fails (storage-engine conflict, deadline exceeded, etc.)
	// or if the transaction has already been closed.
	Commit() error
	// Abort cancels the transaction and discards any pending writes.
	Abort() error
	// BoundSchemaTemplate returns the schema template bound to this
	// transaction, or nil if none is bound. Matches Java's
	// Optional<SchemaTemplate> getBoundSchemaTemplateMaybe() —
	// "maybe" is modelled as a nil return in Go.
	BoundSchemaTemplate() SchemaTemplate
	// SetBoundSchemaTemplate binds (or replaces) the schema template
	// for the duration of this transaction. Any subsequent
	// metadata-requiring operation uses the bound template.
	SetBoundSchemaTemplate(template SchemaTemplate)
	// UnsetBoundSchemaTemplate clears any previously bound template.
	UnsetBoundSchemaTemplate()
	// Close releases the underlying resources. Safe to call on an
	// already-committed or already-aborted transaction — second call
	// is a no-op that returns nil. Matches Java's AutoCloseable.close.
	Close() error
	// IsClosed reports whether Close has been called (directly or
	// via a successful Commit / Abort).
	IsClosed() bool
	// Unwrap returns the underlying backend-specific handle. Callers
	// perform a type assertion on the result. A future remote/gRPC
	// transaction impl that wraps a local one must forward Unwrap()
	// to preserve the chain.
	Unwrap() any
}

Transaction is the SQL-layer's handle on a single unit of work against the catalog and/or record store.

Mirrors Java's com.apple.foundationdb.relational.api.Transaction. Java extends AutoCloseable; in Go, Close is the idiomatic equivalent — call it via defer.

Unwrap is the Go analogue of Java's `<T> T unwrap(Class<T> type)`: it returns the concrete backend handle (e.g. *recordlayer.FDBRecordContext for FDB-backed transactions, the transaction itself for the in-memory impl) so catalog code can reach the storage engine without a concrete type assertion on the Transaction interface. Wrapping decorators must forward Unwrap() to their inner transaction so the chain can still be pierced.

type UUIDType

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

func NewUUIDType

func NewUUIDType(isNullable bool) *UUIDType

func (UUIDType) Code

func (b UUIDType) Code() Code

func (*UUIDType) Equal

func (t *UUIDType) Equal(other DataType) bool

func (UUIDType) IsNullable

func (b UUIDType) IsNullable() bool

func (UUIDType) IsPrimitive

func (b UUIDType) IsPrimitive() bool

func (*UUIDType) IsResolved

func (t *UUIDType) IsResolved() bool

func (*UUIDType) Resolve

func (t *UUIDType) Resolve(_ map[string]Named) DataType

func (*UUIDType) String

func (t *UUIDType) String() string

func (*UUIDType) WithNullable

func (t *UUIDType) WithNullable(isNullable bool) DataType

type UnknownType

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

func NewUnknownType

func NewUnknownType() *UnknownType

NewUnknownType returns the singleton UnknownType.

func (UnknownType) Code

func (b UnknownType) Code() Code

func (*UnknownType) Equal

func (t *UnknownType) Equal(other DataType) bool

func (UnknownType) IsNullable

func (b UnknownType) IsNullable() bool

func (UnknownType) IsPrimitive

func (b UnknownType) IsPrimitive() bool

func (*UnknownType) IsResolved

func (t *UnknownType) IsResolved() bool

func (*UnknownType) Resolve

func (t *UnknownType) Resolve(_ map[string]Named) DataType

func (*UnknownType) String

func (t *UnknownType) String() string

func (*UnknownType) WithNullable

func (t *UnknownType) WithNullable(bool) DataType

type UnresolvedType

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

func NewUnresolvedType

func NewUnresolvedType(name string, isNullable bool) *UnresolvedType

NewUnresolvedType constructs an unresolved placeholder for the given name.

func (UnresolvedType) Code

func (b UnresolvedType) Code() Code

func (*UnresolvedType) Equal

func (t *UnresolvedType) Equal(other DataType) bool

func (UnresolvedType) IsNullable

func (b UnresolvedType) IsNullable() bool

func (UnresolvedType) IsPrimitive

func (b UnresolvedType) IsPrimitive() bool

func (*UnresolvedType) IsResolved

func (t *UnresolvedType) IsResolved() bool

func (*UnresolvedType) Name

func (t *UnresolvedType) Name() string

func (*UnresolvedType) Resolve

func (t *UnresolvedType) Resolve(resolution map[string]Named) DataType

Resolve looks up the referenced name in the resolution map and returns it with this instance's nullability applied. Panics with ErrCodeInternalError if the name is not present (matches Java's Assert.thatUnchecked in UnresolvedType.resolve).

func (*UnresolvedType) String

func (t *UnresolvedType) String() string

func (*UnresolvedType) WithNullable

func (t *UnresolvedType) WithNullable(isNullable bool) DataType

type VectorType

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

func NewVectorType

func NewVectorType(precision, dimensions int, isNullable bool) *VectorType

NewVectorType returns a VectorType with the given precision (bits per element) and dimension count. Precision and dimensions must be > 0; callers are responsible for validation — matches Java (no checks).

func (VectorType) Code

func (b VectorType) Code() Code

func (*VectorType) Dimensions

func (t *VectorType) Dimensions() int

func (*VectorType) Equal

func (t *VectorType) Equal(other DataType) bool

func (VectorType) IsNullable

func (b VectorType) IsNullable() bool

func (VectorType) IsPrimitive

func (b VectorType) IsPrimitive() bool

func (*VectorType) IsResolved

func (t *VectorType) IsResolved() bool

func (*VectorType) Precision

func (t *VectorType) Precision() int

func (*VectorType) Resolve

func (t *VectorType) Resolve(_ map[string]Named) DataType

func (*VectorType) String

func (t *VectorType) String() string

func (*VectorType) WithNullable

func (t *VectorType) WithNullable(isNullable bool) DataType

type VersionType

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

func NewVersionType

func NewVersionType(isNullable bool) *VersionType

func (VersionType) Code

func (b VersionType) Code() Code

func (*VersionType) Equal

func (t *VersionType) Equal(other DataType) bool

func (VersionType) IsNullable

func (b VersionType) IsNullable() bool

func (VersionType) IsPrimitive

func (b VersionType) IsPrimitive() bool

func (*VersionType) IsResolved

func (t *VersionType) IsResolved() bool

func (*VersionType) Resolve

func (t *VersionType) Resolve(_ map[string]Named) DataType

func (*VersionType) String

func (t *VersionType) String() string

func (*VersionType) WithNullable

func (t *VersionType) WithNullable(isNullable bool) DataType

type View

type View interface {
	Metadata
}

View is a SQL view. Mirrors Java's View interface. Minimal today — the Java side is also mostly placeholder.

type Visitor

type Visitor interface {
	VisitTable(t Table)
	VisitColumn(c Column)
	StartVisitSchemaTemplate(s SchemaTemplate)
	VisitSchemaTemplate(s SchemaTemplate)
	FinishVisitSchemaTemplate(s SchemaTemplate)
	VisitSchema(s Schema)
	VisitIndex(i Index)
	VisitInvokedRoutine(r InvokedRoutine)
	VisitView(v View)
}

Visitor is the metadata-tree visitor. Implementations need to handle every concrete node type; the tree is traversed by calling Metadata.Accept. Mirrors Java's com.apple.foundationdb.relational.api.metadata.Visitor.

type WithMetadata

type WithMetadata interface {
	// RelationalMetaData returns the DataType that describes this
	// value's shape (STRUCT, ARRAY, or primitive).
	RelationalMetaData() (DataType, error)
}

WithMetadata is a trait for values that expose a relational-layer DataType — implemented by RelationalArray / RelationalStruct / things that carry richer type info than a raw JDBC code can convey. Mirrors Java's com.apple.foundationdb.relational.api.WithMetadata.

Directories

Path Synopsis
Package ddl defines the DDL action interfaces for the relational layer.
Package ddl defines the DDL action interfaces for the relational layer.

Jump to

Keyboard shortcuts

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