gorm_immudb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: MIT Imports: 14 Imported by: 0

README

GORM ImmuDB Driver

Quick Start

import (
  immudb "github.com/0ctanium/gorm-immudb"
  "gorm.io/gorm"
)

// https://docs.immudb.io/master/develop/sqlstdlib.html
dsn := "immudb://immudb:immudb@127.0.0.1:3322/defaultdb"
db, err := gorm.Open(gimmudb.Open(dsn), &gorm.Config{})

Configuration

import (
  immudb "github.com/0ctanium/gorm-immudb"
  "gorm.io/gorm"
)

db, err := gorm.Open(immudb.New(immudb.Config{
  DSN: "immudb://immudb:immudb@127.0.0.1:3322/defaultdb", // data source name, refer https://docs.immudb.io/master/develop/sqlstdlib.html
  DefaultVarcharSize: 256, // add default size for string fields, not a primary key, no index defined and don't have default values
  DefaultBlobSize: 256, // add default size for bytes fields, not a primary key, no index defined and don't have default values
  DisableDeletion: true, // disable row deletion, which not supported before ImmuDB 1.2
}), &gorm.Config{})

Customized Driver

import (
  _ "example.com/my_immudb_driver"
  immudb "github.com/0ctanium/gorm-immudb"
  "gorm.io/gorm"
)

db, err := gorm.Open(immudb.New(immudb.Config{
  DriverName: "my_immudb_driver",
  DSN: "immudb://immudb:immudb@127.0.0.1:3322/defaultdb", // data source name, refer https://docs.immudb.io/master/develop/sqlstdlib.html
})

Checkout https://gorm.io for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("not yet implemented")
View Source
var ErrNotSupported = errors.New("not supported")

Functions

func New

func New(config Config) gorm.Dialector

func Open

func Open(dsn string) gorm.Dialector

Types

type Column

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

func (Column) DatabaseTypeName

func (c Column) DatabaseTypeName() string

func (Column) DecimalSize

func (c Column) DecimalSize() (precision int64, scale int64, ok bool)

func (Column) Length

func (c Column) Length() (length int64, ok bool)

func (Column) Name

func (c Column) Name() string

func (Column) Nullable

func (c Column) Nullable() (nullable bool, ok bool)

type Config

type Config struct {
	DriverName string
	DSN        string
	Conn       gorm.ConnPool

	DefaultVarcharSize uint
	DefaultBlobSize    uint
	DisableDeletion    bool
}

type Dialector

type Dialector struct {
	*Config
}

func (Dialector) BindVarTo

func (dialector Dialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{})

func (Dialector) DataTypeOf

func (dialector Dialector) DataTypeOf(field *schema.Field) string

func (Dialector) DefaultValueOf

func (dialector Dialector) DefaultValueOf(field *schema.Field) clause.Expression

func (Dialector) Explain

func (dialector Dialector) Explain(sql string, vars ...interface{}) string

func (Dialector) Initialize

func (dialector Dialector) Initialize(db *gorm.DB) (err error)

func (Dialector) Migrator

func (dialector Dialector) Migrator(db *gorm.DB) gorm.Migrator

func (Dialector) Name

func (dialector Dialector) Name() string

func (Dialector) QuoteTo

func (dialector Dialector) QuoteTo(writer clause.Writer, str string)

func (Dialector) RollbackTo

func (dialectopr Dialector) RollbackTo(tx *gorm.DB, name string) error

func (Dialector) SavePoint

func (dialectopr Dialector) SavePoint(tx *gorm.DB, name string) error

type Migrator

type Migrator struct {
	migrator.Migrator
}

func (Migrator) AddColumn

func (m Migrator) AddColumn(value interface{}, field string) error

func (Migrator) AutoMigrate

func (m Migrator) AutoMigrate(values ...interface{}) error

func (Migrator) BuildIndexOptions

func (m Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{})

func (Migrator) ColumnTypes

func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType, err error)

func (Migrator) CreateIndex

func (m Migrator) CreateIndex(value interface{}, name string) error

func (Migrator) CreateTable

func (m Migrator) CreateTable(values ...interface{}) error

CreateTable from gorm@v1.22.3/migrator/migrator.go

func (Migrator) CurrentDatabase

func (m Migrator) CurrentDatabase() (name string)

func (Migrator) CurrentSchema

func (m Migrator) CurrentSchema(stmt *gorm.Statement, table string) (interface{}, interface{})

func (Migrator) DropIndex

func (m Migrator) DropIndex(value interface{}, name string) error

func (Migrator) DropTable

func (m Migrator) DropTable(values ...interface{}) error

func (Migrator) GetTables

func (m Migrator) GetTables() (tableList []string, err error)

func (Migrator) HasColumn

func (m Migrator) HasColumn(value interface{}, field string) bool

func (Migrator) HasConstraint

func (m Migrator) HasConstraint(value interface{}, name string) bool

func (Migrator) HasIndex

func (m Migrator) HasIndex(value interface{}, name string) bool

func (Migrator) HasTable

func (m Migrator) HasTable(value interface{}) bool

func (Migrator) MigrateColumn

func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnType gorm.ColumnType) error

func (Migrator) RenameIndex

func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error

Jump to

Keyboard shortcuts

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