Documentation
¶
Index ¶
- type Arguments
- type Column
- type ColumnHelper
- type ColumnOption
- type Constraint
- type DataType
- type Function
- type MapRow
- type MapRows
- type ResultSet
- type ResultSetOption
- func WithResultSetLimit(limit uint) ResultSetOption
- func WithResultSetOffset(offset uint) ResultSetOption
- func WithResultSetRows(rows []Row) ResultSetOption
- func WithResultSetRowsAffected(rowsAffected uint) ResultSetOption
- func WithResultSetRowsOf(v any) ResultSetOption
- func WithResultSetSchema(schema Schema) ResultSetOption
- type Row
- type RowOption
- type RowsOption
- type Schema
- type SchemaOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column interface {
// Name returns the column name.
Name() string
// DataType returns the data type.
DataType() DataType
// Constraint returns the column constraint.
Constraint() Constraint
// IsFunction returns true whether the column is a function.
IsFunction() bool
// Function returns the function if the column is a function.
Function() (Function, bool)
// Arguments returns the executor arguments.
Arguments() Arguments
// DefinitionString returns the definition string representation.
DefinitionString() string
// String returns the string representation of the column.
String() string
// ColumnHelper provides additional methods for columns in a query.
ColumnHelper
}
Column represents a column interface in a resultset.
func NewColumn ¶
func NewColumn(opts ...ColumnOption) Column
ResultSetColumn represents a resultset column interface.
func NewColumnFrom ¶
NewColumnFrom returns a new resultset column from the specified column.
func NewColumnsFrom ¶
NewColumnsFrom returns a new resultset columns from the specified column list.
type ColumnHelper ¶ added in v1.5.2
type ColumnHelper interface {
// IsAsterisk returns true if the column is an asterisk.
IsAsterisk() bool
// IsFunction returns true if the column is a function.
IsFunction() bool
}
ColumnHelper provides additional methods for columns in a query.
type ColumnOption ¶
type ColumnOption func(*column)
ResultSetColumnOptions represents a functional option for resultsetColumn.
func WithColumnConstraint ¶
func WithColumnConstraint(c Constraint) ColumnOption
WithColumnConstraint returns a functional option for resultsetColumn.
func WithColumnFunction ¶ added in v1.5.2
func WithColumnFunction(fn Function) ColumnOption
WithColumnFunction returns a functional option for resultsetColumn.
func WithColumnName ¶
func WithColumnName(name string) ColumnOption
WithColumnName returns a functional option for resultsetColumn.
func WithColumnType ¶
func WithColumnType(t DataType) ColumnOption
WithColumnType returns a functional option for resultsetColumn.
type MapRows ¶ added in v1.5.2
MapRows is a slice of map[string]any.
func NewMapRows ¶ added in v1.5.2
func NewMapRows() MapRows
NewMapRows creates a new MapRows instance.
type ResultSet ¶
type ResultSet interface {
// Schema returns the schema.
Schema() Schema
// Next returns the next row.
Next() bool
// Row returns the current row.
Row() (Row, error)
// RowsAffected returns the number of rows affected.
RowsAffected() uint
// Close closes the resultset.
Close() error
}
ResultSet represents a response resultset interface.
func NewResultSet ¶
func NewResultSet(opts ...ResultSetOption) ResultSet
NewResultSet returns a new ResultSet.
func NewResultSetFrom ¶ added in v1.5.2
func NewResultSetFrom(opts ...ResultSetOption) (ResultSet, error)
NewResultSetFrom creates a new ResultSet from the given options.
type ResultSetOption ¶
type ResultSetOption func(*resultset) error
ResultSet represents a response resultset interface.
func WithResultSetLimit ¶ added in v1.5.2
func WithResultSetLimit(limit uint) ResultSetOption
WithResultSetLimit returns a resultset option to set the limit.
func WithResultSetOffset ¶ added in v1.5.2
func WithResultSetOffset(offset uint) ResultSetOption
WithResultSetOffset returns a resultset option to set the offset.
func WithResultSetRows ¶ added in v1.5.0
func WithResultSetRows(rows []Row) ResultSetOption
WithResultSetRows returns a resultset option to set the rows.
func WithResultSetRowsAffected ¶ added in v1.5.0
func WithResultSetRowsAffected(rowsAffected uint) ResultSetOption
WithResultSetRowsAffected returns a resultset option to set the rows affected.
func WithResultSetRowsOf ¶ added in v1.5.2
func WithResultSetRowsOf(v any) ResultSetOption
WithResultSetRowsOf returns a resultset option to set the rows from a given value.
func WithResultSetSchema ¶ added in v1.5.0
func WithResultSetSchema(schema Schema) ResultSetOption
WithResultSetSchema returns a resultset option to set the schema.
type Row ¶
type Row interface {
// Object returns the row object.
Object() map[string]any
// Values returns the row values.
Values() []any
// ValueAt returns the row value at the specified index.
ValueAt(int) (any, error)
// ValueBy returns the row value by the specified name.
ValueBy(string) (any, error)
// Scan scans the values.
Scan(...any) error
// ScanAt scans the value at the specified index.
ScanAt(int, any) error
// ScanBy scans the value by the specified name.
ScanBy(string, any) error
}
Row represents a row interface.
func NewRows ¶ added in v1.5.2
func NewRows(opts ...RowsOption) ([]Row, error)
NewRows creates a new rows instance with the opt
type RowOption ¶ added in v1.4.2
type RowOption func(*row)
RowOption represents a functional option for Row.
func WithRowObject ¶
WithRowObject returns a functional option for row object.
func WithRowSchema ¶
WithRowSchema returns a functional option for row schema.
func WithRowValues ¶
WithRowValues returns a functional option for row values.
type RowsOption ¶ added in v1.5.2
type RowsOption func(*rows) error
RowsOption represents a functional option for rows.
func WithRowsGroupBy ¶ added in v1.5.2
func WithRowsGroupBy(groupBy string) RowsOption
WithRowsGroupBy sets the group by clause for the rows.
func WithRowsMapRows ¶ added in v1.5.2
func WithRowsMapRows(v MapRows) RowsOption
WithRowsMapRows sets the rows from a slice of map[string]any.
func WithRowsSchema ¶ added in v1.5.2
func WithRowsSchema(schema Schema) RowsOption
WithRowsSchema sets the schema for the rows.
func WithRowsSelectors ¶ added in v1.5.2
func WithRowsSelectors(selectors query.Selectors) RowsOption
WithRowsSelector sets the selectors for the rows.
type Schema ¶
type Schema interface {
// DatabaseName returns the database name.
DatabaseName() string
// TableName returns the table name.
TableName() string
// Selectows returns the selectors.
Selectors() query.Selectors
// Columns returns the columns.
Columns() []Column
// LookupColumn returns the column by the specified name.
LookupColumn(name string) (Column, error)
}
Schema represents a schema interface in a resultset.
func NewSchema ¶
func NewSchema(opts ...SchemaOption) Schema
NewSchema returns a new Schema with the specified options.
func NewSchemaFrom ¶
func NewSchemaFrom(opts ...SchemaOption) (Schema, error)
NewSchemaFrom returns a new Schema from the specified options.
type SchemaOption ¶ added in v1.4.2
type SchemaOption func(*schema) error
SchemaOption represents a functional option for resultsetSchema.
func WithSchemaColumns ¶ added in v1.4.2
func WithSchemaColumns(columns []Column) SchemaOption
WithSchemaColumns returns a functional option for resultsetSchema.
func WithSchemaDatabaseName ¶
func WithSchemaDatabaseName(name string) SchemaOption
WithSchemaDatabaseName returns a functional option for resultsetSchema.
func WithSchemaQuerySchema ¶ added in v1.5.2
func WithSchemaQuerySchema(querySchema query.Schema) SchemaOption
WithSchemaQuerySchema returns a functional option for WithSchemaSelector().
func WithSchemaSelectors ¶ added in v1.5.2
func WithSchemaSelectors(selectors query.Selectors) SchemaOption
WithSchemaSelector returns a functional option for resultsetSchema.
func WithSchemaTableName ¶
func WithSchemaTableName(name string) SchemaOption
WithSchemaTableName returns a functional option for resultsetSchema.