# gizmodel/sql/parsegrant

The SQL parser: roles, GRANT, REVOKE and policies.

```gizlang
import * as Parsegrant from "gizmodel/sql/parsegrant";
```

## Methods

### `Parser.roleOptions`

```gizlang
function Parser.roleOptions(self: mut Parser): string
```

The options of CREATE or ALTER ROLE as name=value lines: LOGIN, SUPERUSER, CREATEROLE (and
their NO forms), PASSWORD 'x' or NULL, IN ROLE a, b; Oracle's IDENTIFIED BY x and SQL Server's
WITH PASSWORD = 'x' too. Other options (CREATEDB, INHERIT, CONNECTION LIMIT, VALID UNTIL)
change nothing here.

Effects: fail, alloc.

### `Parser.grant`

```gizlang
function Parser.grant(self: mut Parser, op: string): Statement
```

GRANT privileges ON [TABLE] t, ... | ON ALL TABLES IN SCHEMA s TO grantee, ... and GRANT
role, ... TO role, ...; REVOKE likewise FROM. `what`: table, all_tables or role; `columns`: the
tables or roles granted; `text`: the privilege words; `options`: the grantees.

Effects: fail, read, alloc.

### `Parser.policy`

```gizlang
function Parser.policy(self: mut Parser): Statement
```

CREATE POLICY name ON t [AS PERMISSIVE|RESTRICTIVE] [FOR command] [TO roles] [USING (x)]
[WITH CHECK (x)]: `method` the command, `options` the roles, `unique` restrictive, `text` the
USING expression's SQL and `action` WITH CHECK's.

Effects: fail, read, alloc.

