Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadQuery ¶
A BadQuery node is a placeholder for queries containing syntax errors for which no correct declaration nodes can be created.
type CommentGroup ¶
type CommentGroup struct {
List []*LineComment // len(List) > 0
}
A CommentGroup represents a sequence of comments with no other tokens and no empty lines between.
func (*CommentGroup) End ¶
func (g *CommentGroup) End() gotok.Pos
func (*CommentGroup) Kind ¶
func (g *CommentGroup) Kind() NodeKind
func (*CommentGroup) Pos ¶
func (g *CommentGroup) Pos() gotok.Pos
type File ¶
type File struct { Name string Doc *CommentGroup // associated documentation; or nil Queries []Query // top-level queries; or nil Comments []*CommentGroup // list of all comments in the source file }
A File node represents a query source file.
The Comments list contains all comments in the source file in order of appearance, including the comments that are pointed to from other nodes via Doc and Comment fields.
type LineComment ¶
type LineComment struct { Start gotok.Pos // position of the '--' starting the comment Text string // comment text excluding '\n' }
A LineComment node represents a single line comment.
func (*LineComment) End ¶
func (c *LineComment) End() gotok.Pos
func (*LineComment) Kind ¶
func (c *LineComment) Kind() NodeKind
func (*LineComment) Pos ¶
func (c *LineComment) Pos() gotok.Pos
type Pragmas ¶
type Pragmas struct {
ProtobufType string // package qualified protocol buffer message type to use for output rows
}
Pragmas are options to control generated code for a single query.
type Query ¶
type Query interface { Node // contains filtered or unexported methods }
Query nodes implement the Decl interface.
type ResultKind ¶
type ResultKind string
ResultKind is the shape of the output. Controls the output type of the query.
const ( ResultKindMany ResultKind = ":many" ResultKindOne ResultKind = ":one" ResultKindExec ResultKind = ":exec" )
type SourceQuery ¶
type SourceQuery struct { Name string // name of the query Doc *CommentGroup // associated documentation; or nil Start gotok.Pos // position of the start token, like 'SELECT' or 'UPDATE' SourceSQL string // the complete sql query as it appeared in the source file PreparedSQL string // the sql query with args replaced by $1, $2, etc. ParamNames []string // the name of each param in the PreparedSQL, the nth entry is the $n+1 param ParamHaveDefaults map[string]bool // map each param name to bool to indicate whether the param has a default value expression ResultKind ResultKind // the result output type Pragmas Pragmas // optional query options Semi gotok.Pos // position of the closing semicolon }
An SourceQuery node represents a query entry from the source code.
func (*SourceQuery) End ¶
func (q *SourceQuery) End() gotok.Pos
func (*SourceQuery) Kind ¶
func (q *SourceQuery) Kind() NodeKind
func (*SourceQuery) Pos ¶
func (q *SourceQuery) Pos() gotok.Pos