-
Notifications
You must be signed in to change notification settings - Fork 14
/
option_ds.go
49 lines (40 loc) · 836 Bytes
/
option_ds.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 gobatis
type DSOption struct {
dss []*DataSource
showSQL bool
mappers []string
}
var _ IOption = &DSOption{}
func NewDSOption() *DSOption {
return &DSOption{}
}
func NewDSOption_(dss []*DataSource, showSQL bool, mappers []string) *DSOption {
return &DSOption{
dss: dss,
showSQL: showSQL,
mappers: mappers,
}
}
func (ds *DSOption) DS(dss []*DataSource) *DSOption {
ds.dss = dss
return ds
}
func (ds *DSOption) ShowSQL(showSQL bool) *DSOption {
ds.showSQL = showSQL
return ds
}
func (ds *DSOption) Mappers(mappers []string) *DSOption {
ds.mappers = mappers
return ds
}
func (ds *DSOption) Type() OptionType {
return OptionTypeDS
}
func (ds *DSOption) ToDBConf() *DBConfig {
dbconf := NewDBConfigBuilder().
DS(ds.dss).
ShowSQL(ds.showSQL).
Mappers(ds.mappers).
Build()
return dbconf
}