forked from mirror/ledisdb
Use more standard go; camel case
This commit is contained in:
parent
d48cb8c773
commit
7e4bc199fb
|
@ -64,7 +64,7 @@ type client struct {
|
||||||
cmd string
|
cmd string
|
||||||
args [][]byte
|
args [][]byte
|
||||||
|
|
||||||
is_authed bool
|
isAuthed bool
|
||||||
|
|
||||||
resp responseWriter
|
resp responseWriter
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ func newClient(app *App) *client {
|
||||||
|
|
||||||
c.app = app
|
c.app = app
|
||||||
c.ldb = app.ldb
|
c.ldb = app.ldb
|
||||||
c.is_authed = false || c.authEnabled()
|
c.isAuthed = false || c.authEnabled()
|
||||||
c.db, _ = app.ldb.Select(0) //use default db
|
c.db, _ = app.ldb.Select(0) //use default db
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
@ -111,7 +111,7 @@ func (c *client) perform() {
|
||||||
err = ErrEmptyCommand
|
err = ErrEmptyCommand
|
||||||
} else if exeCmd, ok := regCmds[c.cmd]; !ok {
|
} else if exeCmd, ok := regCmds[c.cmd]; !ok {
|
||||||
err = ErrNotFound
|
err = ErrNotFound
|
||||||
} else if c.authEnabled() && !c.is_authed && c.cmd != "auth" {
|
} else if c.authEnabled() && !c.isAuthed && c.cmd != "auth" {
|
||||||
err = ErrNotAuthenticated
|
err = ErrNotAuthenticated
|
||||||
} else {
|
} else {
|
||||||
// if c.db.IsTransaction() {
|
// if c.db.IsTransaction() {
|
||||||
|
|
|
@ -20,11 +20,11 @@ func authCommand(c *client) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.app.cfg.AuthPassword == string(c.args[0]) {
|
if c.app.cfg.AuthPassword == string(c.args[0]) {
|
||||||
c.is_authed = true
|
c.isAuthed = true
|
||||||
c.resp.writeStatus(OK)
|
c.resp.writeStatus(OK)
|
||||||
return nil
|
return nil
|
||||||
} else {
|
} else {
|
||||||
c.is_authed = false
|
c.isAuthed = false
|
||||||
return ErrAuthenticationFailure
|
return ErrAuthenticationFailure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue