Improve statement read/write status detection
Only store read-write statement status in the database for statements which can be either read or write. For those statements which are always write statements (Live, Kill, Create, Update, Delete, Relate, Insert, Upsert, Define, Remove….), then hardcode this on the statement itself.
This commit is contained in:
parent
8de7424efb
commit
a569ad78d6
25 changed files with 2079 additions and 1635 deletions
3087
sql/ast.gen.go
3087
sql/ast.gen.go
File diff suppressed because it is too large
Load diff
27
sql/ast.go
27
sql/ast.go
|
@ -82,7 +82,6 @@ type UseStatement struct {
|
|||
|
||||
// InfoStatement represents an SQL INFO statement.
|
||||
type InfoStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -131,7 +130,6 @@ type ReturnStatement struct {
|
|||
|
||||
// LiveStatement represents a SQL LIVE statement.
|
||||
type LiveStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
ID string `cork:"ID" codec:"ID"`
|
||||
FB string `cork:"FB" codec:"FB"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
|
@ -145,7 +143,6 @@ type LiveStatement struct {
|
|||
|
||||
// KillStatement represents a SQL KILL statement.
|
||||
type KillStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
FB string `cork:"FB" codec:"FB"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
NS string `cork:"NS" codec:"NS"`
|
||||
|
@ -173,7 +170,6 @@ type SelectStatement struct {
|
|||
|
||||
// CreateStatement represents a SQL CREATE statement.
|
||||
type CreateStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
NS string `cork:"NS" codec:"NS"`
|
||||
DB string `cork:"DB" codec:"DB"`
|
||||
|
@ -186,7 +182,6 @@ type CreateStatement struct {
|
|||
|
||||
// UpdateStatement represents a SQL UPDATE statement.
|
||||
type UpdateStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
NS string `cork:"NS" codec:"NS"`
|
||||
DB string `cork:"DB" codec:"DB"`
|
||||
|
@ -200,7 +195,6 @@ type UpdateStatement struct {
|
|||
|
||||
// DeleteStatement represents a SQL DELETE statement.
|
||||
type DeleteStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
NS string `cork:"NS" codec:"NS"`
|
||||
DB string `cork:"DB" codec:"DB"`
|
||||
|
@ -214,7 +208,6 @@ type DeleteStatement struct {
|
|||
|
||||
// RelateStatement represents a SQL RELATE statement.
|
||||
type RelateStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
NS string `cork:"NS" codec:"NS"`
|
||||
DB string `cork:"DB" codec:"DB"`
|
||||
|
@ -230,7 +223,6 @@ type RelateStatement struct {
|
|||
|
||||
// InsertStatement represents a SQL INSERT statement.
|
||||
type InsertStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
NS string `cork:"NS" codec:"NS"`
|
||||
DB string `cork:"DB" codec:"DB"`
|
||||
|
@ -243,7 +235,6 @@ type InsertStatement struct {
|
|||
|
||||
// UpsertStatement represents a SQL UPSERT statement.
|
||||
type UpsertStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"KV" codec:"KV"`
|
||||
NS string `cork:"NS" codec:"NS"`
|
||||
DB string `cork:"DB" codec:"DB"`
|
||||
|
@ -259,7 +250,6 @@ type UpsertStatement struct {
|
|||
// --------------------------------------------------
|
||||
|
||||
type DefineNamespaceStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -267,7 +257,6 @@ type DefineNamespaceStatement struct {
|
|||
}
|
||||
|
||||
type RemoveNamespaceStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -279,7 +268,6 @@ type RemoveNamespaceStatement struct {
|
|||
// --------------------------------------------------
|
||||
|
||||
type DefineDatabaseStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -287,7 +275,6 @@ type DefineDatabaseStatement struct {
|
|||
}
|
||||
|
||||
type RemoveDatabaseStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -300,7 +287,6 @@ type RemoveDatabaseStatement struct {
|
|||
|
||||
// DefineLoginStatement represents an SQL DEFINE LOGIN statement.
|
||||
type DefineLoginStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -312,7 +298,6 @@ type DefineLoginStatement struct {
|
|||
|
||||
// RemoveLoginStatement represents an SQL REMOVE LOGIN statement.
|
||||
type RemoveLoginStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -326,7 +311,6 @@ type RemoveLoginStatement struct {
|
|||
|
||||
// DefineTokenStatement represents an SQL DEFINE TOKEN statement.
|
||||
type DefineTokenStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -338,7 +322,6 @@ type DefineTokenStatement struct {
|
|||
|
||||
// RemoveTokenStatement represents an SQL REMOVE TOKEN statement.
|
||||
type RemoveTokenStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -352,7 +335,6 @@ type RemoveTokenStatement struct {
|
|||
|
||||
// DefineScopeStatement represents an SQL DEFINE SCOPE statement.
|
||||
type DefineScopeStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -366,7 +348,6 @@ type DefineScopeStatement struct {
|
|||
|
||||
// RemoveScopeStatement represents an SQL REMOVE SCOPE statement.
|
||||
type RemoveScopeStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -379,7 +360,6 @@ type RemoveScopeStatement struct {
|
|||
|
||||
// DefineTableStatement represents an SQL DEFINE TABLE statement.
|
||||
type DefineTableStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -397,7 +377,6 @@ type DefineTableStatement struct {
|
|||
|
||||
// RemoveTableStatement represents an SQL REMOVE TABLE statement.
|
||||
type RemoveTableStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -410,7 +389,6 @@ type RemoveTableStatement struct {
|
|||
|
||||
// DefineEventStatement represents an SQL DEFINE EVENT statement.
|
||||
type DefineEventStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -422,7 +400,6 @@ type DefineEventStatement struct {
|
|||
|
||||
// RemoveEventStatement represents an SQL REMOVE EVENT statement.
|
||||
type RemoveEventStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -436,7 +413,6 @@ type RemoveEventStatement struct {
|
|||
|
||||
// DefineFieldStatement represents an SQL DEFINE FIELD statement.
|
||||
type DefineFieldStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -451,7 +427,6 @@ type DefineFieldStatement struct {
|
|||
|
||||
// RemoveFieldStatement represents an SQL REMOVE FIELD statement.
|
||||
type RemoveFieldStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -465,7 +440,6 @@ type RemoveFieldStatement struct {
|
|||
|
||||
// DefineIndexStatement represents an SQL DEFINE INDEX statement.
|
||||
type DefineIndexStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
@ -477,7 +451,6 @@ type DefineIndexStatement struct {
|
|||
|
||||
// RemoveIndexStatement represents an SQL REMOVE INDEX statement.
|
||||
type RemoveIndexStatement struct {
|
||||
RW bool `cork:"-" codec:"-"`
|
||||
KV string `cork:"-" codec:"-"`
|
||||
NS string `cork:"-" codec:"-"`
|
||||
DB string `cork:"-" codec:"-"`
|
||||
|
|
54
sql/cork.go
54
sql/cork.go
|
@ -869,7 +869,7 @@ func (this *LiveStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *LiveStatement) ExtendCORK() byte {
|
||||
return 0x71
|
||||
return 0x72
|
||||
}
|
||||
|
||||
func (this *LiveStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -909,10 +909,11 @@ func (this *SelectStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *SelectStatement) ExtendCORK() byte {
|
||||
return 0x72
|
||||
return 0x73
|
||||
}
|
||||
|
||||
func (this *SelectStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
w.EncodeBool(this.RW)
|
||||
w.EncodeString(this.KV)
|
||||
w.EncodeString(this.NS)
|
||||
w.EncodeString(this.DB)
|
||||
|
@ -929,6 +930,7 @@ func (this *SelectStatement) MarshalCORK(w *cork.Writer) (err error) {
|
|||
}
|
||||
|
||||
func (this *SelectStatement) UnmarshalCORK(r *cork.Reader) (err error) {
|
||||
r.DecodeBool(&this.RW)
|
||||
r.DecodeString(&this.KV)
|
||||
r.DecodeString(&this.NS)
|
||||
r.DecodeString(&this.DB)
|
||||
|
@ -961,7 +963,7 @@ func (this *CreateStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *CreateStatement) ExtendCORK() byte {
|
||||
return 0x73
|
||||
return 0x74
|
||||
}
|
||||
|
||||
func (this *CreateStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1003,7 +1005,7 @@ func (this *UpdateStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *UpdateStatement) ExtendCORK() byte {
|
||||
return 0x74
|
||||
return 0x75
|
||||
}
|
||||
|
||||
func (this *UpdateStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1047,7 +1049,7 @@ func (this *DeleteStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DeleteStatement) ExtendCORK() byte {
|
||||
return 0x75
|
||||
return 0x76
|
||||
}
|
||||
|
||||
func (this *DeleteStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1091,7 +1093,7 @@ func (this *RelateStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RelateStatement) ExtendCORK() byte {
|
||||
return 0x76
|
||||
return 0x77
|
||||
}
|
||||
|
||||
func (this *RelateStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1139,7 +1141,7 @@ func (this *InsertStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *InsertStatement) ExtendCORK() byte {
|
||||
return 0x77
|
||||
return 0x78
|
||||
}
|
||||
|
||||
func (this *InsertStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1181,7 +1183,7 @@ func (this *UpsertStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *UpsertStatement) ExtendCORK() byte {
|
||||
return 0x78
|
||||
return 0x79
|
||||
}
|
||||
|
||||
func (this *UpsertStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1223,7 +1225,7 @@ func (this *DefineNamespaceStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineNamespaceStatement) ExtendCORK() byte {
|
||||
return 0x79
|
||||
return 0x80
|
||||
}
|
||||
|
||||
func (this *DefineNamespaceStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1253,7 +1255,7 @@ func (this *RemoveNamespaceStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveNamespaceStatement) ExtendCORK() byte {
|
||||
return 0x80
|
||||
return 0x81
|
||||
}
|
||||
|
||||
func (this *RemoveNamespaceStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1283,7 +1285,7 @@ func (this *DefineDatabaseStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineDatabaseStatement) ExtendCORK() byte {
|
||||
return 0x81
|
||||
return 0x82
|
||||
}
|
||||
|
||||
func (this *DefineDatabaseStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1313,7 +1315,7 @@ func (this *RemoveDatabaseStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveDatabaseStatement) ExtendCORK() byte {
|
||||
return 0x82
|
||||
return 0x83
|
||||
}
|
||||
|
||||
func (this *RemoveDatabaseStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1343,7 +1345,7 @@ func (this *DefineLoginStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineLoginStatement) ExtendCORK() byte {
|
||||
return 0x83
|
||||
return 0x84
|
||||
}
|
||||
|
||||
func (this *DefineLoginStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1379,7 +1381,7 @@ func (this *RemoveLoginStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveLoginStatement) ExtendCORK() byte {
|
||||
return 0x84
|
||||
return 0x85
|
||||
}
|
||||
|
||||
func (this *RemoveLoginStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1411,7 +1413,7 @@ func (this *DefineTokenStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineTokenStatement) ExtendCORK() byte {
|
||||
return 0x85
|
||||
return 0x86
|
||||
}
|
||||
|
||||
func (this *DefineTokenStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1447,7 +1449,7 @@ func (this *RemoveTokenStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveTokenStatement) ExtendCORK() byte {
|
||||
return 0x86
|
||||
return 0x87
|
||||
}
|
||||
|
||||
func (this *RemoveTokenStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1479,7 +1481,7 @@ func (this *DefineScopeStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineScopeStatement) ExtendCORK() byte {
|
||||
return 0x87
|
||||
return 0x88
|
||||
}
|
||||
|
||||
func (this *DefineScopeStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1519,7 +1521,7 @@ func (this *RemoveScopeStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveScopeStatement) ExtendCORK() byte {
|
||||
return 0x88
|
||||
return 0x89
|
||||
}
|
||||
|
||||
func (this *RemoveScopeStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1549,7 +1551,7 @@ func (this *DefineTableStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineTableStatement) ExtendCORK() byte {
|
||||
return 0x89
|
||||
return 0x90
|
||||
}
|
||||
|
||||
func (this *DefineTableStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1595,7 +1597,7 @@ func (this *RemoveTableStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveTableStatement) ExtendCORK() byte {
|
||||
return 0x90
|
||||
return 0x91
|
||||
}
|
||||
|
||||
func (this *RemoveTableStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1625,7 +1627,7 @@ func (this *DefineEventStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineEventStatement) ExtendCORK() byte {
|
||||
return 0x91
|
||||
return 0x92
|
||||
}
|
||||
|
||||
func (this *DefineEventStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1661,7 +1663,7 @@ func (this *RemoveEventStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveEventStatement) ExtendCORK() byte {
|
||||
return 0x92
|
||||
return 0x93
|
||||
}
|
||||
|
||||
func (this *RemoveEventStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1693,7 +1695,7 @@ func (this *DefineFieldStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineFieldStatement) ExtendCORK() byte {
|
||||
return 0x93
|
||||
return 0x94
|
||||
}
|
||||
|
||||
func (this *DefineFieldStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1735,7 +1737,7 @@ func (this *RemoveFieldStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveFieldStatement) ExtendCORK() byte {
|
||||
return 0x94
|
||||
return 0x95
|
||||
}
|
||||
|
||||
func (this *RemoveFieldStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1767,7 +1769,7 @@ func (this *DefineIndexStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *DefineIndexStatement) ExtendCORK() byte {
|
||||
return 0x95
|
||||
return 0x96
|
||||
}
|
||||
|
||||
func (this *DefineIndexStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
@ -1803,7 +1805,7 @@ func (this *RemoveIndexStatement) Encode() (dst []byte) {
|
|||
}
|
||||
|
||||
func (this *RemoveIndexStatement) ExtendCORK() byte {
|
||||
return 0x96
|
||||
return 0x97
|
||||
}
|
||||
|
||||
func (this *RemoveIndexStatement) MarshalCORK(w *cork.Writer) (err error) {
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseCreateStatement() (stmt *CreateStatement, err error) {
|
||||
|
||||
stmt = &CreateStatement{RW: true}
|
||||
stmt = &CreateStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineDatabaseStatement() (stmt *DefineDatabaseStatement, err error) {
|
||||
|
||||
stmt = &DefineDatabaseStatement{RW: true}
|
||||
stmt = &DefineDatabaseStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
||||
return nil, err
|
||||
|
@ -32,7 +32,7 @@ func (p *parser) parseDefineDatabaseStatement() (stmt *DefineDatabaseStatement,
|
|||
|
||||
func (p *parser) parseRemoveDatabaseStatement() (stmt *RemoveDatabaseStatement, err error) {
|
||||
|
||||
stmt = &RemoveDatabaseStatement{RW: true}
|
||||
stmt = &RemoveDatabaseStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNS); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDeleteStatement() (stmt *DeleteStatement, err error) {
|
||||
|
||||
stmt = &DeleteStatement{RW: true}
|
||||
stmt = &DeleteStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineEventStatement() (stmt *DefineEventStatement, err error) {
|
||||
|
||||
stmt = &DefineEventStatement{RW: true}
|
||||
stmt = &DefineEventStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
@ -56,7 +56,7 @@ func (p *parser) parseDefineEventStatement() (stmt *DefineEventStatement, err er
|
|||
|
||||
func (p *parser) parseRemoveEventStatement() (stmt *RemoveEventStatement, err error) {
|
||||
|
||||
stmt = &RemoveEventStatement{RW: true}
|
||||
stmt = &RemoveEventStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineFieldStatement() (stmt *DefineFieldStatement, err error) {
|
||||
|
||||
stmt = &DefineFieldStatement{RW: true}
|
||||
stmt = &DefineFieldStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
@ -73,7 +73,7 @@ func (p *parser) parseDefineFieldStatement() (stmt *DefineFieldStatement, err er
|
|||
|
||||
func (p *parser) parseRemoveFieldStatement() (stmt *RemoveFieldStatement, err error) {
|
||||
|
||||
stmt = &RemoveFieldStatement{RW: true}
|
||||
stmt = &RemoveFieldStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineIndexStatement() (stmt *DefineIndexStatement, err error) {
|
||||
|
||||
stmt = &DefineIndexStatement{RW: true}
|
||||
stmt = &DefineIndexStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
@ -50,7 +50,7 @@ func (p *parser) parseDefineIndexStatement() (stmt *DefineIndexStatement, err er
|
|||
|
||||
func (p *parser) parseRemoveIndexStatement() (stmt *RemoveIndexStatement, err error) {
|
||||
|
||||
stmt = &RemoveIndexStatement{RW: true}
|
||||
stmt = &RemoveIndexStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseInfoStatement() (stmt *InfoStatement, err error) {
|
||||
|
||||
stmt = &InfoStatement{RW: false}
|
||||
stmt = &InfoStatement{}
|
||||
|
||||
if _, _, err = p.shouldBe(FOR); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseInsertStatement() (stmt *InsertStatement, err error) {
|
||||
|
||||
stmt = &InsertStatement{RW: true}
|
||||
stmt = &InsertStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseLiveStatement() (stmt *LiveStatement, err error) {
|
||||
|
||||
stmt = &LiveStatement{RW: true}
|
||||
stmt = &LiveStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthSC); err != nil {
|
||||
return nil, err
|
||||
|
@ -56,7 +56,7 @@ func (p *parser) parseLiveStatement() (stmt *LiveStatement, err error) {
|
|||
|
||||
func (p *parser) parseKillStatement() (stmt *KillStatement, err error) {
|
||||
|
||||
stmt = &KillStatement{RW: true}
|
||||
stmt = &KillStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthSC); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineLoginStatement() (stmt *DefineLoginStatement, err error) {
|
||||
|
||||
stmt = &DefineLoginStatement{RW: true}
|
||||
stmt = &DefineLoginStatement{}
|
||||
|
||||
if stmt.User, err = p.parseIdent(); err != nil {
|
||||
return nil, err
|
||||
|
@ -56,7 +56,7 @@ func (p *parser) parseDefineLoginStatement() (stmt *DefineLoginStatement, err er
|
|||
|
||||
func (p *parser) parseRemoveLoginStatement() (stmt *RemoveLoginStatement, err error) {
|
||||
|
||||
stmt = &RemoveLoginStatement{RW: true}
|
||||
stmt = &RemoveLoginStatement{}
|
||||
|
||||
if stmt.User, err = p.parseIdent(); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineNamespaceStatement() (stmt *DefineNamespaceStatement, err error) {
|
||||
|
||||
stmt = &DefineNamespaceStatement{RW: true}
|
||||
stmt = &DefineNamespaceStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthKV); err != nil {
|
||||
return nil, err
|
||||
|
@ -32,7 +32,7 @@ func (p *parser) parseDefineNamespaceStatement() (stmt *DefineNamespaceStatement
|
|||
|
||||
func (p *parser) parseRemoveNamespaceStatement() (stmt *RemoveNamespaceStatement, err error) {
|
||||
|
||||
stmt = &RemoveNamespaceStatement{RW: true}
|
||||
stmt = &RemoveNamespaceStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthKV); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
package sql
|
||||
|
||||
func (s *InfoStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *IfStatement) Writeable() bool {
|
||||
|
@ -35,11 +35,11 @@ func (s *ReturnStatement) Writeable() bool {
|
|||
}
|
||||
|
||||
func (s *LiveStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *KillStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *SelectStatement) Writeable() bool {
|
||||
|
@ -47,97 +47,97 @@ func (s *SelectStatement) Writeable() bool {
|
|||
}
|
||||
|
||||
func (s *CreateStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *UpdateStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DeleteStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RelateStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *InsertStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *UpsertStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineNamespaceStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveNamespaceStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineDatabaseStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveDatabaseStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineLoginStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveLoginStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineTokenStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveTokenStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineScopeStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveScopeStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineTableStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveTableStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineEventStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveEventStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineFieldStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveFieldStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *DefineIndexStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *RemoveIndexStatement) Writeable() bool {
|
||||
return s.RW
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ package sql
|
|||
{{with $types := .}}{{range $k := $types}}
|
||||
|
||||
func (s *{{$k.name}}Statement) Writeable() bool {
|
||||
return s.RW
|
||||
return {{if $k.a}}s.RW{{else}}{{if $k.y}}true{{else}}false{{end}}{{end}}
|
||||
}
|
||||
|
||||
{{end}}{{end}}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
[
|
||||
{ "name": "Info" },
|
||||
{ "n": true, "name": "Info" },
|
||||
|
||||
{ "name": "If" },
|
||||
{ "name": "Let" },
|
||||
{ "name": "Return" },
|
||||
{ "a": true, "name": "If" },
|
||||
{ "a": true, "name": "Let" },
|
||||
{ "a": true, "name": "Return" },
|
||||
|
||||
{ "name": "Live" },
|
||||
{ "name": "Kill" },
|
||||
{ "name": "Select" },
|
||||
{ "name": "Create" },
|
||||
{ "name": "Update" },
|
||||
{ "name": "Delete" },
|
||||
{ "name": "Relate" },
|
||||
{ "name": "Insert" },
|
||||
{ "name": "Upsert" },
|
||||
{ "y": true, "name": "Live" },
|
||||
{ "y": true, "name": "Kill" },
|
||||
{ "a": true, "name": "Select" },
|
||||
{ "y": true, "name": "Create" },
|
||||
{ "y": true, "name": "Update" },
|
||||
{ "y": true, "name": "Delete" },
|
||||
{ "y": true, "name": "Relate" },
|
||||
{ "y": true, "name": "Insert" },
|
||||
{ "y": true, "name": "Upsert" },
|
||||
|
||||
{ "name": "DefineNamespace" },
|
||||
{ "name": "RemoveNamespace" },
|
||||
{ "name": "DefineDatabase" },
|
||||
{ "name": "RemoveDatabase" },
|
||||
{ "name": "DefineLogin" },
|
||||
{ "name": "RemoveLogin" },
|
||||
{ "name": "DefineToken" },
|
||||
{ "name": "RemoveToken" },
|
||||
{ "name": "DefineScope" },
|
||||
{ "name": "RemoveScope" },
|
||||
{ "name": "DefineTable" },
|
||||
{ "name": "RemoveTable" },
|
||||
{ "name": "DefineEvent" },
|
||||
{ "name": "RemoveEvent" },
|
||||
{ "name": "DefineField" },
|
||||
{ "name": "RemoveField" },
|
||||
{ "name": "DefineIndex" },
|
||||
{ "name": "RemoveIndex" }
|
||||
{ "y": true, "name": "DefineNamespace" },
|
||||
{ "y": true, "name": "RemoveNamespace" },
|
||||
{ "y": true, "name": "DefineDatabase" },
|
||||
{ "y": true, "name": "RemoveDatabase" },
|
||||
{ "y": true, "name": "DefineLogin" },
|
||||
{ "y": true, "name": "RemoveLogin" },
|
||||
{ "y": true, "name": "DefineToken" },
|
||||
{ "y": true, "name": "RemoveToken" },
|
||||
{ "y": true, "name": "DefineScope" },
|
||||
{ "y": true, "name": "RemoveScope" },
|
||||
{ "y": true, "name": "DefineTable" },
|
||||
{ "y": true, "name": "RemoveTable" },
|
||||
{ "y": true, "name": "DefineEvent" },
|
||||
{ "y": true, "name": "RemoveEvent" },
|
||||
{ "y": true, "name": "DefineField" },
|
||||
{ "y": true, "name": "RemoveField" },
|
||||
{ "y": true, "name": "DefineIndex" },
|
||||
{ "y": true, "name": "RemoveIndex" }
|
||||
]
|
||||
|
|
118
sql/rdwr_test.go
118
sql/rdwr_test.go
|
@ -26,188 +26,188 @@ import (
|
|||
|
||||
func TestRdwr(t *testing.T) {
|
||||
|
||||
Convey("InfoStatement should auth correctly", t, func() {
|
||||
s := &InfoStatement{RW: true}
|
||||
Convey("InfoStatement should rdwr correctly", t, func() {
|
||||
s := &InfoStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
So(w, ShouldEqual, false)
|
||||
})
|
||||
|
||||
Convey("IfStatement should auth correctly", t, func() {
|
||||
Convey("IfStatement should rdwr correctly", t, func() {
|
||||
s := &IfStatement{RW: true}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("LetStatement should auth correctly", t, func() {
|
||||
Convey("LetStatement should rdwr correctly", t, func() {
|
||||
s := &LetStatement{RW: true}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("ReturnStatement should auth correctly", t, func() {
|
||||
Convey("ReturnStatement should rdwr correctly", t, func() {
|
||||
s := &ReturnStatement{RW: true}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("LiveStatement should auth correctly", t, func() {
|
||||
s := &LiveStatement{RW: true}
|
||||
Convey("LiveStatement should rdwr correctly", t, func() {
|
||||
s := &LiveStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("KillStatement should auth correctly", t, func() {
|
||||
s := &KillStatement{RW: true}
|
||||
Convey("KillStatement should rdwr correctly", t, func() {
|
||||
s := &KillStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("SelectStatement should auth correctly", t, func() {
|
||||
Convey("SelectStatement should rdwr correctly", t, func() {
|
||||
s := &SelectStatement{RW: true}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("CreateStatement should auth correctly", t, func() {
|
||||
s := &CreateStatement{RW: true}
|
||||
Convey("CreateStatement should rdwr correctly", t, func() {
|
||||
s := &CreateStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("UpdateStatement should auth correctly", t, func() {
|
||||
s := &UpdateStatement{RW: true}
|
||||
Convey("UpdateStatement should rdwr correctly", t, func() {
|
||||
s := &UpdateStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DeleteStatement should auth correctly", t, func() {
|
||||
s := &DeleteStatement{RW: true}
|
||||
Convey("DeleteStatement should rdwr correctly", t, func() {
|
||||
s := &DeleteStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RelateStatement should auth correctly", t, func() {
|
||||
s := &RelateStatement{RW: true}
|
||||
Convey("RelateStatement should rdwr correctly", t, func() {
|
||||
s := &RelateStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("InsertStatement should auth correctly", t, func() {
|
||||
s := &InsertStatement{RW: true}
|
||||
Convey("InsertStatement should rdwr correctly", t, func() {
|
||||
s := &InsertStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("UpsertStatement should auth correctly", t, func() {
|
||||
s := &UpsertStatement{RW: true}
|
||||
Convey("UpsertStatement should rdwr correctly", t, func() {
|
||||
s := &UpsertStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineNamespaceStatement should auth correctly", t, func() {
|
||||
s := &DefineNamespaceStatement{RW: true}
|
||||
Convey("DefineNamespaceStatement should rdwr correctly", t, func() {
|
||||
s := &DefineNamespaceStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveNamespaceStatement should auth correctly", t, func() {
|
||||
s := &RemoveNamespaceStatement{RW: true}
|
||||
Convey("RemoveNamespaceStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveNamespaceStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineDatabaseStatement should auth correctly", t, func() {
|
||||
s := &DefineDatabaseStatement{RW: true}
|
||||
Convey("DefineDatabaseStatement should rdwr correctly", t, func() {
|
||||
s := &DefineDatabaseStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveDatabaseStatement should auth correctly", t, func() {
|
||||
s := &RemoveDatabaseStatement{RW: true}
|
||||
Convey("RemoveDatabaseStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveDatabaseStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineLoginStatement should auth correctly", t, func() {
|
||||
s := &DefineLoginStatement{RW: true}
|
||||
Convey("DefineLoginStatement should rdwr correctly", t, func() {
|
||||
s := &DefineLoginStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveLoginStatement should auth correctly", t, func() {
|
||||
s := &RemoveLoginStatement{RW: true}
|
||||
Convey("RemoveLoginStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveLoginStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineTokenStatement should auth correctly", t, func() {
|
||||
s := &DefineTokenStatement{RW: true}
|
||||
Convey("DefineTokenStatement should rdwr correctly", t, func() {
|
||||
s := &DefineTokenStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveTokenStatement should auth correctly", t, func() {
|
||||
s := &RemoveTokenStatement{RW: true}
|
||||
Convey("RemoveTokenStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveTokenStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineScopeStatement should auth correctly", t, func() {
|
||||
s := &DefineScopeStatement{RW: true}
|
||||
Convey("DefineScopeStatement should rdwr correctly", t, func() {
|
||||
s := &DefineScopeStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveScopeStatement should auth correctly", t, func() {
|
||||
s := &RemoveScopeStatement{RW: true}
|
||||
Convey("RemoveScopeStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveScopeStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineTableStatement should auth correctly", t, func() {
|
||||
s := &DefineTableStatement{RW: true}
|
||||
Convey("DefineTableStatement should rdwr correctly", t, func() {
|
||||
s := &DefineTableStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveTableStatement should auth correctly", t, func() {
|
||||
s := &RemoveTableStatement{RW: true}
|
||||
Convey("RemoveTableStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveTableStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineEventStatement should auth correctly", t, func() {
|
||||
s := &DefineEventStatement{RW: true}
|
||||
Convey("DefineEventStatement should rdwr correctly", t, func() {
|
||||
s := &DefineEventStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveEventStatement should auth correctly", t, func() {
|
||||
s := &RemoveEventStatement{RW: true}
|
||||
Convey("RemoveEventStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveEventStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineFieldStatement should auth correctly", t, func() {
|
||||
s := &DefineFieldStatement{RW: true}
|
||||
Convey("DefineFieldStatement should rdwr correctly", t, func() {
|
||||
s := &DefineFieldStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveFieldStatement should auth correctly", t, func() {
|
||||
s := &RemoveFieldStatement{RW: true}
|
||||
Convey("RemoveFieldStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveFieldStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("DefineIndexStatement should auth correctly", t, func() {
|
||||
s := &DefineIndexStatement{RW: true}
|
||||
Convey("DefineIndexStatement should rdwr correctly", t, func() {
|
||||
s := &DefineIndexStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
||||
Convey("RemoveIndexStatement should auth correctly", t, func() {
|
||||
s := &RemoveIndexStatement{RW: true}
|
||||
Convey("RemoveIndexStatement should rdwr correctly", t, func() {
|
||||
s := &RemoveIndexStatement{}
|
||||
w := s.Writeable()
|
||||
So(w, ShouldEqual, true)
|
||||
})
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseRelateStatement() (stmt *RelateStatement, err error) {
|
||||
|
||||
stmt = &RelateStatement{RW: true}
|
||||
stmt = &RelateStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineScopeStatement() (stmt *DefineScopeStatement, err error) {
|
||||
|
||||
stmt = &DefineScopeStatement{RW: true}
|
||||
stmt = &DefineScopeStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
@ -68,7 +68,7 @@ func (p *parser) parseDefineScopeStatement() (stmt *DefineScopeStatement, err er
|
|||
|
||||
func (p *parser) parseRemoveScopeStatement() (stmt *RemoveScopeStatement, err error) {
|
||||
|
||||
stmt = &RemoveScopeStatement{RW: true}
|
||||
stmt = &RemoveScopeStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
|
256
sql/sql_test.go
256
sql/sql_test.go
File diff suppressed because it is too large
Load diff
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineTableStatement() (stmt *DefineTableStatement, err error) {
|
||||
|
||||
stmt = &DefineTableStatement{RW: true}
|
||||
stmt = &DefineTableStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
@ -99,7 +99,7 @@ func (p *parser) parseDefineTableStatement() (stmt *DefineTableStatement, err er
|
|||
|
||||
func (p *parser) parseRemoveTableStatement() (stmt *RemoveTableStatement, err error) {
|
||||
|
||||
stmt = &RemoveTableStatement{RW: true}
|
||||
stmt = &RemoveTableStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthDB); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseDefineTokenStatement() (stmt *DefineTokenStatement, err error) {
|
||||
|
||||
stmt = &DefineTokenStatement{RW: true}
|
||||
stmt = &DefineTokenStatement{}
|
||||
|
||||
if stmt.Name, err = p.parseIdent(); err != nil {
|
||||
return nil, err
|
||||
|
@ -83,7 +83,7 @@ func (p *parser) parseDefineTokenStatement() (stmt *DefineTokenStatement, err er
|
|||
|
||||
func (p *parser) parseRemoveTokenStatement() (stmt *RemoveTokenStatement, err error) {
|
||||
|
||||
stmt = &RemoveTokenStatement{RW: true}
|
||||
stmt = &RemoveTokenStatement{}
|
||||
|
||||
if stmt.Name, err = p.parseIdent(); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseUpdateStatement() (stmt *UpdateStatement, err error) {
|
||||
|
||||
stmt = &UpdateStatement{RW: true}
|
||||
stmt = &UpdateStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -16,7 +16,7 @@ package sql
|
|||
|
||||
func (p *parser) parseUpsertStatement() (stmt *UpsertStatement, err error) {
|
||||
|
||||
stmt = &UpsertStatement{RW: true}
|
||||
stmt = &UpsertStatement{}
|
||||
|
||||
if stmt.KV, stmt.NS, stmt.DB, err = p.o.get(AuthNO); err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue