Documentation
¶
Index ¶
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
}
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 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 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 ResultSet ¶
type ResultSet interface {
// Schema returns the schema.
Schema() Schema
// Next returns the next row.
Next() bool
// Row returns the current row.
Row() Row
// RowsAffected returns the number of rows affected.
RowsAffected() uint64
// Close closes the resultset.
Close() error
}
ResultSet represents a response resultset interface.
func NewResultSet ¶
func NewResultSet(opts ...ResultSetOption) ResultSet
NewResultSet returns a new ResultSet.
type ResultSetOption ¶
type ResultSetOption func(*resultset)
ResultSet represents a response resultset interface.
func WithRows ¶
func WithRows(rows []Row) ResultSetOption
WithRows returns a resultset option to set the rows.
func WithRowsAffected ¶
func WithRowsAffected(rowsAffected uint64) ResultSetOption
WithRowsAffected returns a resultset option to set the rows affected.
func WithSchema ¶
func WithSchema(schema Schema) ResultSetOption
WithSchema 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.
type RowOptions ¶
type RowOptions func(*row)
RowOptions represents a functional option for Row.
func WithRowObject ¶
func WithRowObject(object map[string]any) RowOptions
WithRowObject returns a functional option for row object.
func WithRowSchema ¶
func WithRowSchema(schema Schema) RowOptions
WithRowSchema returns a functional option for row schema.
func WithRowValues ¶
func WithRowValues(values []any) RowOptions
WithRowValues returns a functional option for row values.
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 ...SchemaOptions) Schema
NewSchema returns a new resultsetSchema.
type SchemaOptions ¶
type SchemaOptions func(*schema)
SchemaOptions represents a functional option for resultsetSchema.
func WithSchemaDatabaseName ¶
func WithSchemaDatabaseName(name string) SchemaOptions
WithSchemaDatabaseName returns a functional option for resultsetSchema.
func WithSchemaResultSetColumns ¶
func WithSchemaResultSetColumns(columns []Column) SchemaOptions
WithSchemaResultSetColumns returns a functional option for resultsetSchema.
func WithSchemaTableName ¶
func WithSchemaTableName(name string) SchemaOptions
WithSchemaTableName returns a functional option for resultsetSchema.