dialect

package
v0.0.0-...-d6a6539 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dialect provides an interface for different SQL dialects

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDialect

func RegisterDialect(name string, dialect Dialect)

RegisterDialect registers a new SQL dialect

Types

type Dialect

type Dialect interface {
	VersionSQL() string

	// DataTypeOf returns the SQL data type of the given Go data type
	DataTypeOf(typ reflect.Value) string

	// IsTableExistSQL returns the SQL query that checks if a table exists
	IsTableExistSQL(tableName string) string

	DropTableSQL(tableName string) string
}

Dialect is an interface that represents a SQL dialect

func GetDialect

func GetDialect(name string) (dialect Dialect, ok bool)

GetDialect retrieves a registered SQL dialect

type MysqlDialect

type MysqlDialect struct {
}

func (*MysqlDialect) DataTypeOf

func (mysql *MysqlDialect) DataTypeOf(typ reflect.Value) string

func (*MysqlDialect) DropTableSQL

func (mysql *MysqlDialect) DropTableSQL(tableName string) string

func (*MysqlDialect) IsTableExistSQL

func (mysql *MysqlDialect) IsTableExistSQL(tableName string) string

func (*MysqlDialect) VersionSQL

func (mysql *MysqlDialect) VersionSQL() string

Jump to

Keyboard shortcuts

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