Documentation ¶
Index ¶
- func New(s *configurations.Settings) contract.Database
- type GeneralDatabases
- type MySQL
- func (mysql *MySQL) Connect() error
- func (mysql *MySQL) DSN() string
- func (mysql *MySQL) GetColumnsOfTable(table *object_model.Table) (err error)
- func (mysql *MySQL) GetDriverImportLibrary() string
- func (mysql *MySQL) GetFloatDatatypes() []string
- func (mysql *MySQL) GetIntegerDatatypes() []string
- func (mysql *MySQL) GetStringDatatypes() []string
- func (mysql *MySQL) GetTables() (tables []*object_model.Table, err error)
- func (mysql *MySQL) GetTemporalDatatypes() []string
- func (mysql *MySQL) GetTemporalDriverDataType() string
- func (mysql *MySQL) GetTextDatatypes() []string
- func (mysql *MySQL) IsAutoIncrement(column object_model.Column) bool
- func (mysql *MySQL) IsFloat(column object_model.Column) bool
- func (mysql *MySQL) IsInteger(column object_model.Column) bool
- func (mysql *MySQL) IsPrimaryKey(column object_model.Column) bool
- func (mysql *MySQL) IsString(column object_model.Column) bool
- func (mysql *MySQL) IsTemporal(column object_model.Column) bool
- func (mysql *MySQL) IsText(column object_model.Column) bool
- func (mysql *MySQL) PrepareGetColumnsOfTableStmt() (err error)
- type Postgresql
- func (pg *Postgresql) Connect() error
- func (pg *Postgresql) DSN() string
- func (pg *Postgresql) GetColumnsOfTable(table *object_model.Table) (err error)
- func (pg *Postgresql) GetDriverImportLibrary() string
- func (pg *Postgresql) GetFloatDatatypes() []string
- func (pg *Postgresql) GetIntegerDatatypes() []string
- func (pg *Postgresql) GetStringDatatypes() []string
- func (pg *Postgresql) GetTables() (tables []*object_model.Table, err error)
- func (pg *Postgresql) GetTemporalDatatypes() []string
- func (pg *Postgresql) GetTemporalDriverDataType() string
- func (pg *Postgresql) GetTextDatatypes() []string
- func (pg *Postgresql) IsAutoIncrement(column object_model.Column) bool
- func (pg *Postgresql) IsFloat(column object_model.Column) bool
- func (pg *Postgresql) IsInteger(column object_model.Column) bool
- func (pg *Postgresql) IsPrimaryKey(column object_model.Column) bool
- func (pg *Postgresql) IsString(column object_model.Column) bool
- func (pg *Postgresql) IsTemporal(column object_model.Column) bool
- func (pg *Postgresql) IsText(column object_model.Column) bool
- func (pg *Postgresql) PrepareGetColumnsOfTableStmt() (err error)
- type SQLite
- func (s *SQLite) Connect() (err error)
- func (s *SQLite) DSN() string
- func (s *SQLite) GetColumnsOfTable(table *object_model.Table) (err error)
- func (s *SQLite) GetDriverImportLibrary() string
- func (s *SQLite) GetFloatDatatypes() []string
- func (s *SQLite) GetIntegerDatatypes() []string
- func (s *SQLite) GetStringDatatypes() []string
- func (s *SQLite) GetTables() (tables []*object_model.Table, err error)
- func (s *SQLite) GetTemporalDatatypes() []string
- func (s *SQLite) GetTemporalDriverDataType() string
- func (s *SQLite) GetTextDatatypes() []string
- func (s *SQLite) IsAutoIncrement(column object_model.Column) bool
- func (s *SQLite) IsFloat(column object_model.Column) bool
- func (s *SQLite) IsInteger(column object_model.Column) bool
- func (s *SQLite) IsPrimaryKey(column object_model.Column) bool
- func (s *SQLite) IsString(column object_model.Column) bool
- func (s *SQLite) IsTemporal(column object_model.Column) bool
- func (s *SQLite) IsText(column object_model.Column) bool
- func (s *SQLite) PrepareGetColumnsOfTableStmt() (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GeneralDatabases ¶
type GeneralDatabases struct { GetColumnsOfTableStmt *sqlx.Stmt *sqlx.DB *configurations.Settings // contains filtered or unexported fields }
GeneralDatabases represents a base "class" database - for all other concrete databases it implements partly the Database interface
func (*GeneralDatabases) Close ¶
func (gdb *GeneralDatabases) Close() error
Close closes the database connection
func (*GeneralDatabases) Connect ¶
func (gdb *GeneralDatabases) Connect(dsn string) (err error)
Connect establishes a connection to the database with the given DSN. It pings the database to ensure it is reachable.
func (*GeneralDatabases) IsNullable ¶
func (gdb *GeneralDatabases) IsNullable(column object_model.Column) bool
IsNullable returns true if column is a nullable one
func (*GeneralDatabases) IsStringInSlice ¶
func (gdb *GeneralDatabases) IsStringInSlice(needle string, haystack []string) bool
IsStringInSlice checks if needle (string) is in haystack ([]string)
type MySQL ¶
type MySQL struct {
*GeneralDatabases
}
MySQL implemenmts the Database interface with help of generalDatabase
func NewMySQL ¶
func NewMySQL(s *configurations.Settings) *MySQL
NewMySQL creates a new MySQL database
func (*MySQL) Connect ¶
Connect connects to the database by the given data source name (dsn) of the concrete database
func (*MySQL) GetColumnsOfTable ¶
func (mysql *MySQL) GetColumnsOfTable(table *object_model.Table) (err error)
GetColumnsOfTable executes the statement for retrieving the columns of a specific table for a given database
func (*MySQL) GetDriverImportLibrary ¶
GetDriverImportLibrary returns the golang sql driver specific fot the MySQL database
func (*MySQL) GetFloatDatatypes ¶
GetFloatDatatypes returns the float datatypes for the MySQL database
func (*MySQL) GetIntegerDatatypes ¶
GetIntegerDatatypes returns the integer datatypes for the MySQL database
func (*MySQL) GetStringDatatypes ¶
GetStringDatatypes returns the string datatypes for the MySQL database
func (*MySQL) GetTables ¶
func (mysql *MySQL) GetTables() (tables []*object_model.Table, err error)
GetTables gets all tables for a given database by name
func (*MySQL) GetTemporalDatatypes ¶
GetTemporalDatatypes returns the temporal datatypes for the MySQL database
func (*MySQL) GetTemporalDriverDataType ¶
GetTemporalDriverDataType returns the time data type specific for the MySQL database
func (*MySQL) GetTextDatatypes ¶
GetTextDatatypes returns the text datatypes for the MySQL database
func (*MySQL) IsAutoIncrement ¶
func (mysql *MySQL) IsAutoIncrement(column object_model.Column) bool
IsAutoIncrement checks if column is a auto_increment column
func (*MySQL) IsFloat ¶
func (mysql *MySQL) IsFloat(column object_model.Column) bool
IsFloat returns true if colum is of type float for the MySQL database
func (*MySQL) IsInteger ¶
func (mysql *MySQL) IsInteger(column object_model.Column) bool
IsInteger returns true if colum is of type integer for the MySQL database
func (*MySQL) IsPrimaryKey ¶
func (mysql *MySQL) IsPrimaryKey(column object_model.Column) bool
IsPrimaryKey checks if column belongs to primary key
func (*MySQL) IsString ¶
func (mysql *MySQL) IsString(column object_model.Column) bool
IsString returns true if colum is of type string for the MySQL database
func (*MySQL) IsTemporal ¶
func (mysql *MySQL) IsTemporal(column object_model.Column) bool
IsTemporal returns true if colum is of type temporal for the MySQL database
func (*MySQL) IsText ¶
func (mysql *MySQL) IsText(column object_model.Column) bool
IsText returns true if colum is of type text for the MySQL database
func (*MySQL) PrepareGetColumnsOfTableStmt ¶
PrepareGetColumnsOfTableStmt prepares the statement for retrieving the columns of a specific table for a given database
type Postgresql ¶
type Postgresql struct { *GeneralDatabases // contains filtered or unexported fields }
Postgresql implemenmts the Database interface with help of generalDatabase
func NewPostgresql ¶
func NewPostgresql(s *configurations.Settings) *Postgresql
NewPostgresql creates a new Postgresql database
func (*Postgresql) Connect ¶
func (pg *Postgresql) Connect() error
Connect connects to the database by the given data source name (dsn) of the concrete database
func (*Postgresql) DSN ¶
func (pg *Postgresql) DSN() string
DSN creates the DSN String to connect to this database
func (*Postgresql) GetColumnsOfTable ¶
func (pg *Postgresql) GetColumnsOfTable(table *object_model.Table) (err error)
GetColumnsOfTable executes the statement for retrieving the columns of a specific table in a given schema
func (*Postgresql) GetDriverImportLibrary ¶
func (pg *Postgresql) GetDriverImportLibrary() string
GetDriverImportLibrary returns the golang sql driver specific fot the MySQL database
func (*Postgresql) GetFloatDatatypes ¶
func (pg *Postgresql) GetFloatDatatypes() []string
GetFloatDatatypes returns the float datatypes for the postgre database
func (*Postgresql) GetIntegerDatatypes ¶
func (pg *Postgresql) GetIntegerDatatypes() []string
GetIntegerDatatypes returns the integer datatypes for the postgre database
func (*Postgresql) GetStringDatatypes ¶
func (pg *Postgresql) GetStringDatatypes() []string
GetStringDatatypes returns the string datatypes for the postgre database
func (*Postgresql) GetTables ¶
func (pg *Postgresql) GetTables() (tables []*object_model.Table, err error)
GetTables gets all tables for a given schema by name
func (*Postgresql) GetTemporalDatatypes ¶
func (pg *Postgresql) GetTemporalDatatypes() []string
GetTemporalDatatypes returns the temporal datatypes for the postgre database
func (*Postgresql) GetTemporalDriverDataType ¶
func (pg *Postgresql) GetTemporalDriverDataType() string
GetTemporalDriverDataType returns the time data type specific for the postgre database
func (*Postgresql) GetTextDatatypes ¶
func (pg *Postgresql) GetTextDatatypes() []string
GetTextDatatypes returns the text datatypes for the postgre database
func (*Postgresql) IsAutoIncrement ¶
func (pg *Postgresql) IsAutoIncrement(column object_model.Column) bool
IsAutoIncrement checks if column is a serial column
func (*Postgresql) IsFloat ¶
func (pg *Postgresql) IsFloat(column object_model.Column) bool
IsFloat returns true if colum is of type float for the postgre database
func (*Postgresql) IsInteger ¶
func (pg *Postgresql) IsInteger(column object_model.Column) bool
IsInteger returns true if colum is of type integer for the postgre database
func (*Postgresql) IsPrimaryKey ¶
func (pg *Postgresql) IsPrimaryKey(column object_model.Column) bool
IsPrimaryKey checks if column belongs to primary key
func (*Postgresql) IsString ¶
func (pg *Postgresql) IsString(column object_model.Column) bool
IsString returns true if colum is of type string for the postgre database
func (*Postgresql) IsTemporal ¶
func (pg *Postgresql) IsTemporal(column object_model.Column) bool
IsTemporal returns true if colum is of type temporal for the postgre database
func (*Postgresql) IsText ¶
func (pg *Postgresql) IsText(column object_model.Column) bool
IsText returns true if colum is of type text for the postgre database
func (*Postgresql) PrepareGetColumnsOfTableStmt ¶
func (pg *Postgresql) PrepareGetColumnsOfTableStmt() (err error)
PrepareGetColumnsOfTableStmt prepares the statement for retrieving the columns of a specific table for a given database
type SQLite ¶
type SQLite struct {
*GeneralDatabases
}
SQLite implemenmts the Database interface with help of generalDatabase
func NewSQLite ¶
func NewSQLite(s *configurations.Settings) *SQLite
NewSQLite creates a new SQLite database
func (*SQLite) GetColumnsOfTable ¶
func (s *SQLite) GetColumnsOfTable(table *object_model.Table) (err error)
func (*SQLite) GetDriverImportLibrary ¶
func (*SQLite) GetFloatDatatypes ¶
func (*SQLite) GetIntegerDatatypes ¶
func (*SQLite) GetStringDatatypes ¶
func (*SQLite) GetTemporalDatatypes ¶
func (*SQLite) GetTemporalDriverDataType ¶
func (*SQLite) GetTextDatatypes ¶
func (*SQLite) IsAutoIncrement ¶
func (s *SQLite) IsAutoIncrement(column object_model.Column) bool
func (*SQLite) IsPrimaryKey ¶
func (s *SQLite) IsPrimaryKey(column object_model.Column) bool
func (*SQLite) IsTemporal ¶
func (s *SQLite) IsTemporal(column object_model.Column) bool