rename mysql variable
This commit is contained in:
parent
bba832e6bf
commit
bc53e119ca
|
@ -21,12 +21,12 @@ type MySQL struct {
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *MySQL) Type() string {
|
func (m *MySQL) Type() string {
|
||||||
return mySQLTypeName
|
return mySQLTypeName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *MySQL) getConnection() (*sql.DB, error) {
|
func (m *MySQL) getConnection() (*sql.DB, error) {
|
||||||
db, err := p.Connection()
|
db, err := m.Connection()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -34,17 +34,17 @@ func (p *MySQL) getConnection() (*sql.DB, error) {
|
||||||
return db.(*sql.DB), nil
|
return db.(*sql.DB), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *MySQL) CreateUser(createStmts, rollbackStmts, username, password, expiration string) error {
|
func (m *MySQL) CreateUser(createStmts, rollbackStmts, username, password, expiration string) error {
|
||||||
// Get the connection
|
// Get the connection
|
||||||
db, err := p.getConnection()
|
db, err := m.getConnection()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is racey
|
// TODO: This is racey
|
||||||
// Grab a read lock
|
// Grab a read lock
|
||||||
p.RLock()
|
m.RLock()
|
||||||
defer p.RUnlock()
|
defer m.RUnlock()
|
||||||
|
|
||||||
// Start a transaction
|
// Start a transaction
|
||||||
tx, err := db.Begin()
|
tx, err := db.Begin()
|
||||||
|
@ -82,20 +82,20 @@ func (p *MySQL) CreateUser(createStmts, rollbackStmts, username, password, expir
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOOP
|
// NOOP
|
||||||
func (p *MySQL) RenewUser(username, expiration string) error {
|
func (m *MySQL) RenewUser(username, expiration string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *MySQL) RevokeUser(username, revocationStmts string) error {
|
func (m *MySQL) RevokeUser(username, revocationStmts string) error {
|
||||||
// Get the connection
|
// Get the connection
|
||||||
db, err := p.getConnection()
|
db, err := m.getConnection()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the read lock
|
// Grab the read lock
|
||||||
p.RLock()
|
m.RLock()
|
||||||
defer p.RUnlock()
|
defer m.RUnlock()
|
||||||
|
|
||||||
// Use a default SQL statement for revocation if one cannot be fetched from the role
|
// Use a default SQL statement for revocation if one cannot be fetched from the role
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue