Documentation
¶
Index ¶
- type Field
- func Bool[T any, V boolValue](column string, value func(T) V) Field[T]
- func Duration[T any, V durationValue](column string, unit time.Duration, value func(T) V) Field[T]
- func Enum[T any, V textValue](column string, values map[string]string, value func(T) V) Field[T]
- func Float[T any, V floatValue](column string, value func(T) V) Field[T]
- func Int[T any, V intValue](column string, value func(T) V) Field[T]
- func ResourceName[T any, V textValue](column string, pattern resourcename.Pattern, value func(T) V) Field[T]
- func Text[T any, V textValue](column string, value func(T) V) Field[T]
- func Time[T any, V timeValue](column string, value func(T) V) Field[T]
- type Kind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
Field is the column a query field name resolves to. Column is repo-controlled SQL, never client input.
func Bool ¶
Bool reads a filter value as the word, so a filter writes hidden = true with no quotes around it.
func Duration ¶ added in v0.3.0
Duration declares a column counting whole multiples of unit, such as time.Second for a column of seconds. A filter writes the seconds form of google.protobuf.Duration, such as "7200s" or "1.5s", and the field binds the count of units. A value finer than the unit is rejected.
func Enum ¶
Enum maps the name a filter writes to the word the column holds, so a filter writes phase = PHASE_OPEN against a column holding open. A name outside the map is rejected, which keeps the stored words out of the API.
func Float ¶
Float encodes the cursor as the shortest decimal that parses back to the same bits, so a page boundary never skips or repeats a row.
func ResourceName ¶
func ResourceName[T any, V textValue]( column string, pattern resourcename.Pattern, value func(T) V, ) Field[T]
ResourceName declares a column holding the id a resource name ends in, so a filter writes books/abc against a column holding abc. Its kind separates it from text, since a fragment of a name reaches no pattern and unpacks to no id.
func Time ¶
Time encodes the cursor as epoch microseconds, the resolution timestamptz stores, and reads a filter value as the RFC3339 AIP-160 states.
func (Field[T]) Cursor ¶
Cursor returns the column encoded for a page token, or nil where it is NULL.
func (Field[T]) ParseLiteral ¶
ParseLiteral returns the bind argument a filter value stands for, which a cursor value of the same column does not always spell the same way.