dialect

package
v0.0.0-...-0764311 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name      string
	Nullable  bool
	DataType  string
	TableName string
	Position  int64
}

Column contains the definition of a column table.

type Columns

type Columns []Column

Columns contains a set of columns.

func (Columns) Get

func (c Columns) Get(name string) Column

Get returns a Column with its name.

func (Columns) Len

func (c Columns) Len() int

func (Columns) Less

func (c Columns) Less(i, j int) bool

func (Columns) Swap

func (c Columns) Swap(i, j int)

type Dialect

type Dialect interface {
	Close(context.Context) error
	ReferenceKeys(context.Context, string) (ReferenceKeys, error)
	ForeignKeys(context.Context, string) (ForeignKeys, error)
	PrimaryKeyConstraint(context.Context, string) (string, error)
	Tables(context.Context) (Tables, error)
	Table(context.Context, string) (Table, error)
	Columns(context.Context, string) ([]Column, error)
	BulkInsert(context.Context, Table, []map[string]interface{}) error
	ResultSet(context.Context, string, ...interface{}) ([]map[string]interface{}, error)
}

Dialect is the main interface to interact with RDMS.

type ForeignKey

type ForeignKey struct {
	Name                 string
	Definition           string
	ColumnName           string
	ReferencedTableName  string
	ReferencedTable      Table
	ReferencedColumnName string
}

ForeignKey contains the definition of a foreign key column.

func (ForeignKey) String

func (f ForeignKey) String() string

String returns the string representation of a ForeignKey.

type ForeignKeys

type ForeignKeys []ForeignKey

ForeignKeys contains a set of ForeignKey.

type PrimaryKey

type PrimaryKey struct {
	Name      string
	DataType  string
	TableName string
}

PrimaryKey contains the defintiion of a primary key column.

func (PrimaryKey) String

func (f PrimaryKey) String() string

String returns the string representation of a Primarykey.

type ReferenceKey

type ReferenceKey struct {
	Name       string
	Table      Table
	TableName  string
	ColumnName string
}

ReferenceKey contains the definition of a reference key.

func (ReferenceKey) String

func (f ReferenceKey) String() string

String returns the string representation of a ReferenceKey.

type ReferenceKeys

type ReferenceKeys []ReferenceKey

ReferenceKeys contains a set of ReferenceKey.

type Table

type Table struct {
	Name          string
	PrimaryKeys   []PrimaryKey
	Columns       Columns
	ForeignKeys   ForeignKeys
	ReferenceKeys ReferenceKeys
}

Table contains the definition of a database table.

func (Table) PrimaryKeyColumnName

func (t Table) PrimaryKeyColumnName() string

PrimaryKeyColumnName returns the primary key column name.

type Tables

type Tables []Table

Tables contains a set of tables.

func (Tables) Get

func (t Tables) Get(tableName string) Table

Get returns a Table with its name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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