Use ‘access’ variable name instead of ‘options’ on parser object
This commit is contained in:
parent
33ba4d5de3
commit
261aff0ee2
23 changed files with 50 additions and 50 deletions
|
@ -33,17 +33,17 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// options represents context runtime config.
|
// options represents context runtime config.
|
||||||
type options struct {
|
type access struct {
|
||||||
auth *cnf.Auth
|
auth *cnf.Auth
|
||||||
}
|
}
|
||||||
|
|
||||||
func newOptions(c *fibre.Context) *options {
|
func newAccess(c *fibre.Context) *access {
|
||||||
return &options{
|
return &access{
|
||||||
auth: c.Get("auth").(*cnf.Auth),
|
auth: c.Get("auth").(*cnf.Auth),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *options) get(kind int) (kv, ns, db string, err error) {
|
func (o *access) get(kind int) (kv, ns, db string, err error) {
|
||||||
|
|
||||||
kv = cnf.Settings.DB.Base
|
kv = cnf.Settings.DB.Base
|
||||||
ns = o.auth.Selected.NS
|
ns = o.auth.Selected.NS
|
||||||
|
@ -68,7 +68,7 @@ func (o *options) get(kind int) (kv, ns, db string, err error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *options) ns(ns string) (err error) {
|
func (o *access) ns(ns string) (err error) {
|
||||||
|
|
||||||
// Check to see that the current user has
|
// Check to see that the current user has
|
||||||
// the necessary authentication privileges
|
// the necessary authentication privileges
|
||||||
|
@ -94,7 +94,7 @@ func (o *options) ns(ns string) (err error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *options) db(db string) (err error) {
|
func (o *access) db(db string) (err error) {
|
||||||
|
|
||||||
// Check to see that the current user has
|
// Check to see that the current user has
|
||||||
// the necessary authentication privileges
|
// the necessary authentication privileges
|
|
@ -18,7 +18,7 @@ func (p *parser) parseCreateStatement() (stmt *CreateStatement, err error) {
|
||||||
|
|
||||||
stmt = &CreateStatement{}
|
stmt = &CreateStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDefineDatabaseStatement() (stmt *DefineDatabaseStatement,
|
||||||
|
|
||||||
stmt = &DefineDatabaseStatement{}
|
stmt = &DefineDatabaseStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func (p *parser) parseRemoveDatabaseStatement() (stmt *RemoveDatabaseStatement,
|
||||||
|
|
||||||
stmt = &RemoveDatabaseStatement{}
|
stmt = &RemoveDatabaseStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDeleteStatement() (stmt *DeleteStatement, err error) {
|
||||||
|
|
||||||
stmt = &DeleteStatement{}
|
stmt = &DeleteStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDefineEventStatement() (stmt *DefineEventStatement, err er
|
||||||
|
|
||||||
stmt = &DefineEventStatement{}
|
stmt = &DefineEventStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ func (p *parser) parseRemoveEventStatement() (stmt *RemoveEventStatement, err er
|
||||||
|
|
||||||
stmt = &RemoveEventStatement{}
|
stmt = &RemoveEventStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDefineFieldStatement() (stmt *DefineFieldStatement, err er
|
||||||
|
|
||||||
stmt = &DefineFieldStatement{}
|
stmt = &DefineFieldStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ func (p *parser) parseRemoveFieldStatement() (stmt *RemoveFieldStatement, err er
|
||||||
|
|
||||||
stmt = &RemoveFieldStatement{}
|
stmt = &RemoveFieldStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDefineIndexStatement() (stmt *DefineIndexStatement, err er
|
||||||
|
|
||||||
stmt = &DefineIndexStatement{}
|
stmt = &DefineIndexStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ func (p *parser) parseRemoveIndexStatement() (stmt *RemoveIndexStatement, err er
|
||||||
|
|
||||||
stmt = &RemoveIndexStatement{}
|
stmt = &RemoveIndexStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
sql/info.go
10
sql/info.go
|
@ -27,25 +27,25 @@ func (p *parser) parseInfoStatement() (stmt *InfoStatement, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, ALL) {
|
if is(stmt.Kind, ALL) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthKV); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthKV); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, NAMESPACE, NS) {
|
if is(stmt.Kind, NAMESPACE, NS) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, DATABASE, DB) {
|
if is(stmt.Kind, DATABASE, DB) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, SCOPE) {
|
if is(stmt.Kind, SCOPE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if stmt.What, err = p.parseIdent(); err != nil {
|
if stmt.What, err = p.parseIdent(); err != nil {
|
||||||
|
@ -54,7 +54,7 @@ func (p *parser) parseInfoStatement() (stmt *InfoStatement, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, TABLE) {
|
if is(stmt.Kind, TABLE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if stmt.What, err = p.parseIdent(); err != nil {
|
if stmt.What, err = p.parseIdent(); err != nil {
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseInsertStatement() (stmt *InsertStatement, err error) {
|
||||||
|
|
||||||
stmt = &InsertStatement{}
|
stmt = &InsertStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseLetStatement() (stmt *LetStatement, err error) {
|
||||||
|
|
||||||
stmt = &LetStatement{}
|
stmt = &LetStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseLiveStatement() (stmt *LiveStatement, err error) {
|
||||||
|
|
||||||
stmt = &LiveStatement{}
|
stmt = &LiveStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ func (p *parser) parseKillStatement() (stmt *KillStatement, err error) {
|
||||||
|
|
||||||
stmt = &KillStatement{}
|
stmt = &KillStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,13 @@ func (p *parser) parseDefineLoginStatement() (stmt *DefineLoginStatement, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, NAMESPACE) {
|
if is(stmt.Kind, NAMESPACE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, DATABASE) {
|
if is(stmt.Kind, DATABASE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,13 +80,13 @@ func (p *parser) parseRemoveLoginStatement() (stmt *RemoveLoginStatement, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, NAMESPACE) {
|
if is(stmt.Kind, NAMESPACE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, DATABASE) {
|
if is(stmt.Kind, DATABASE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDefineNamespaceStatement() (stmt *DefineNamespaceStatement
|
||||||
|
|
||||||
stmt = &DefineNamespaceStatement{}
|
stmt = &DefineNamespaceStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthKV); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthKV); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func (p *parser) parseRemoveNamespaceStatement() (stmt *RemoveNamespaceStatement
|
||||||
|
|
||||||
stmt = &RemoveNamespaceStatement{}
|
stmt = &RemoveNamespaceStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthKV); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthKV); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import (
|
||||||
// parser represents a parser.
|
// parser represents a parser.
|
||||||
type parser struct {
|
type parser struct {
|
||||||
s *scanner
|
s *scanner
|
||||||
o *options
|
a *access
|
||||||
c *fibre.Context
|
c *fibre.Context
|
||||||
buf struct {
|
buf struct {
|
||||||
n int // buffer size
|
n int // buffer size
|
||||||
|
@ -55,7 +55,7 @@ func Parse(c *fibre.Context, i interface{}) (*Query, error) {
|
||||||
|
|
||||||
// newParser returns a new instance of Parser.
|
// newParser returns a new instance of Parser.
|
||||||
func newParser(c *fibre.Context) *parser {
|
func newParser(c *fibre.Context) *parser {
|
||||||
return &parser{c: c, o: newOptions(c)}
|
return &parser{c: c, a: newAccess(c)}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseBytes parses a byte array.
|
// parseBytes parses a byte array.
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseRelateStatement() (stmt *RelateStatement, err error) {
|
||||||
|
|
||||||
stmt = &RelateStatement{}
|
stmt = &RelateStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseReturnStatement() (stmt *ReturnStatement, err error) {
|
||||||
|
|
||||||
stmt = &ReturnStatement{}
|
stmt = &ReturnStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDefineScopeStatement() (stmt *DefineScopeStatement, err er
|
||||||
|
|
||||||
stmt = &DefineScopeStatement{}
|
stmt = &DefineScopeStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ func (p *parser) parseRemoveScopeStatement() (stmt *RemoveScopeStatement, err er
|
||||||
|
|
||||||
stmt = &RemoveScopeStatement{}
|
stmt = &RemoveScopeStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseSelectStatement() (stmt *SelectStatement, err error) {
|
||||||
|
|
||||||
stmt = &SelectStatement{}
|
stmt = &SelectStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseDefineTableStatement() (stmt *DefineTableStatement, err er
|
||||||
|
|
||||||
stmt = &DefineTableStatement{}
|
stmt = &DefineTableStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ func (p *parser) parseRemoveTableStatement() (stmt *RemoveTableStatement, err er
|
||||||
|
|
||||||
stmt = &RemoveTableStatement{}
|
stmt = &RemoveTableStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
sql/token.go
12
sql/token.go
|
@ -33,19 +33,19 @@ func (p *parser) parseDefineTokenStatement() (stmt *DefineTokenStatement, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, NAMESPACE) {
|
if is(stmt.Kind, NAMESPACE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, DATABASE) {
|
if is(stmt.Kind, DATABASE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, SCOPE) {
|
if is(stmt.Kind, SCOPE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if stmt.What, err = p.parseIdent(); err != nil {
|
if stmt.What, err = p.parseIdent(); err != nil {
|
||||||
|
@ -105,19 +105,19 @@ func (p *parser) parseRemoveTokenStatement() (stmt *RemoveTokenStatement, err er
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, NAMESPACE) {
|
if is(stmt.Kind, NAMESPACE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, DATABASE) {
|
if is(stmt.Kind, DATABASE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if is(stmt.Kind, SCOPE) {
|
if is(stmt.Kind, SCOPE) {
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthDB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if stmt.What, err = p.parseIdent(); err != nil {
|
if stmt.What, err = p.parseIdent(); err != nil {
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseUpdateStatement() (stmt *UpdateStatement, err error) {
|
||||||
|
|
||||||
stmt = &UpdateStatement{}
|
stmt = &UpdateStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ func (p *parser) parseUpsertStatement() (stmt *UpsertStatement, err error) {
|
||||||
|
|
||||||
stmt = &UpsertStatement{}
|
stmt = &UpsertStatement{}
|
||||||
|
|
||||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
if stmt.KV, stmt.NS, stmt.DB, err = p.a.get(AuthNO); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ func (p *parser) parseUseStatement() (stmt *UseStatement, err error) {
|
||||||
return nil, &ParseError{Expected: []string{"namespace name"}, Found: stmt.NS}
|
return nil, &ParseError{Expected: []string{"namespace name"}, Found: stmt.NS}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = p.o.ns(stmt.NS); err != nil {
|
if err = p.a.ns(stmt.NS); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ func (p *parser) parseUseStatement() (stmt *UseStatement, err error) {
|
||||||
return nil, &ParseError{Expected: []string{"database name"}, Found: stmt.DB}
|
return nil, &ParseError{Expected: []string{"database name"}, Found: stmt.DB}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = p.o.db(stmt.DB); err != nil {
|
if err = p.a.db(stmt.DB); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue