This commit is contained in:
John 2020-11-29 23:55:32 +08:00
parent 6f93bd17f2
commit 790a651ac1
2 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ const (
OPTION_ALLOWEMPTY = 2 OPTION_ALLOWEMPTY = 2
linkTypeMaster = 1 linkTypeMaster = 1
linkTypeMSlave = 2 linkTypeSlave = 2
whereHolderWhere = 1 whereHolderWhere = 1
whereHolderAnd = 2 whereHolderAnd = 2
whereHolderOr = 3 whereHolderOr = 3
@ -198,7 +198,7 @@ func (m *Model) Master() *Model {
// Note that it makes sense only if there's any slave node configured. // Note that it makes sense only if there's any slave node configured.
func (m *Model) Slave() *Model { func (m *Model) Slave() *Model {
model := m.getModel() model := m.getModel()
model.linkType = linkTypeMSlave model.linkType = linkTypeSlave
return model return model
} }

View File

@ -151,7 +151,7 @@ func (m *Model) getLink(master bool) Link {
if master { if master {
linkType = linkTypeMaster linkType = linkTypeMaster
} else { } else {
linkType = linkTypeMSlave linkType = linkTypeSlave
} }
} }
switch linkType { switch linkType {
@ -161,7 +161,7 @@ func (m *Model) getLink(master bool) Link {
panic(err) panic(err)
} }
return link return link
case linkTypeMSlave: case linkTypeSlave:
link, err := m.db.GetSlave(m.schema) link, err := m.db.GetSlave(m.schema)
if err != nil { if err != nil {
panic(err) panic(err)