database

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SanitizeValue

func SanitizeValue(value string) string

Types

type ColumnResult

type ColumnResult struct {
	Name     string
	DataType string
}

type Connector

type Connector interface {
	Connect() error
	Close()
	GetDbType() DbType
	GetSchemas() ([]string, error)
	GetTables(schemaName string) ([]string, error)
	GetColumns(tableName string) ([]ColumnResult, error)
	GetConstraints(tableName string) ([]ConstraintResult, error)
}

type ConnectorFactory

type ConnectorFactory interface {
	NewConnector(connectionString string) (Connector, error)
}

func NewConnectorFactory

func NewConnectorFactory() ConnectorFactory

type ConstraintResult

type ConstraintResult struct {
	FkTable        string
	PKTable        string
	ConstraintName string
	IsPrimary      bool
	HasMultiplePK  bool
}

type ConstraintResultList

type ConstraintResultList []ConstraintResult

func (ConstraintResultList) AppendIfNotExists

func (source ConstraintResultList) AppendIfNotExists(items ...ConstraintResult) ConstraintResultList

AppendIfNotExists ensures that only unique items are appended to the list of constraints

type DbType

type DbType string
const (
	Postgres DbType = "pgx"
	MySql    DbType = "mysql"
)

func (DbType) String

func (c DbType) String() string

type Result

type Result struct {
	Tables []TableResult
}

type TableResult

type TableResult struct {
	TableName   string
	Columns     []ColumnResult
	Constraints ConstraintResultList
}

Jump to

Keyboard shortcuts

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