firebird

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

gorm-firebird

GORM firebird driver (for Firebird 3.0)

import:

"github.com/flylink888/gorm-firebird"

Example:

var products []Product
dsn := "SYSDBA:masterkey@127.0.0.1/sysdb?charset=utf8"
db, err := gorm.Open(firebird.Open(dsn), &gorm.Config{
   NamingStrategy: firebird.NamingStrategy{},  //这个很重要
})
if err != nil {
	fmt.Println(err)
}
type Product struct {
Pid  string `gorm:"primaryKey"`
Name string
}
//这个不是必需的
func (Product) TableName() string {
return "PRODUCT"
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CreateClauses create clauses
	CreateClauses = []string{"INSERT", "VALUES", ""}
	// UpdateClauses update clauses
	UpdateClauses = []string{"UPDATE", "SET", "WHERE", "ORDER BY", "LIMIT"}
	// DeleteClauses delete clauses
	DeleteClauses = []string{"DELETE", "FROM", "WHERE", "ORDER BY", "LIMIT"}
)

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) AutoIncrement added in v1.0.5

func (c Column) AutoIncrement() (isAutoIncrement bool, ok bool)

func (Column) ColumnType added in v1.0.5

func (c Column) ColumnType() (columnType string, ok bool)

func (Column) Comment added in v1.0.5

func (c Column) Comment() (value string, ok bool)

func (Column) DatabaseTypeName

func (c Column) DatabaseTypeName() string

func (Column) DecimalSize

func (c Column) DecimalSize() (int64, int64, bool)

DecimalSize return precision int64, scale int64, ok bool

func (Column) DefaultValue added in v1.0.5

func (c Column) DefaultValue() (value string, ok bool)

func (Column) Length

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

func (Column) Name

func (c Column) Name() string

func (Column) Nullable

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

func (Column) PrimaryKey added in v1.0.5

func (c Column) PrimaryKey() (isPrimaryKey bool, ok bool)

func (Column) ScanType added in v1.0.5

func (c Column) ScanType() reflect.Type

func (Column) Unique added in v1.0.5

func (c Column) Unique() (unique bool, ok bool)

type Config

type Config struct {
	DriverName        string
	DSN               string
	DefaultStringSize int
	Conn              gorm.ConnPool
}

type Dialector

type Dialector struct {
	*Config
}

func (Dialector) Apply

func (dialector Dialector) Apply(config *gorm.Config) error

func (Dialector) BindVarTo

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

func (Dialector) ClauseBuilders

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

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) NowFunc

func (dialector Dialector) NowFunc(n int) func() time.Time

NowFunc return now func

func (Dialector) QuoteTo

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

type Migrator

type Migrator struct {
	migrator.Migrator
	Dialector
}

func (Migrator) AlterColumn

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

func (Migrator) ColumnTypes

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

ColumnTypes column types return columnTypes,error

func (Migrator) DropConstraint

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

func (Migrator) DropTable

func (m Migrator) DropTable(values ...interface{}) 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) RenameColumn

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

func (Migrator) RenameIndex

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

type NamingStrategy

type NamingStrategy struct {
	schema.NamingStrategy
}

func (NamingStrategy) CheckerName

func (ns NamingStrategy) CheckerName(table, column string) (name string)

func (NamingStrategy) ColumnName

func (ns NamingStrategy) ColumnName(table, column string) string

func (NamingStrategy) IndexName

func (ns NamingStrategy) IndexName(table, column string) (name string)

func (NamingStrategy) JoinTableName

func (ns NamingStrategy) JoinTableName(table string) (name string)

func (NamingStrategy) RelationshipFKName

func (ns NamingStrategy) RelationshipFKName(relationship schema.Relationship) (name string)

func (NamingStrategy) TableName

func (ns NamingStrategy) TableName(str string) string

Jump to

Keyboard shortcuts

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