From 19650ab7705f6f1ef58eb3f945b0110ea1e9248a Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 21 Nov 2016 18:43:15 +0000 Subject: [PATCH] Remove POLICY from SQL DEFINE SCOPE statement --- sql/ast.go | 15 +++++++-------- sql/cork.go | 2 -- sql/scope.go | 8 +------- sql/tokens.go | 2 -- 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/sql/ast.go b/sql/ast.go index 76af26e5..2cbbe3e7 100644 --- a/sql/ast.go +++ b/sql/ast.go @@ -256,14 +256,13 @@ type RemoveTokenStatement struct { // DefineScopeStatement represents an SQL DEFINE SCOPE statement. type DefineScopeStatement struct { - KV string `cork:"-" codec:"-"` - NS string `cork:"-" codec:"-"` - DB string `cork:"-" codec:"-"` - Name string `cork:"name" codec:"name"` - Time time.Duration `cork:"time" codec:"time"` - Signup Expr `cork:"signup" codec:"signup"` - Signin Expr `cork:"signin" codec:"signin"` - Policy map[string]interface{} `cork:"policy" codec:"policy"` + KV string `cork:"-" codec:"-"` + NS string `cork:"-" codec:"-"` + DB string `cork:"-" codec:"-"` + Name string `cork:"name" codec:"name"` + Time time.Duration `cork:"time" codec:"time"` + Signup Expr `cork:"signup" codec:"signup"` + Signin Expr `cork:"signin" codec:"signin"` } // RemoveScopeStatement represents an SQL REMOVE SCOPE statement. diff --git a/sql/cork.go b/sql/cork.go index 1665412c..deb478c1 100644 --- a/sql/cork.go +++ b/sql/cork.go @@ -1201,7 +1201,6 @@ func (this *DefineScopeStatement) MarshalCORK() (dst []byte, err error) { e.Encode(this.Time) e.Encode(this.Signup) e.Encode(this.Signin) - e.Encode(this.Policy) return b.Bytes(), nil } @@ -1212,7 +1211,6 @@ func (this *DefineScopeStatement) UnmarshalCORK(src []byte) (err error) { d.Decode(&this.Time) d.Decode(&this.Signup) d.Decode(&this.Signin) - d.Decode(&this.Policy) return } diff --git a/sql/scope.go b/sql/scope.go index a8cfdc2a..d1284615 100644 --- a/sql/scope.go +++ b/sql/scope.go @@ -28,7 +28,7 @@ func (p *parser) parseDefineScopeStatement() (stmt *DefineScopeStatement, err er for { - tok, _, exi := p.mightBe(SESSION, POLICY, SIGNUP, SIGNIN) + tok, _, exi := p.mightBe(SESSION, SIGNUP, SIGNIN) if !exi { break } @@ -39,12 +39,6 @@ func (p *parser) parseDefineScopeStatement() (stmt *DefineScopeStatement, err er } } - if p.is(tok, POLICY) { - if stmt.Policy, err = p.parseObject(); err != nil { - return nil, err - } - } - if p.is(tok, SIGNUP) { _, _, _ = p.mightBe(AS) if stmt.Signup, err = p.parseExpr(); err != nil { diff --git a/sql/tokens.go b/sql/tokens.go index e1e63544..5e60fd1c 100644 --- a/sql/tokens.go +++ b/sql/tokens.go @@ -157,7 +157,6 @@ const ( OR ORDER PASSWORD - POLICY READONLY REJECT RELATE @@ -321,7 +320,6 @@ var tokens = [...]string{ OR: "OR", ORDER: "ORDER", PASSWORD: "PASSWORD", - POLICY: "POLICY", READONLY: "READONLY", REJECT: "REJECT", RELATE: "RELATE",