Documentation
¶
Overview ¶
Package dynamobind parses and prints typed DynamoDB access-pattern sources.
The grammar is its own: a declaration takes its Go visibility from the case of its name, where an HTML or SQL template takes it from an export keyword. The two are therefore not one grammar wearing two hats, and this package stays separate from the shared template parser until that difference is settled on purpose rather than by a move.
Index ¶
Constants ¶
const DefaultTemplatePattern = "*.tb.dynamo"
DefaultTemplatePattern is the base-name glob for query declarations, beside the HTML and SQL template patterns.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Predicate ¶
Predicate is one comparison in a key clause. Params holds one name, or two for BETWEEN.
type QueryDecl ¶
type QueryDecl struct {
Name string
Exported bool
Params []QueryParam
Shape ResultShape
ItemType string
// Table is the declared table name. It is required: an access pattern names
// exactly one table, so the fact is complete where it is written and the
// generated function needs no table parameter.
Table string
TableLine int
Key []Predicate
SourcePath string
Line int
}
QueryDecl is one declared access pattern.
type QueryParam ¶
type QueryParam struct {
Name string
// Type is the Go type as the declaration spells it, checked later against
// the attribute's own Go type.
Type string
Line int
}
QueryParam is one declared parameter of a query function.
type ResultShape ¶
type ResultShape string
ResultShape is what a declaration asks the generated function to return. It selects the request shape rather than a row count: a Query always returns many, and the choice is whether the caller sees the page boundaries.
const ( // Page issues one request and returns a page. Page ResultShape = "page" // Many iterates every page. Many ResultShape = "many" )