Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeDatabase ¶
func InitializeDatabase(p *RootProvider)
InitializeDatabase define the user table properties
Types ¶
type DatabaseType ¶
type DatabaseType int
DatabaseType represent a database type
const ( // Unknown represent a non-handled database Unknown DatabaseType = iota // SQLite represent a SQLite database SQLite // MySQL represent a MySQL database MySQL )
type DefaultConfig ¶
type DefaultConfig struct { CreateTablesIfNotExists bool `json:"-"` DropTablesIfExists bool `json:"-"` }
DefaultConfig is the configuration needed for running every database
type MySQLConfig ¶
type MySQLConfig struct { DefaultConfig Username string `json:"username"` Password string `json:"password"` Address string `json:"address"` Database string `json:"database"` }
MySQLConfig is the configuration needed for running an MySQL database
type RootProvider ¶
type RootProvider struct { Type DatabaseType DB *gorm.DB Config interface{} }
RootProvider contains all the methods and properties needed to manage a database
var ( // RP is the selected database RP *RootProvider // ErrRPIsNil is the error throwed when RP is nil ErrRPIsNil = errors.New("database is nil") )
type SQLiteConfig ¶
type SQLiteConfig struct { DefaultConfig Filepath string `json:"file" validate:"file=omitempty+readable:createifmissing"` }
SQLiteConfig is the configuration needed for running an SQLite database
type TablesManagement ¶
type TablesManagement interface { CreateTables() (err error) DropTables() (err error) CreateIndexes() (err error) }
TablesManagement contains all the required tables needed to manage tables
Click to show internal directories.
Click to hide internal directories.