dialect

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialector

type Dialector struct {
	DSN  string
	Conn gorm.ConnPool
	// contains filtered or unexported fields
}

Dialector is implementation of gorm.Dialector.

func New

func New(dsn string, opts ...Option) *Dialector

New is constructor for Dialector.

func (Dialector) BindVarTo

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

func (Dialector) ClauseBuilders

func (d Dialector) ClauseBuilders() map[string]clause.ClauseBuilder

func (Dialector) DataTypeOf

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

func (Dialector) DefaultValueOf

func (d Dialector) DefaultValueOf(_ *schema.Field) clause.Expression

func (Dialector) Explain

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

func (Dialector) Initialize

func (d Dialector) Initialize(db *gorm.DB) error

func (Dialector) Migrator

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

func (Dialector) Name

func (d Dialector) Name() string

func (Dialector) QuoteTo

func (d Dialector) QuoteTo(writer clause.Writer, s string)

type Migrator

type Migrator struct {
	migrator.Migrator
	// contains filtered or unexported fields
}

Migrator is wrapper for gorm.Migrator.

func (Migrator) AddColumn

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

AddColumn create `name` column for value.

func (Migrator) AlterColumn

func (m Migrator) AlterColumn(_ interface{}, field string) error

AlterColumn alter value's `field` column type based on schema definition.

func (Migrator) ColumnTypes

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

ColumnTypes return columnTypes []gorm.ColumnType and execErr error.

func (Migrator) CreateTable

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

CreateTable create table in database for values.

func (Migrator) DropColumn

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

DropColumn drop value's `name` column.

func (Migrator) DropTable

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

DropTable drop table for values.

func (Migrator) FullDataTypeOf

func (m Migrator) FullDataTypeOf(field *schema.Field) (expr clause.Expr)

FullDataTypeOf returns field's db full data type.

func (Migrator) HasTable

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

HasTable returns table exists or not for value, value could be a struct or string.

type Option

type Option func(d *Dialector)

Option is option for Dialector New constructor.

func With

func With(opts ...ydb.Option) Option

With apply ydb.Option to Dialector.

func WithConnMaxIdleTime

func WithConnMaxIdleTime(connMaxIdleTime time.Duration) Option

WithConnMaxIdleTime apply max idle time to Dialector.

func WithMaxIdleConns

func WithMaxIdleConns(maxIdleConns int) Option

WithMaxIdleConns apply max idle conns to Dialector.

func WithMaxOpenConns

func WithMaxOpenConns(maxOpenConns int) Option

WithMaxOpenConns apply max open conns to Dialector.

func WithTablePathPrefix

func WithTablePathPrefix(tablePathPrefix string) Option

WithTablePathPrefix apply table path prefix to Dialector.

Jump to

Keyboard shortcuts

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