Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Transpiler ¶
type Transpiler struct {
// contains filtered or unexported fields
}
Transpiler transpiles AIP-160 filters and AIP-132 order_by clauses against a resource message descriptor into static SQL clauses — constants inlined as literals — for callers baking SQL where no runtime parameters exist, such as code generators.
Only the resource's own top-level stored scalar fields are addressable: joined, byte-serialized, repeated and nested fields are excluded, since a static clause runs against the resource's bare table.
func NewTranspiler ¶
func NewTranspiler(descriptor protoreflect.MessageDescriptor, opts ...TranspilerOption) (*Transpiler, error)
NewTranspiler builds a transpiler over the given resource message descriptor.
func (*Transpiler) TranspileFilter ¶
func (t *Transpiler) TranspileFilter(filter string) (string, error)
TranspileFilter transpiles an AIP-160 filter into a bare SQL boolean expression, with column references qualified by their table name. An empty filter yields an empty clause.
func (*Transpiler) TranspileOrderBy ¶
func (t *Transpiler) TranspileOrderBy(orderBy string) (string, error)
TranspileOrderBy transpiles an AIP-132 order_by into a bare SQL ordering expression, with column references qualified by their table name. An empty order_by yields an empty clause.
type TranspilerOption ¶
type TranspilerOption func(*transpilerOptions)
TranspilerOption customizes a Transpiler.
func WithRegistry ¶
func WithRegistry(registry *protoregistry.Files) TranspilerOption
WithRegistry provides the file registry resolving resource types, for callers whose descriptors are not linked into the binary.