Documentation
¶
Overview ¶
Package duckdb implements a database/sql driver for the DuckDB database.
Example (SimpleConnection) ¶
// Connect to DuckDB using '[database/sql.Open]'. db, err := sql.Open("duckdb", "?access_mode=READ_WRITE") defer func() { if err = db.Close(); err != nil { log.Fatalf("failed to close the database: %s", err) } }() if err != nil { log.Fatalf("failed to open connection to duckdb: %s", err) } ctx := context.Background() createStmt := `CREATE table users(name VARCHAR, age INTEGER)` _, err = db.ExecContext(ctx, createStmt) if err != nil { log.Fatalf("failed to create table: %s", err) } insertStmt := `INSERT INTO users(name, age) VALUES (?, ?)` res, err := db.ExecContext(ctx, insertStmt, "Marc", 30) if err != nil { log.Fatalf("failed to insert users: %s", err) } rowsAffected, err := res.RowsAffected() if err != nil { log.Fatal("failed to get number of rows affected") } fmt.Printf("Inserted %d row(s) into users table", rowsAffected)
Output: Inserted 1 row(s) into users table
Index ¶
- Constants
- Variables
- func ConnId(c *sql.Conn) (uint64, error)
- func GetDataChunkCapacity() int
- func GetTableNames(c *sql.Conn, query string, qualified bool) ([]string, error)
- func RegisterReplacementScan(c *Connector, callback ReplacementScanCallback)
- func RegisterScalarUDF(c *sql.Conn, name string, f ScalarFunc) error
- func RegisterScalarUDFSet(c *sql.Conn, name string, functions ...ScalarFunc) error
- func RegisterTableUDF[TFT TableFunction](conn *sql.Conn, name string, f TFT) error
- func SetChunkValue[T any](chunk DataChunk, colIdx, rowIdx int, val T) error
- func SetRowValue[T any](row Row, colIdx int, val T) error
- type Appender
- type CardinalityInfo
- type ChunkTableFunction
- type ChunkTableSource
- type ColumnInfo
- type Composite
- type Conn
- func (conn *Conn) Begin() (driver.Tx, error)
- func (conn *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)
- func (conn *Conn) CheckNamedValue(nv *driver.NamedValue) error
- func (conn *Conn) Close() error
- func (conn *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
- func (conn *Conn) Prepare(query string) (driver.Stmt, error)
- func (conn *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)
- func (conn *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)
- type Connector
- type DataChunk
- type Decimal
- type Driver
- type Error
- type ErrorType
- type Interval
- type Map
- type ParallelChunkTableFunction
- type ParallelChunkTableSource
- type ParallelRowTableFunction
- type ParallelRowTableSource
- type ParallelTableSourceInfo
- type ProfilingInfo
- type ReplacementScanCallback
- type Row
- type RowContextExecutorFn
- type RowExecutorFn
- type RowTableFunction
- type RowTableSource
- type ScalarFunc
- type ScalarFuncConfig
- type ScalarFuncExecutor
- type Stmt
- func (s *Stmt) Bind(args []driver.NamedValue) error
- func (s *Stmt) Close() error
- func (s *Stmt) Exec(args []driver.Value) (driver.Result, error)deprecated
- func (s *Stmt) ExecBound(ctx context.Context) (driver.Result, error)
- func (s *Stmt) ExecContext(ctx context.Context, nargs []driver.NamedValue) (driver.Result, error)
- func (s *Stmt) NumInput() int
- func (s *Stmt) ParamName(n int) (string, error)
- func (s *Stmt) ParamType(n int) (Type, error)
- func (s *Stmt) Query(args []driver.Value) (driver.Rows, error)deprecated
- func (s *Stmt) QueryBound(ctx context.Context) (driver.Rows, error)
- func (s *Stmt) QueryContext(ctx context.Context, nargs []driver.NamedValue) (driver.Rows, error)
- func (s *Stmt) StatementType() (StmtType, error)
- type StmtType
- type StructEntry
- type TableFunction
- type TableFunctionConfig
- type Type
- type TypeInfo
- func NewArrayInfo(childInfo TypeInfo, size uint64) (TypeInfo, error)
- func NewDecimalInfo(width, scale uint8) (TypeInfo, error)
- func NewEnumInfo(first string, others ...string) (TypeInfo, error)
- func NewListInfo(childInfo TypeInfo) (TypeInfo, error)
- func NewMapInfo(keyInfo, valueInfo TypeInfo) (TypeInfo, error)
- func NewStructInfo(firstEntry StructEntry, others ...StructEntry) (TypeInfo, error)
- func NewTypeInfo(t Type) (TypeInfo, error)
- func NewUnionInfo(memberTypes []TypeInfo, memberNames []string) (TypeInfo, error)
- type UUID
- type Union
Examples ¶
Constants ¶
const ( STATEMENT_TYPE_INVALID = StmtType(mapping.StatementTypeInvalid) STATEMENT_TYPE_SELECT = StmtType(mapping.StatementTypeSelect) STATEMENT_TYPE_INSERT = StmtType(mapping.StatementTypeInsert) STATEMENT_TYPE_UPDATE = StmtType(mapping.StatementTypeUpdate) STATEMENT_TYPE_EXPLAIN = StmtType(mapping.StatementTypeExplain) STATEMENT_TYPE_DELETE = StmtType(mapping.StatementTypeDelete) STATEMENT_TYPE_PREPARE = StmtType(mapping.StatementTypePrepare) STATEMENT_TYPE_CREATE = StmtType(mapping.StatementTypeCreate) STATEMENT_TYPE_EXECUTE = StmtType(mapping.StatementTypeExecute) STATEMENT_TYPE_ALTER = StmtType(mapping.StatementTypeAlter) STATEMENT_TYPE_TRANSACTION = StmtType(mapping.StatementTypeTransaction) STATEMENT_TYPE_COPY = StmtType(mapping.StatementTypeCopy) STATEMENT_TYPE_ANALYZE = StmtType(mapping.StatementTypeAnalyze) STATEMENT_TYPE_VARIABLE_SET = StmtType(mapping.StatementTypeVariableSet) STATEMENT_TYPE_CREATE_FUNC = StmtType(mapping.StatementTypeCreateFunc) STATEMENT_TYPE_DROP = StmtType(mapping.StatementTypeDrop) STATEMENT_TYPE_EXPORT = StmtType(mapping.StatementTypeExport) STATEMENT_TYPE_PRAGMA = StmtType(mapping.StatementTypePragma) STATEMENT_TYPE_VACUUM = StmtType(mapping.StatementTypeVacuum) STATEMENT_TYPE_CALL = StmtType(mapping.StatementTypeCall) STATEMENT_TYPE_SET = StmtType(mapping.StatementTypeSet) STATEMENT_TYPE_LOAD = StmtType(mapping.StatementTypeLoad) STATEMENT_TYPE_RELATION = StmtType(mapping.StatementTypeRelation) STATEMENT_TYPE_EXTENSION = StmtType(mapping.StatementTypeExtension) STATEMENT_TYPE_LOGICAL_PLAN = StmtType(mapping.StatementTypeLogicalPlan) STATEMENT_TYPE_ATTACH = StmtType(mapping.StatementTypeAttach) STATEMENT_TYPE_DETACH = StmtType(mapping.StatementTypeDetach) STATEMENT_TYPE_MULTI = StmtType(mapping.StatementTypeMulti) )
const ( TYPE_INVALID = mapping.TypeInvalid TYPE_BOOLEAN = mapping.TypeBoolean TYPE_TINYINT = mapping.TypeTinyInt TYPE_SMALLINT = mapping.TypeSmallInt TYPE_INTEGER = mapping.TypeInteger TYPE_BIGINT = mapping.TypeBigInt TYPE_UTINYINT = mapping.TypeUTinyInt TYPE_USMALLINT = mapping.TypeUSmallInt TYPE_UINTEGER = mapping.TypeUInteger TYPE_UBIGINT = mapping.TypeUBigInt TYPE_FLOAT = mapping.TypeFloat TYPE_DOUBLE = mapping.TypeDouble TYPE_TIMESTAMP = mapping.TypeTimestamp TYPE_DATE = mapping.TypeDate TYPE_TIME = mapping.TypeTime TYPE_INTERVAL = mapping.TypeInterval TYPE_HUGEINT = mapping.TypeHugeInt TYPE_UHUGEINT = mapping.TypeUHugeInt TYPE_VARCHAR = mapping.TypeVarchar TYPE_BLOB = mapping.TypeBlob TYPE_DECIMAL = mapping.TypeDecimal TYPE_TIMESTAMP_S = mapping.TypeTimestampS TYPE_TIMESTAMP_MS = mapping.TypeTimestampMS TYPE_TIMESTAMP_NS = mapping.TypeTimestampNS TYPE_ENUM = mapping.TypeEnum TYPE_LIST = mapping.TypeList TYPE_STRUCT = mapping.TypeStruct TYPE_MAP = mapping.TypeMap TYPE_ARRAY = mapping.TypeArray TYPE_UUID = mapping.TypeUUID TYPE_UNION = mapping.TypeUnion TYPE_BIT = mapping.TypeBit TYPE_TIME_TZ = mapping.TypeTimeTZ TYPE_TIMESTAMP_TZ = mapping.TypeTimestampTZ TYPE_ANY = mapping.TypeAny TYPE_BIGNUM = mapping.TypeBigNum TYPE_SQLNULL = mapping.TypeSQLNull )
Variables ¶
var GetInstanceCache = sync.OnceValue( func() mapping.InstanceCache { return mapping.CreateInstanceCache() })
Functions ¶
func ConnId ¶ added in v2.3.1
ConnId returns the connection id of the internal DuckDB connection. It expects a *sql.Conn connection.
func GetDataChunkCapacity ¶
func GetDataChunkCapacity() int
GetDataChunkCapacity returns the capacity of a data chunk.
func GetTableNames ¶ added in v2.3.1
GetTableNames returns the tables names of a query. It expects a *sql.Conn connection, and a query for which to extract the table names. If qualified is true, then it returns the fully qualified table names, else it returns only the table names.
func RegisterReplacementScan ¶
func RegisterReplacementScan(c *Connector, callback ReplacementScanCallback)
func RegisterScalarUDF ¶
func RegisterScalarUDF(c *sql.Conn, name string, f ScalarFunc) error
RegisterScalarUDF registers a user-defined scalar function. *sql.Conn is the SQL connection on which to register the scalar function. name is the function name, and f is the scalar function's interface ScalarFunc. RegisterScalarUDF takes ownership of f, so you must pass it as a pointer.
func RegisterScalarUDFSet ¶
func RegisterScalarUDFSet(c *sql.Conn, name string, functions ...ScalarFunc) error
RegisterScalarUDFSet registers a set of user-defined scalar functions with the same name. This enables overloading of scalar functions. E.g., the function my_length() can have implementations like my_length(LIST(ANY)) and my_length(VARCHAR). *sql.Conn is the SQL connection on which to register the scalar function set. name is the function name of each function in the set. functions contains all ScalarFunc functions of the scalar function set.
func RegisterTableUDF ¶
func RegisterTableUDF[TFT TableFunction](conn *sql.Conn, name string, f TFT) error
RegisterTableUDF registers a user-defined table function. Projection pushdown is enabled by default.
func SetChunkValue ¶
SetChunkValue writes a single value to a column in a data chunk. The difference with `chunk.SetValue` is that `SetChunkValue` does not require casting the value to `any` (implicitly). NOTE: Custom ENUM types must be passed as string.
Types ¶
type Appender ¶
type Appender struct {
// contains filtered or unexported fields
}
Appender holds the DuckDB appender. It allows efficient bulk loading into a DuckDB database.
func NewAppender ¶ added in v2.0.2
NewAppender returns a new Appender from a DuckDB driver connection.
func NewAppenderFromConn ¶
NewAppenderFromConn returns a new Appender for the default catalog from a DuckDB driver connection.
func (*Appender) AppendRow ¶
AppendRow loads a row of values into the appender. The values are provided as separate arguments.
type CardinalityInfo ¶
type CardinalityInfo struct { // The absolute Cardinality. Cardinality uint // IsExact indicates whether the cardinality is exact. Exact bool }
CardinalityInfo contains the cardinality of a (table) function. If it is impossible or difficult to determine the exact cardinality, an approximate cardinality may be used.
type ChunkTableFunction ¶
type ChunkTableFunction = tableFunction[ChunkTableSource]
A ChunkTableFunction is a type which can be bound to return a ChunkTableSource.
type ChunkTableSource ¶
type ChunkTableSource interface { // FillChunk takes a Chunk and fills it with values. // Set the chunk size to 0 to end the function. FillChunk(DataChunk) error // contains filtered or unexported methods }
A ChunkTableSource represents anything that produces rows in a vectorised way. The cardinality is requested before function initialization. After initializing the ChunkTableSource, go-duckdb requests the rows. It sequentially calls the FillChunk method with a single thread.
type ColumnInfo ¶
ColumnInfo contains the metadata of a column.
type Composite ¶
type Composite[T any] struct { // contains filtered or unexported fields }
Use as the `Scanner` type for any composite types (maps, lists, structs)
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn holds a connection to a DuckDB database. It implements the driver.Conn interface.
func (*Conn) BeginTx ¶
BeginTx starts and returns a new transaction. It implements the driver.ConnBeginTx interface.
func (*Conn) CheckNamedValue ¶
func (conn *Conn) CheckNamedValue(nv *driver.NamedValue) error
CheckNamedValue implements the driver.NamedValueChecker interface.
func (*Conn) Close ¶
Close closes the connection to the database. It implements the driver.Conn interface.
func (*Conn) ExecContext ¶
func (conn *Conn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Result, error)
ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE. It implements the driver.ExecerContext interface.
func (*Conn) Prepare ¶
Prepare returns a prepared statement, bound to this connection. It implements the driver.Conn interface.
func (*Conn) PrepareContext ¶
PrepareContext returns a prepared statement, bound to this connection. It implements the driver.ConnPrepareContext interface.
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
func NewConnector ¶
func NewConnector(dsn string, connInitFn func(execer driver.ExecerContext) error) (*Connector, error)
NewConnector opens a new Connector for a DuckDB database. The user must close the Connector, if it is not passed to the sql.OpenDB function. Otherwise, sql.DB closes the Connector when calling sql.DB.Close().
Example ¶
c, err := NewConnector(`duck.db?access_mode=READ_WRITE`, func(execer driver.ExecerContext) error { initQueries := []string{ `SET memory_limit = '10GB'`, `SET threads TO 1`, } ctx := context.Background() for _, query := range initQueries { _, err := execer.ExecContext(ctx, query, nil) if err != nil { return err } } return nil }) if err != nil { log.Fatalf("failed to create a new duckdb connector: %s", err) } defer func() { if err = c.Close(); err != nil { log.Fatalf("failed to close the connector: %s", err) } }() db := sql.OpenDB(c) defer func() { if err = db.Close(); err != nil { log.Fatalf("failed to close the database: %s", err) } if err = os.Remove("duck.db"); err != nil { log.Fatalf("failed to remove the database file: %s", err) } }() var value string row := db.QueryRow(`SELECT value FROM duckdb_settings() WHERE name = 'max_memory'`) if row.Scan(&value) != nil { log.Fatalf("failed to scan row: %s", err) } fmt.Printf("The memory_limit is %s.", value)
Output: The memory_limit is 9.3 GiB.
type DataChunk ¶
type DataChunk struct {
// contains filtered or unexported fields
}
DataChunk storage of a DuckDB table.
type ErrorType ¶
type ErrorType int
const ( ErrorTypeInvalid ErrorType = iota // invalid type ErrorTypeOutOfRange // value out of range error ErrorTypeConversion // conversion/casting error ErrorTypeUnknownType // unknown type error ErrorTypeDecimal // decimal related ErrorTypeMismatchType // type mismatch ErrorTypeDivideByZero // divide by 0 ErrorTypeObjectSize // object size exceeded ErrorTypeInvalidType // incompatible for operation ErrorTypeSerialization // serialization ErrorTypeTransaction // transaction management ErrorTypeNotImplemented // method not implemented ErrorTypeExpression // expression parsing ErrorTypeCatalog // catalog related ErrorTypeParser // parser related ErrorTypePlanner // planner related ErrorTypeScheduler // scheduler related ErrorTypeExecutor // executor related ErrorTypeConstraint // constraint related ErrorTypeIndex // index related ErrorTypeStat // stat related ErrorTypeConnection // connection related ErrorTypeSyntax // syntax related ErrorTypeSettings // settings related ErrorTypeBinder // binder related ErrorTypeNetwork // network related ErrorTypeOptimizer // optimizer related ErrorTypeNullPointer // nullptr exception ErrorTypeIO // IO exception ErrorTypeInterrupt // interrupt ErrorTypeFatal // Fatal exceptions are non-recoverable, and render the entire DB in an unusable state ErrorTypeInternal // Internal exceptions indicate something went wrong internally (i.e. bug in the code base) ErrorTypeInvalidInput // Input or arguments error ErrorTypeOutOfMemory // out of memory ErrorTypePermission // insufficient permissions ErrorTypeParameterNotResolved // parameter types could not be resolved ErrorTypeParameterNotAllowed // parameter types not allowed ErrorTypeDependency // dependency ErrorTypeHTTP ErrorTypeMissingExtension // Thrown when an extension is used but not loaded ErrorTypeAutoLoad // Thrown when an extension is used but not loaded ErrorTypeSequence ErrorTypeInvalidConfiguration // An invalid configuration was detected (e.g. a Secret param was missing, or a required setting not found) )
type ParallelChunkTableFunction ¶
type ParallelChunkTableFunction = tableFunction[ParallelChunkTableSource]
A ParallelChunkTableFunction is a type which can be bound to return a ParallelChunkTableSource.
type ParallelChunkTableSource ¶
type ParallelChunkTableSource interface { // FillChunk takes a Chunk and fills it with values. // Set the chunk size to 0 to end the function FillChunk(any, DataChunk) error // contains filtered or unexported methods }
A ParallelChunkTableSource represents anything that produces rows in a vectorised way. The cardinality is requested before function initialization. After initializing the ParallelChunkTableSource, go-duckdb requests the rows. It simultaneously calls the FillChunk method with multiple threads. If ParallelTableSourceInfo.MaxThreads is greater than one, FillChunk must use synchronization primitives to avoid race conditions.
type ParallelRowTableFunction ¶
type ParallelRowTableFunction = tableFunction[ParallelRowTableSource]
A ParallelRowTableFunction is a type which can be bound to return a ParallelRowTableSource.
type ParallelRowTableSource ¶
type ParallelRowTableSource interface { // FillRow takes a Row and fills it with values. // Returns true, if there are more rows to fill. FillRow(any, Row) (bool, error) // contains filtered or unexported methods }
A ParallelRowTableSource represents anything that produces rows in a non-vectorised way. The cardinality is requested before function initialization. After initializing the ParallelRowTableSource, go-duckdb requests the rows. It simultaneously calls the FillRow method with multiple threads. If ParallelTableSourceInfo.MaxThreads is greater than one, FillRow must use synchronisation primitives to avoid race conditions.
type ParallelTableSourceInfo ¶
type ParallelTableSourceInfo struct { // MaxThreads is the maximum number of threads on which to run the table source function. // If set to 0, it uses DuckDB's default thread configuration. MaxThreads int }
ParallelTableSourceInfo contains information for initializing a parallelism-aware table source.
type ProfilingInfo ¶
type ProfilingInfo struct { // Metrics contains all key-value pairs of the current node. // The key represents the name and corresponds to the measured value. Metrics map[string]string // Children contains all children of the node and their respective metrics. Children []ProfilingInfo }
ProfilingInfo is a recursive type containing metrics for each node in DuckDB's query plan. There are two types of nodes: the QUERY_ROOT and OPERATOR nodes. The QUERY_ROOT refers exclusively to the top-level node; its metrics are measured over the entire query. The OPERATOR nodes refer to the individual operators in the query plan.
func GetProfilingInfo ¶
func GetProfilingInfo(c *sql.Conn) (ProfilingInfo, error)
GetProfilingInfo obtains all available metrics set by the current connection.
type ReplacementScanCallback ¶
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row represents one row in duckdb. It references the internal vectors.
func (Row) IsProjected ¶
IsProjected returns whether the column is projected.
type RowContextExecutorFn ¶ added in v2.3.1
RowContextExecutorFn accepts a row-based execution function using a context. It takes a context and the row values, and returns the row execution result, or error.
type RowExecutorFn ¶ added in v2.3.1
RowExecutorFn is the type for any row-based execution function. It takes the row values and returns the row execution result, or error.
type RowTableFunction ¶
type RowTableFunction = tableFunction[RowTableSource]
A RowTableFunction is a type which can be bound to return a RowTableSource.
type RowTableSource ¶
type RowTableSource interface { // FillRow takes a Row and fills it with values. // Returns true, if there are more rows to fill. FillRow(Row) (bool, error) // contains filtered or unexported methods }
A RowTableSource represents anything that produces rows in a non-vectorised way. The cardinality is requested before function initialization. After initializing the RowTableSource, go-duckdb requests the rows. It sequentially calls the FillRow method with a single thread.
type ScalarFunc ¶
type ScalarFunc interface { // Config returns ScalarFuncConfig to configure the scalar function. Config() ScalarFuncConfig // Executor returns ScalarFuncExecutor to execute the scalar function. Executor() ScalarFuncExecutor }
ScalarFunc is the user-defined scalar function interface. Any scalar function must implement a Config function, and an Executor function.
type ScalarFuncConfig ¶
type ScalarFuncConfig struct { // InputTypeInfos contains Type information for each input parameter of the scalar function. InputTypeInfos []TypeInfo // ResultTypeInfo holds the Type information of the scalar function's result type. ResultTypeInfo TypeInfo // VariadicTypeInfo configures the number of input parameters. // If this field is nil, then the input parameters match InputTypeInfos. // Otherwise, the scalar function's input parameters are set to variadic, allowing any number of input parameters. // The Type of the first len(InputTypeInfos) parameters is configured by InputTypeInfos, and all // remaining parameters must match the variadic Type. To configure different variadic parameter types, // you must set the VariadicTypeInfo's Type to TYPE_ANY. VariadicTypeInfo TypeInfo // Volatile sets the stability of the scalar function to volatile, if true. // Volatile scalar functions might create a different result per row. // E.g., random() is a volatile scalar function. Volatile bool // SpecialNullHandling disables the default NULL handling of scalar functions, if true. // The default NULL handling is: NULL in, NULL out. I.e., if any input parameter is NULL, then the result is NULL. SpecialNullHandling bool }
ScalarFuncConfig contains the fields to configure a user-defined scalar function.
type ScalarFuncExecutor ¶
type ScalarFuncExecutor struct { // RowExecutor accepts a row-based execution function of type RowExecutorFn. RowExecutor RowExecutorFn // RowContextExecutor accepts a row-based execution function of type RowContextExecutorFn. RowContextExecutor RowContextExecutorFn }
ScalarFuncExecutor contains the functions to execute a user-defined scalar function. It invokes its first non-nil member.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt implements the driver.Stmt interface.
func (*Stmt) Bind ¶
func (s *Stmt) Bind(args []driver.NamedValue) error
Bind the parameters to the statement. WARNING: This is a low-level API and should be used with caution.
func (*Stmt) ExecBound ¶
ExecBound executes a bound query that doesn't return rows, such as an INSERT or UPDATE. It can only be used after Bind has been called. WARNING: This is a low-level API and should be used with caution.
func (*Stmt) ExecContext ¶
ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE. It implements the driver.StmtExecContext interface.
func (*Stmt) NumInput ¶
NumInput returns the number of placeholder parameters. Implements the driver.Stmt interface.
func (*Stmt) ParamType ¶
ParamType returns the expected type of the parameter at the given index (1-based).
func (*Stmt) QueryBound ¶
QueryBound executes a bound query that may return rows, such as a SELECT. It can only be used after Bind has been called. WARNING: This is a low-level API and should be used with caution.
func (*Stmt) QueryContext ¶
QueryContext executes a query that may return rows, such as a SELECT. It implements the driver.StmtQueryContext interface.
func (*Stmt) StatementType ¶
StatementType returns the type of the statement.
type StmtType ¶
type StmtType mapping.StatementType
type StructEntry ¶
type StructEntry interface { // Info returns a STRUCT entry's type information. Info() TypeInfo // Name returns a STRUCT entry's name. Name() string }
StructEntry is an interface to provide STRUCT entry information.
func NewStructEntry ¶
func NewStructEntry(info TypeInfo, name string) (StructEntry, error)
NewStructEntry returns a STRUCT entry. info contains information about the entry's type, and name holds the entry's name.
type TableFunction ¶
type TableFunction interface { RowTableFunction | ParallelRowTableFunction | ChunkTableFunction | ParallelChunkTableFunction }
TableFunction implements different table function types: RowTableFunction, ParallelRowTableFunction, ChunkTableFunction, and ParallelChunkTableFunction.
type TableFunctionConfig ¶
type TableFunctionConfig struct { // The Arguments of the table function. Arguments []TypeInfo // The NamedArguments of the table function. NamedArguments map[string]TypeInfo }
TableFunctionConfig contains any information passed to DuckDB when registering the table function.
type TypeInfo ¶
type TypeInfo interface { // InternalType returns the Type. InternalType() Type // contains filtered or unexported methods }
TypeInfo is an interface for a DuckDB type.
func NewArrayInfo ¶
NewArrayInfo returns ARRAY type information. childInfo contains the type information of the ARRAY's elements. size is the ARRAY's fixed size.
func NewDecimalInfo ¶
NewDecimalInfo returns DECIMAL type information. Its input parameters are the width and scale of the DECIMAL type.
func NewEnumInfo ¶
NewEnumInfo returns ENUM type information. Its input parameters are the dictionary values.
func NewListInfo ¶
NewListInfo returns LIST type information. childInfo contains the type information of the LIST's elements.
func NewMapInfo ¶
NewMapInfo returns MAP type information. keyInfo contains the type information of the MAP keys. valueInfo contains the type information of the MAP values.
func NewStructInfo ¶
func NewStructInfo(firstEntry StructEntry, others ...StructEntry) (TypeInfo, error)
NewStructInfo returns STRUCT type information. Its input parameters are the STRUCT entries.
func NewTypeInfo ¶
NewTypeInfo returns type information for DuckDB's primitive types. It returns the TypeInfo, if the Type parameter is a valid primitive type. Else, it returns nil, and an error. Valid types are: TYPE_[BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, UTINYINT, USMALLINT, UINTEGER, UBIGINT, FLOAT, DOUBLE, TIMESTAMP, DATE, TIME, INTERVAL, HUGEINT, VARCHAR, BLOB, TIMESTAMP_S, TIMESTAMP_MS, TIMESTAMP_NS, UUID, TIMESTAMP_TZ, ANY].
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
appender
command
|
|
json
command
|
|
scalar_udf
command
|
|
simple
command
|
|
table_udf
command
|
|
table_udf_parallel
command
|