Documentation
¶
Overview ¶
Package dialector implements a dual-model GORM dialector for Apache IoTDB.
Index ¶
- Constants
- Variables
- func Bool(value bool) *bool
- func New(config Config) gorm.Dialector
- func Open(dsn string) gorm.Dialector
- type Config
- type DevicePathFunc
- type Dialector
- func (d *Dialector) BindVarTo(writer clause.Writer, _ *gorm.Statement, _ interface{})
- func (d *Dialector) Close() error
- func (d *Dialector) DataTypeOf(field *schema.Field) string
- func (d *Dialector) DefaultValueOf(field *schema.Field) clause.Expression
- func (d *Dialector) Explain(query string, vars ...interface{}) string
- func (d *Dialector) Initialize(db *gorm.DB) error
- func (d *Dialector) Migrator(db *gorm.DB) gorm.Migrator
- func (d *Dialector) Name() string
- func (d *Dialector) Ping(ctx context.Context) error
- func (d *Dialector) QuoteTo(writer clause.Writer, identifier string)
- func (d *Dialector) RollbackTo(*gorm.DB, string) error
- func (d *Dialector) SavePoint(*gorm.DB, string) error
- type Migrator
- func (m Migrator) AddColumn(dst interface{}, fieldName string) error
- func (m Migrator) AlterColumn(interface{}, string) error
- func (m Migrator) AutoMigrate(dst ...interface{}) error
- func (m Migrator) ColumnTypes(dst interface{}) ([]gorm.ColumnType, error)
- func (m Migrator) CreateConstraint(interface{}, string) error
- func (m Migrator) CreateIndex(interface{}, string) error
- func (m Migrator) CreateTable(dst ...interface{}) error
- func (m Migrator) CreateView(string, gorm.ViewOption) error
- func (m Migrator) CurrentDatabase() string
- func (m Migrator) DropColumn(interface{}, string) error
- func (m Migrator) DropConstraint(interface{}, string) error
- func (m Migrator) DropIndex(interface{}, string) error
- func (m Migrator) DropTable(...interface{}) error
- func (m Migrator) DropView(string) error
- func (m Migrator) FullDataTypeOf(field *schema.Field) clause.Expr
- func (m Migrator) GetTables() ([]string, error)
- func (m Migrator) GetTypeAliases(databaseTypeName string) []string
- func (m Migrator) HasColumn(dst interface{}, fieldName string) bool
- func (m Migrator) HasConstraint(interface{}, string) bool
- func (m Migrator) HasIndex(interface{}, string) bool
- func (m Migrator) HasTable(dst interface{}) bool
- func (m Migrator) MigrateColumn(dst interface{}, field *schema.Field, columnType gorm.ColumnType) error
- func (m Migrator) RenameColumn(interface{}, string, string) error
- func (m Migrator) RenameIndex(interface{}, string, string) error
- func (m Migrator) RenameTable(interface{}, interface{}) error
- type ModelMode
- type TimePrecision
Constants ¶
const ( // TreeModel targets IoTDB 1.3.1 hierarchical paths and is the default. TreeModel = backend.TreeModel // TableModel targets IoTDB 2.x relational tables; 2.0.8 is integration-verified. TableModel = backend.TableModel )
const ( // Milliseconds is the default IoTDB timestamp precision. Milliseconds = iotdbsql.Milliseconds // Microseconds selects microsecond timestamp conversion. Microseconds = iotdbsql.Microseconds // Nanoseconds selects nanosecond timestamp conversion. Nanoseconds = iotdbsql.Nanoseconds )
Variables ¶
var ErrUnsupportedOperation = errors.New("iotdb: unsupported GORM operation")
ErrUnsupportedOperation marks GORM semantics that IoTDB cannot safely emulate.
Functions ¶
Types ¶
type Config ¶
type Config struct {
DSN string
ModelMode ModelMode
NodeURLs []string
Username string
Password string
Database string
Aligned *bool
PoolSize int
ConnectTimeout time.Duration
AcquireTimeout time.Duration
QueryTimeout time.Duration
FetchSize int32
TimeZone string
ConnectRetryMax int
EnableRPCCompression bool
BatchSize int
MaxBatchBytes int
TableInsertConcurrency int
TimePrecision TimePrecision
DevicePathField string
DevicePathFunc DevicePathFunc
AllowSQLFallback bool
Conn gorm.ConnPool
}
Config configures the IoTDB GORM dialector and its one official client pool.
type DevicePathFunc ¶
DevicePathFunc resolves an optional per-row TreeModel device path.
type Dialector ¶
type Dialector struct {
// contains filtered or unexported fields
}
Dialector implements gorm.Dialector and owns one official-client backend.
func (*Dialector) BindVarTo ¶
BindVarTo writes one positional placeholder for the database/sql binder.
func (*Dialector) DataTypeOf ¶
DataTypeOf returns the IoTDB type corresponding to one GORM field.
func (*Dialector) DefaultValueOf ¶
func (d *Dialector) DefaultValueOf(field *schema.Field) clause.Expression
DefaultValueOf reports the configured default expression for DryRun SQL only.
func (*Dialector) Initialize ¶
Initialize builds one official pool and registers explicit GORM behavior.
func (*Dialector) QuoteTo ¶
QuoteTo writes validated IoTDB identifiers without treating a Tree path as one name.
func (*Dialector) RollbackTo ¶
RollbackTo rejects savepoint emulation.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator implements only idempotent, non-destructive IoTDB migrations.
func (Migrator) AddColumn ¶
AddColumn adds only the requested missing Tree measurement or table column.
func (Migrator) AlterColumn ¶
AlterColumn rejects in-place type changes.
func (Migrator) AutoMigrate ¶
AutoMigrate creates a missing device/table and adds only compatible columns.
func (Migrator) ColumnTypes ¶
func (m Migrator) ColumnTypes(dst interface{}) ([]gorm.ColumnType, error)
ColumnTypes returns TreeModel or TableModel type metadata.
func (Migrator) CreateConstraint ¶
CreateConstraint rejects relational constraints.
func (Migrator) CreateIndex ¶
CreateIndex rejects relational indexes.
func (Migrator) CreateTable ¶
CreateTable creates TreeModel measurements or one TableModel table.
func (Migrator) CreateView ¶
func (m Migrator) CreateView(string, gorm.ViewOption) error
CreateView rejects unsupported views.
func (Migrator) CurrentDatabase ¶
CurrentDatabase returns the configured logical database.
func (Migrator) DropColumn ¶
DropColumn rejects destructive column removal.
func (Migrator) DropConstraint ¶
DropConstraint rejects relational constraints.
func (Migrator) FullDataTypeOf ¶
FullDataTypeOf returns one IoTDB type expression.
func (Migrator) GetTables ¶
GetTables lists devices below the TreeModel root or tables in the TableModel database.
func (Migrator) GetTypeAliases ¶
GetTypeAliases returns the narrow set of accepted server aliases.
func (Migrator) HasConstraint ¶
HasConstraint always reports false because constraints are unsupported.
func (Migrator) HasIndex ¶
HasIndex always reports false because relational indexes are unsupported.
func (Migrator) MigrateColumn ¶
func (m Migrator) MigrateColumn(dst interface{}, field *schema.Field, columnType gorm.ColumnType) error
MigrateColumn accepts matching types and rejects incompatible changes.
func (Migrator) RenameColumn ¶
RenameColumn rejects measurement and table-column renames.
func (Migrator) RenameIndex ¶
RenameIndex rejects relational index renames.
func (Migrator) RenameTable ¶
RenameTable rejects path and table renames.
type TimePrecision ¶
type TimePrecision = iotdbsql.TimePrecision
TimePrecision controls time.Time conversion for SQL predicates and Tablets.