Documentation
¶
Overview ¶
Package condition compiles and folds the ABAC condition language: a small expression language with a SQL-flavored surface in which grant conditions are written.
The grammar (ABAC design plan §05, decided 2026-08-29):
condition := or-expr
or-expr := and-expr { OR and-expr }
and-expr := unary { AND unary }
unary := [ NOT ] primary
primary := '(' or-expr ')' | comparison
comparison := attr ( = | != | < | <= | > | >= ) operand
| attr [NOT] IN '(' literal { ',' literal } ')'
| attr [NOT] IN subject.identifier -- a @subjectSet name
| attr IS [NOT] NULL
attr := [ new. ] identifier | now | temporal
temporal := ( timeOfDay | dayOfWeek ) '(' now ',' zone ')'
zone := 'string' | local
operand := literal | subject | now | subject.identifier | identifier
literal := 'string' | number | true | false
A bare identifier on a comparison's right side is an attribute reference — an old-vs-new comparison such as new.priority <= priority (§05, decided 2026-09-03) — and is admitted only against a new.-qualified left side; it never takes its own new. qualifier (two post-image sides would compare the proposed row with itself).
With now on the left, the operand is a quoted string (an RFC 3339 instant), now itself, or subject.identifier; a number, a boolean, or bare subject is refused at parse, as now IN and now IS NULL are. The parser owns that rule, so deploy validation and the snapshot load refuse such a condition through the parse they already do, and the fold refuses a hand-built tree that bypassed the parser.
The temporal functions (§05, decided 2026-09-03) read the environment's instant through a zone's wall clock: timeOfDay(now, zone) compares against 24-hour 'HH:MM' literals with the relational operators, and dayOfWeek(now, zone) against the day names 'mon' … 'sun' with =, != and [NOT] IN over a literal list. The zone is a quoted IANA name, or the bare word local — the Environment's zone attribute, resolved by the application. Temporal terms are environment facts: row-free, folded at check time in the engine, never rendered to SQL. Function names match case-sensitively; local is reserved only inside the zone argument.
Keywords are case-insensitive; identifiers are case-sensitive, charset [A-Za-z_][A-Za-z0-9_]*. The reserved words subject, now, and new match case-sensitively, and a binding may not carry their names. Timestamps are quoted RFC 3339 strings typed by context; numbers are typed by context and kept verbatim; a string escapes a quote by writing it twice. Parse enforces generous fixed limits: 4 KB of source, nesting depth 32.
Evaluation ¶
A condition permits only when it is TRUE. Evaluation is three-valued, as in SQL: a comparison is TRUE, FALSE, or UNKNOWN; AND, OR, and NOT combine the three as SQL does (FALSE absorbs through AND, TRUE through OR, NOT leaves UNKNOWN as it is); and at the top only TRUE permits — a row survives a read, a cell shows, a write check passes, a capability holds, only when the condition is TRUE on that row. FALSE and UNKNOWN both refuse.
A missing value is unknown in every form. A NULL column, a NULL foreign key on a join path, a join path that reaches no row, and a subject value whose requester has no anchor row are all "no value". Against no value a comparison is UNKNOWN, IN and NOT IN are UNKNOWN whether the list is literals or a subject set, IS NULL is TRUE, and IS NOT NULL is FALSE.
A join-path attribute reads as the related row's column, or as no value. A subject value reads as the requester's anchor row's column, or as no value. A subject set is the non-null values the requester's anchor rows yield through the anchor's path, restricted to the request's partition when the request is partitioned and the anchor is domain-bound; a present value is IN an empty set FALSE and NOT IN it TRUE.
Which rows of a set's table are the requester's anchor rows is the set's own definition, in two optional parts written in this language over the columns of the set's row (ParseWho, ParseWhere):
who := who-test { OR who-test }
who-test := column = subject | column IN subject.identifier
where := a condition whose attributes are the row's columns and whose
operands are literals and now
A row is an anchor row when its who: is TRUE and its where: is TRUE, each judged as a condition is, so a test over a column with no value is UNKNOWN and the row does not count. A set that writes no who: has one test, the column its declaration sits on equal to subject; a set that writes no where: counts every row its who: admits. A who: test against another set reads that set as a condition does, restricted to the request's partition by that set's own table and by nothing of the set that names it: a set on a table outside every partition answers the same in each.
A list attribute reads a list column, and is typed by one item. A condition that reads one is judged once for each item of the row's list, the whole condition each time with the item as the attribute's value, and permits only when it is TRUE for every item. A list with no item, and no list at all, is judged once with no value, so no value never permits and IS NULL is TRUE of it; an item with no value is no value for that item. A condition reads one list, on the left of a comparison, as the row holds it: deploy validation refuses a second list, a list on a comparison's right side, and a proposed list (new., or any list on a create). A request's list field, read as new.<name> by a method's grant, follows the same rule over the request.
A literal takes the attribute's type. A number literal compares exactly against an INT64 or a NUMERIC attribute and as a double against a FLOAT64 attribute, whose stored value is already the nearest double; two stored numbers compare exactly unless either is a double. Timestamps compare as instants (RFC 3339 literals and now), dates as calendar days, strings bytewise in code-point order, booleans with FALSE before TRUE. The reference evaluator in conditiontest implements these rules over a row image; the resource package's semantic differential compares the SQL it renders against that evaluator on the Spanner emulator.
The package owns the vocabulary only. Leaves are binding names, subject and subject attributes, now, and literals — no schema facts: the engine validates and folds (Fold, over Facts), the resource layer lowers binding names onto columns and join paths and renders SQL, and neither role is played here.
Index ¶
- Constants
- func Bindings(e Expr) []string
- func ComparesAttributes(e Expr) bool
- func Covers(fieldDisjuncts, rowDisjuncts []Expr) bool
- func Implies(premise, conclusion Expr) bool
- func LoadZone(name string) (*time.Location, error)
- func ParseTimeOfDay(s string) (int, error)
- func PostImageAgainstLiteralsOnly(e Expr) bool
- func PostImageBindings(e Expr) []string
- func PreImageBindings(e Expr) []string
- func RightSideBindings(e Expr) []string
- func RowFree(e Expr) bool
- func SubjectSets(e Expr) []string
- func SubjectValues(e Expr) []string
- func UsesNow(e Expr) bool
- func UsesPostImage(e Expr) bool
- func ValidDayName(s string) bool
- type And
- type BoolLiteral
- type CompareOp
- type Comparison
- type Date
- type Expr
- func AllOf(operands []Expr) Expr
- func Disjuncts(e Expr) []Expr
- func FailOpen(e Expr, evaluable func(atom Expr) bool) Expr
- func Fold(e Expr, f Facts) (Expr, error)
- func Parse(source string) (Expr, error)
- func ParseWhere(source string) (Expr, error)
- func RenameBindings(e Expr, rename func(name string) string) Expr
- func SettlePostImage(e Expr, post map[string]any) (Expr, error)
- func Uncovered(fieldDisjuncts, rowDisjuncts []Expr) []Expr
- func WhoExpr(tests []WhoTest) Expr
- func WithoutPostImage(e Expr) Expr
- type Facts
- type Image
- type In
- type List
- type Literal
- type Not
- type Now
- type NullTest
- type NumberLiteral
- type Operand
- type Or
- type Ref
- type StringLiteral
- type Subject
- type SubjectValue
- type Truth
- type Truth3
- type WhoTest
Constants ¶
const ( // FuncTimeOfDay is timeOfDay(now, zone): the instant's wall-clock reading // in the zone, compared against 'HH:MM' literals (24-hour). FuncTimeOfDay = "timeOfDay" // FuncDayOfWeek is dayOfWeek(now, zone): the instant's day name in the // zone — one of 'mon' … 'sun' — valid with =, != and [NOT] IN. FuncDayOfWeek = "dayOfWeek" )
The temporal function names (decided 2026-09-03): both anchor on the environment fact now, take a zone, and always fold in the engine — they never lower to SQL, so no database dialect renders timezone arithmetic.
Variables ¶
This section is empty.
Functions ¶
func Bindings ¶
Bindings returns the distinct binding names the expression references in attribute positions — now excluded, pre- and post-image collapsed to the name, a comparison's right-side attribute (the old-vs-new form) included — sorted lexically. MigrateRoles validates these against the Collection's bindings.
func ComparesAttributes ¶
ComparesAttributes reports whether any comparison's right side is an attribute reference — the old-vs-new form, `new.attr <op> attr`, which relates the post-image to the pre-image of the same row. Only an update has both images, so MigrateRoles rejects the form on every other permission.
func Covers ¶
Covers reports whether a field's condition set covers a row predicate: Uncovered is empty, so every disjunct of the predicate implies the field's condition. The resource layer's read rendering prunes a field's CASE on this test (the WHERE has already proven the field's condition on every surviving row), and the deploy-time role validation asks the same question of a role's grants, so both answer alike: a CASE the renderer keeps is exactly a CASE the validation warns about.
func Implies ¶
Implies reports whether premise implies conclusion under a small closed set of proven rules on one attribute. Everything outside the rules is decided by identity of canonical text and never guessed:
- Identical canonical text.
- Positive literal-set inclusion on the same reference: a = v is read as a IN (v), and a IN S implies a IN T when every literal of S is in T.
- The negated dual: a != v is read as a NOT IN (v), and a NOT IN S implies a NOT IN T when every literal of T is in S.
- A conjunction implies the conclusion when any one of its conjuncts does, through nested ANDs. An OR nested inside an AND is one conjunct and is tested by identity alone.
References compare by canonical text (new.state is not state), and so do literals (1 is not 1.0, 'A' is not 'a'): the package never sees the attribute's type. Subject sets and values, null tests, ranges, and comparisons across attributes are identity only.
Soundness. The read path prunes a field's CASE when every disjunct of the row predicate implies the field's condition: a row survives the WHERE because some disjunct evaluated TRUE under three-valued logic, each rule preserves TRUE, so the field's condition is TRUE on that row and the CASE would yield the column anyway. The WHERE itself is never simplified.
func LoadZone ¶
LoadZone resolves a temporal function's zone name against the embedded timezone database — deploy-time validation (MigrateRoles) shares the resolution through this. Results are cached: the standard library reloads zone data on every lookup, and folding runs per check.
func ParseTimeOfDay ¶
ParseTimeOfDay parses timeOfDay's literal form — 24-hour 'HH:MM' — to minutes since midnight. Deploy-time validation (MigrateRoles) shares the format through this.
func PostImageAgainstLiteralsOnly ¶ added in v0.3.0
PostImageAgainstLiteralsOnly reports whether every atom that reads new. compares against literals alone: no subject, no subject value, no subject set, no now, no attribute. Only such an atom can be settled against a decoded request alone, so a role file whose Execute grant compares a request field to anything else is refused when the roles are deployed.
func PostImageBindings ¶ added in v0.3.0
PostImageBindings returns the distinct names the expression reads under the new. prefix. Sorted.
func PreImageBindings ¶ added in v0.3.0
PreImageBindings returns the distinct attribute names the expression reads off the row as it is: every reference without the new. prefix, a comparison's right-side attribute included. Sorted.
func RightSideBindings ¶ added in v0.3.0
RightSideBindings returns the distinct attribute names on a comparison's right side: the pre-image half of the old-vs-new form. Sorted.
func RowFree ¶
RowFree reports whether the expression references no row data — no binding names and no new. prefix; only subject, subject attributes, now, and literals. The classification is purely lexical: subject, subject.*, and now are reserved, and every other identifier is a binding name.
Row-free is the class permitted on surfaces where no row exists: scope-wide and target-less RPC grants. Row-referencing conditions there are rejected at load and by MigrateRoles. (A computed resource is not one of them: its rows come from the application's Go function, and the resource layer judges each one against a grant's condition with Evaluate.)
func SubjectSets ¶
SubjectSets returns the distinct @subjectSet names the expression references (`attr IN subject.name`), sorted lexically.
func SubjectValues ¶
SubjectValues returns the distinct @subjectValue names the expression references as scalar operands (`subject.name`), sorted lexically.
func UsesNow ¶
UsesNow reports whether the expression references the environment fact now — on either side of a comparison, or through a temporal function of it — the check must then carry an Environment with the instant, and its absence is a fail-loud error.
func UsesPostImage ¶
UsesPostImage reports whether the expression reads the post-write overlay (`new.`). MigrateRoles enforces image validity per permission: Update takes both images, Read and Delete are unqualified only, and Insert's single image is written unqualified.
func ValidDayName ¶
ValidDayName reports whether s is one of dayOfWeek's seven values — deploy-time validation (MigrateRoles) shares the vocabulary through this.
Types ¶
type BoolLiteral ¶
type BoolLiteral struct {
Value bool
}
BoolLiteral is true or false.
func (BoolLiteral) String ¶
func (b BoolLiteral) String() string
type Comparison ¶
Comparison relates an attribute (or the now fact) to a single operand.
func (Comparison) String ¶
func (c Comparison) String() string
type Date ¶
Date is a civil date — a date attribute's value, compared as a calendar day with no instant and no zone.
type Expr ¶
type Expr interface {
// String renders the node as canonical condition text: keywords
// upper-case, single spaces, minimal parentheses. Parsing a rendering
// yields an equivalent tree.
String() string
// contains filtered or unexported methods
}
Expr is a node of the vocabulary AST: the compiled form of condition text. Leaves are attribute (binding) names, the reserved facts subject and now, subject-attribute names, and literals — never schema facts: resolving a binding name onto a column or join path is the resource layer's lowering pass, and this package never sees a schema.
Trees come from Parse (or from Fold, which may add Truth leaves); the parser is the gate that keeps every node well-formed.
func AllOf ¶ added in v0.3.0
AllOf is the conjunction of settled expressions, simplified: one FALSE makes it FALSE, a TRUE drops out, and an expression that appears twice stands once.
func Disjuncts ¶
Disjuncts flattens an any-of tree into its disjuncts: the operands of a top-level OR, recursively, or the expression itself when it is not an OR. OR is associative, so the finer granularity only sharpens a covering test, never changes what the expression means.
func FailOpen ¶
FailOpen returns the expression's fail-open upper bound with every atom for which evaluable reports false assumed to pass: such an atom becomes TRUE under an even number of negations and FALSE under an odd number, and the logic simplifies with the usual TRUE/FALSE absorption. An unknown atom is unknown in both polarities, so the bound of a whole expression never simplifies to FALSE — the caller reads a Truth result as "no evaluable residue". The predicate sees only atoms (Comparison, In, NullTest); logic nodes recurse.
func Fold ¶
Fold returns the expression with every fact-only term evaluated and the logic simplified: TRUE and FALSE absorb through AND, OR, and NOT, so a fully factual expression folds to a single Truth leaf and a mixed one is left with only the terms the database must evaluate.
Folding is confined to facts: a term touching row data or a subject attribute passes through untouched — there is no Go-side comparison of app-typed values, by design. Facts are never NULL, so folding needs no three-valued logic. A fact-only term referencing a fact the Facts value does not carry, or comparing a fact against a literal of the wrong type, is an error.
func Parse ¶
Parse compiles condition source into its vocabulary AST. It enforces the grammar and the fixed limits (4 KB source, nesting depth 32); everything a schema is needed for — binding names against the Collection, literal types against attribute types, image validity per permission — is the callers' validation, downstream of the tree this returns.
func ParseWhere ¶ added in v0.5.0
ParseWhere compiles a subject set's where: part: a condition over the columns of the set's own row, compared to literals and to now, with the comparisons, IN over a literal list, IS NULL, AND, OR and NOT. It is judged as any condition is, so a row counts only where the condition is TRUE.
What a where: cannot say is refused here. It names nothing of the requester (subject, subject.<name>): the test that ties a row to the requester is the who: part. It reads no proposed value (new.): a set's rows are read as the database holds them. And every test reads a column, so now on the left and the temporal functions, which the database does not evaluate, are refused.
func RenameBindings ¶ added in v0.5.0
RenameBindings returns the expression with every attribute name passed through rename: the left side of each comparison, membership test and null test, and a comparison's right-side attribute. The fact now and the temporal functions carry no name and stay as they are. It turns a subject set's parts from the names the definition writes into the columns they read, for a rendering in the schema's words.
func SettlePostImage ¶ added in v0.3.0
SettlePostImage evaluates every atom that reads new.<name> against post, the proposed values by name (a nil entry is no value), and returns what is left: a constant when every atom read new., otherwise the expression over the row's own attributes. An atom that reads no value is unknown, and unknown never permits: it settles to the bound that fails (FALSE where it stands under an even number of negations, TRUE under an odd number).
func Uncovered ¶
Uncovered lists the row disjuncts no field disjunct implies, in row order. A row disjunct is covered when it implies one of the field's disjuncts, or the field's positive literal sets on its reference merged into one: state = 'failed' OR state = 'stood_down' covers state IN ('failed', 'stood_down'), because a row disjunct implies the field's condition when it implies the OR of the field's disjuncts. Negated field disjuncts are tested one at a time under Implies.
func WhoExpr ¶ added in v0.5.0
WhoExpr returns a who: part as one condition: its tests joined by OR. A row is the requester's when the condition is TRUE of it, so the tests read through Evaluate and render through String as any condition does. It needs at least one test.
func WithoutPostImage ¶
WithoutPostImage returns the expression's fail-open upper bound with every post-image-reading term assumed to pass — FailOpen with "touches no `new.`" as the predicate.
The capability envelope renders the result (§13): a term depending on a value the user has not yet typed counts potentially-true, while the evaluable residue still narrows the hint — so a grant like `state IN ('draft') AND new.priority <= priority` keeps its per-row state gating instead of collapsing to always-on. The bound is advisory only; enforcement always evaluates the full expression against the proposed image.
type Facts ¶
type Facts struct {
// contains filtered or unexported fields
}
Facts carries the fact values folding may substitute: the checked user's identity (subject), the request's UTC instant (now), and the zone the bare word local resolves to inside a temporal function. Facts are the engine's whole evaluation surface — everything else in a condition is data, which only the database compares.
Presence is tracked per fact, mirroring accesstypes.Environment: folding a comparison that needs an absent fact is a fail-loud error, never a silent allow or deny. The zero Facts carries nothing.
func (Facts) Now ¶
Now returns the request's UTC instant and true, or the zero time and false when the Facts carry none.
func (Facts) Subject ¶
Subject returns the checked user's identity and true, or the empty string and false when the Facts carry none.
func (Facts) WithNow ¶
WithNow returns a copy carrying the request's instant, normalized to UTC — the same value the caller binds into SQL, so the two consumers can never disagree about a window boundary.
func (Facts) WithSubject ¶
WithSubject returns a copy carrying the checked user's identity. Subject comparison is binary and case-sensitive — the one string semantic the language spec pins.
func (Facts) WithZone ¶
WithZone returns a copy carrying the zone the bare word local resolves to inside a temporal function — the Environment's zone fact. How the zone is chosen (application config, a session claim, the tenant's record) is the application's business; folding sees only the resolved location.
type Image ¶
type Image struct {
// Pre holds the pre-image attribute values by binding name: the row as it
// is. A join-path attribute is already resolved to the related row's
// column or to nothing.
Pre map[string]any
// Post holds the post-image overlay for a mutation: the proposed value of
// every column the mutation touches, by binding name. new.attr reads the
// overlay where the mutation touches the column (a nil entry is a
// proposed NULL) and the pre-image where it does not. Nil for a read.
Post map[string]any
// Subject is the requester's identity, the reserved fact subject.
Subject string
// Now is the request's decision instant, the reserved fact now.
Now time.Time
// Zone is the zone the bare word local resolves to inside a temporal
// function; nil when the environment carries none, which is an error the
// moment a condition asks for it.
Zone *time.Location
// SubjectSets holds each @subjectSet's values: the non-null values the
// requester's anchor rows yield, restricted to the request's partition
// where the anchor is domain-bound. An absent set is empty.
SubjectSets map[string][]any
// SubjectValues holds each @subjectValue's value: the requester's anchor
// row's column, or nothing.
SubjectValues map[string]any
}
Image is everything one evaluation reads: the row's values and the requester's facts.
Values are Go values of the language's storage types: string, int64, float64, *big.Rat (an exact decimal, the NUMERIC storage type), bool, time.Time (a timestamp, an instant), and Date. A map entry that is absent or nil is "no value" — a NULL column, a NULL foreign key, a join path that reaches no row, a subject value whose requester has no anchor row.
A list attribute's value is a List of those values. A condition that reads one is judged once for each item and holds only when it holds for every one (see Evaluate).
type In ¶
type In struct {
Left Ref
Negated bool
// Literals is the literal list of `attr [NOT] IN ('a', 'b')`.
Literals []Literal
// SubjectSet is the @subjectSet name of `attr [NOT] IN subject.name`.
SubjectSet string
}
In tests an attribute for membership: in a literal list, or in a @subjectSet attribute. Exactly one of Literals and SubjectSet is set — the parser is the gate.
type List ¶ added in v0.3.0
type List []any
List is the value of a list attribute: the items a list column holds, each a value of the language's storage types or nil for an item with no value.
type Literal ¶
type Literal interface {
Operand
// contains filtered or unexported methods
}
Literal is a literal operand: a string, a number, or a boolean. Strings and numbers are typed by context — MigrateRoles knows each binding's type from the Collection, so a timestamp is a quoted RFC 3339 string against a timestamp attribute, not a dedicated syntax.
type Now ¶
type Now struct{}
Now is the reserved fact now used as an operand: the request's UTC instant.
type NumberLiteral ¶
type NumberLiteral struct {
Text string
}
NumberLiteral is a signed integer or decimal, kept verbatim: numeric exactness is the database's concern, so nothing here forces a float.
func (NumberLiteral) String ¶
func (n NumberLiteral) String() string
type Operand ¶
type Operand interface {
String() string
// contains filtered or unexported methods
}
Operand is a comparison's right side: a literal, the reserved facts subject and now, a @subjectValue attribute, or — against a `new.`-qualified left side only — a pre-image attribute Ref (the old-vs-new form). Against now on the left, the parser admits only a string literal, now, or a SubjectValue.
type Ref ¶
type Ref struct {
Name string
// PostImage marks the `new.` prefix: the proposed value where the
// mutation touches the column, the existing value where it doesn't.
PostImage bool
// Func names the temporal function wrapping now — FuncTimeOfDay or
// FuncDayOfWeek — with Zone/ZoneLocal its zone argument. Empty for a
// plain reference; a function Ref carries no Name (the anchor is always
// now). Temporal terms are environment facts: they fold at check time
// and are row-free.
Func string
// Zone is the function's zone argument: an IANA name ('America/Denver'),
// empty when ZoneLocal.
Zone string
// ZoneLocal marks the bare word local: the zone resolves from the
// Environment's zone fact at fold time.
ZoneLocal bool
}
Ref is an attribute reference: a binding (row attribute) name, optionally read from the post-write image (`new.`), the reserved environment fact now — distinguished with IsNow, never by matching Name yourself — or a temporal function of now (IsTemporal). Every comparison's left side is a Ref; a Ref may also stand as the right operand in the old-vs-new form — `new.attr <op> attr` — where the left side is post-image and the right reads the same row's pre-image (the parser is the gate: an attribute operand is only legal against a `new.`-qualified left side, and never itself `new.`-qualified).
func (Ref) IsNow ¶
IsNow reports whether the Ref is the reserved environment fact now rather than a binding name.
func (Ref) IsTemporal ¶
IsTemporal reports whether the Ref is a temporal function of now rather than a binding name — distinguished with this, never by matching Func yourself.
type StringLiteral ¶
type StringLiteral struct {
Value string
}
StringLiteral is a quoted string. Value is the unescaped content; String re-escapes by doubling quotes.
func (StringLiteral) String ¶
func (s StringLiteral) String() string
type Subject ¶
type Subject struct{}
Subject is the reserved fact subject: the checked user's identity.
type SubjectValue ¶
type SubjectValue struct {
Name string
}
SubjectValue is a scalar @subjectValue attribute operand (`subject.name`).
func (SubjectValue) String ¶
func (s SubjectValue) String() string
type Truth ¶
type Truth struct {
Value bool
}
Truth is a boolean leaf. The parser never produces one — the grammar has no bare-boolean primary; Truth enters a tree only through Fold, standing where a fact-only term was evaluated.
type Truth3 ¶
type Truth3 int8
Truth3 is a three-valued truth value: FALSE, UNKNOWN, or TRUE, ordered so that AND is the minimum and OR the maximum (Kleene logic, as in SQL).
The three truth values. UNKNOWN is what a comparison against a missing value yields; only TRUE permits.
func Evaluate ¶
Evaluate returns the expression's three-valued truth over the image. It errors on a malformed literal, a comparison between values of different types, a temporal zone it cannot resolve, and a value of a type outside the storage vocabulary — each a misuse deploy validation refuses, so an error here means the harness or the generator is wrong, never the row or the requester.
An expression that reads a list attribute is judged once for each item of the list, the whole expression each time with the item as the attribute's value, and holds only when it holds for every item: the result is TRUE when every item's is, and FALSE otherwise. A list with no item, and no list at all, is judged once with no value, so no value never permits and IS NULL is TRUE of it. The rule is the one a request's list field follows when a method's grant reads it, and the one the resource layer renders into SQL. An expression reads at most one list, and never on a comparison's right side: a second is an error, as deploy validation refuses it.
func (Truth3) And ¶
And is three-valued conjunction: FALSE absorbs, UNKNOWN otherwise wins over TRUE.
type WhoTest ¶ added in v0.5.0
type WhoTest struct {
// Column is the row's column, by the name the definition writes for it.
Column string
// Set is the subject set the column is tested for membership in, the
// `Column IN subject.<Set>` form. It is empty for `Column = subject`.
Set string
}
WhoTest is one test of a subject set's who: part. It ties a column of the set's row to the requester: the column holds the requester, or the column holds a value of another subject set of the requester's.
func ParseWho ¶ added in v0.5.0
ParseWho compiles a subject set's who: part: one test or several joined by OR, each tying a column of the row to the requester, `Column = subject` or `Column IN subject.<set>`. Anything else is refused, since a who: that does not tie the row to the requester would make the set everyone's rows: a comparison to a literal, a negated test, tests joined by AND, a test that does not name the requester.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conditiontest generates random condition expressions for property tests.
|
Package conditiontest generates random condition expressions for property tests. |