mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-05 08:10:50 +00:00
Started on ast and token changes for RBAC
This commit is contained in:
parent
8e349cabd9
commit
8ada172a89
3 changed files with 34 additions and 0 deletions
|
|
@ -39,6 +39,7 @@ func (*CreateDatabaseStatement) node() {}
|
|||
func (*CreateIndexStatement) node() {}
|
||||
func (*CreateTableStatement) node() {}
|
||||
func (*CreateFunctionStatement) node() {}
|
||||
func (*CreateUserStatement) node() {}
|
||||
func (*CreateViewStatement) node() {}
|
||||
func (*DateLit) node() {}
|
||||
func (*DefaultConstraint) node() {}
|
||||
|
|
@ -120,6 +121,7 @@ func (*CreateDatabaseStatement) stmt() {}
|
|||
func (*CreateIndexStatement) stmt() {}
|
||||
func (*CreateTableStatement) stmt() {}
|
||||
func (*CreateFunctionStatement) stmt() {}
|
||||
func (*CreateUserStatement) stmt() {}
|
||||
func (*CreateViewStatement) stmt() {}
|
||||
func (*DeleteStatement) stmt() {}
|
||||
func (*DropDatabaseStatement) stmt() {}
|
||||
|
|
@ -162,6 +164,8 @@ func CloneStatement(stmt Statement) Statement {
|
|||
return stmt.Clone()
|
||||
case *CreateFunctionStatement:
|
||||
return stmt.Clone()
|
||||
case *CreateUserStatement:
|
||||
return stmt.Clone()
|
||||
case *CreateViewStatement:
|
||||
return stmt.Clone()
|
||||
case *DeleteStatement:
|
||||
|
|
@ -2735,6 +2739,29 @@ func (s *DropTableStatement) String() string {
|
|||
return buf.String()
|
||||
}
|
||||
|
||||
type CreateUserStatement struct {
|
||||
Create Pos
|
||||
User Pos
|
||||
Name *Ident
|
||||
}
|
||||
|
||||
func (s *CreateUserStatement) Clone() *CreateUserStatement {
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
other := *s
|
||||
other.Name = s.Name.Clone()
|
||||
return &other
|
||||
}
|
||||
|
||||
func (s *CreateUserStatement) String() string {
|
||||
var buf bytes.Buffer
|
||||
buf.WriteString("CREATE USER")
|
||||
fmt.Fprintf(&buf, " %s", s.Name.String())
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
type CreateViewStatement struct {
|
||||
Create Pos // position of CREATE keyword
|
||||
View Pos // position of VIEW keyword
|
||||
|
|
|
|||
|
|
@ -427,6 +427,11 @@ func TestCreateFunctionStatement_String(t *testing.T) {
|
|||
}, `CREATE FUNCTION IF NOT EXISTS func (@param1 int) RETURNS @scalar int AS BEGIN END`)
|
||||
}
|
||||
|
||||
func TestCreateUserStatement_String(t *testing.T) {
|
||||
AssertStatementStringer(t, &parser.CreateUserStatement{
|
||||
Name: &parser.Ident{Name: "tuser"},
|
||||
}, `CREATE USER tuser`)
|
||||
}
|
||||
func TestCreateViewStatement_String(t *testing.T) {
|
||||
AssertStatementStringer(t, &parser.CreateViewStatement{
|
||||
Name: &parser.Ident{Name: "vw"},
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ const (
|
|||
UNIQUE
|
||||
UNITS
|
||||
UPDATE
|
||||
USER
|
||||
USING
|
||||
VACUUM
|
||||
VALUES
|
||||
|
|
@ -466,6 +467,7 @@ var tokens = [...]string{
|
|||
UNIQUE: "UNIQUE",
|
||||
UNITS: "UNITS",
|
||||
UPDATE: "UPDATE",
|
||||
USER: "USER",
|
||||
USING: "USING",
|
||||
VACUUM: "VACUUM",
|
||||
VALUES: "VALUES",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue