/
mysql.go
49 lines (38 loc) · 924 Bytes
/
mysql.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package mysql
import (
_ "github.com/go-sql-driver/mysql"
"github.com/icinga/icinga-testing/services"
)
type Creator interface {
CreateMysqlDatabase() services.MysqlDatabaseBase
Cleanup()
}
// info serves as a base for implementing the MysqlDatabaseBase interface. Another struct can embed it and
// initialize it with values to implement all interface functions except Cleanup.
type info struct {
host string
port string
username string
password string
database string
}
func (m *info) Host() string {
return m.host
}
func (m *info) Port() string {
return m.port
}
func (m *info) Username() string {
return m.username
}
func (m *info) Password() string {
return m.password
}
func (m *info) Database() string {
return m.database
}
type mysqlDatabaseNopCleanup struct {
info
}
func (_ *mysqlDatabaseNopCleanup) Cleanup() {}
var _ services.MysqlDatabaseBase = (*mysqlDatabaseNopCleanup)(nil)