Documentation ¶
Index ¶
- type DbAccess
- type DbPostgres
- func (d *DbPostgres) BlindExec(stmt string) error
- func (d *DbPostgres) Close()
- func (d *DbPostgres) CreateLogTable() error
- func (d *DbPostgres) DeleteLog(filename string) error
- func (d *DbPostgres) DropLogTable() error
- func (d *DbPostgres) GetLastLog() (string, error)
- func (d *DbPostgres) Init(conf schema.Conf) error
- func (d *DbPostgres) InsertLogs(filenames []string) error
- func (d *DbPostgres) ListAlreadyUp() ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DbAccess ¶
type DbAccess interface { Init(conf schema.Conf) error BlindExec(stmt string) error // meaning we trust our users to make it right CreateLogTable() error DropLogTable() error // mostly for testing, or if used as a library InsertLogs(filenames []string) error GetLastLog() (string, error) DeleteLog(filename string) error ListAlreadyUp() (filename []string, err error) Close() }
DbAccess is the main interface for our database to be properly used by `core`, a database connector should implement all of these below
type DbPostgres ¶
type DbPostgres struct {
// contains filtered or unexported fields
}
DbPostgres is the implementation of DbAccess interface for postgres
func (*DbPostgres) BlindExec ¶
func (d *DbPostgres) BlindExec(stmt string) error
BlindExec blindly executes (shocking, right?) the query in the files this is the EXPECTED behavior, as we want to allow people to write it in their database dialect directly
func (*DbPostgres) CreateLogTable ¶
func (d *DbPostgres) CreateLogTable() error
CreateLogTable generates the table to store logs in the database it will be named dbm_logs
func (*DbPostgres) DeleteLog ¶
func (d *DbPostgres) DeleteLog(filename string) error
DeleteLog removes the filename from the dbm_logs table
func (*DbPostgres) DropLogTable ¶
func (d *DbPostgres) DropLogTable() error
DropLogTable removes dbm_logs table
func (*DbPostgres) GetLastLog ¶
func (d *DbPostgres) GetLastLog() (string, error)
GetLastLog retrieves the last log from dbm_logs table
func (*DbPostgres) Init ¶
func (d *DbPostgres) Init(conf schema.Conf) error
Init creates the connection for target DB
func (*DbPostgres) InsertLogs ¶
func (d *DbPostgres) InsertLogs(filenames []string) error
InsertLogs adds the filenames to dbm_logs table
func (*DbPostgres) ListAlreadyUp ¶
func (d *DbPostgres) ListAlreadyUp() ([]string, error)
ListAlreadyUp retrieves all filenames in dbm_logs table filenames listed here mean those that has been applied to the database