MCPcopy
hub / github.com/dosco/graphjin / RenderLimit

Method RenderLimit

core/internal/dialect/sqlite.go:55–74  ·  view source on GitHub ↗
(ctx Context, sel *qcode.Select)

Source from the content-addressed store, hash-verified

53}
54
55func (d *SQLiteDialect) RenderLimit(ctx Context, sel *qcode.Select) {
56 if sel.Paging.NoLimit {
57 return
58 }
59
60 ctx.WriteString(` LIMIT `)
61 if sel.Paging.LimitVar != "" {
62 ctx.AddParam(Param{Name: sel.Paging.LimitVar, Type: "integer"})
63 } else {
64 ctx.Write(fmt.Sprintf("%d", sel.Paging.Limit))
65 }
66
67 if sel.Paging.OffsetVar != "" {
68 ctx.WriteString(` OFFSET `)
69 ctx.AddParam(Param{Name: sel.Paging.OffsetVar, Type: "integer"})
70 } else if sel.Paging.Offset != 0 {
71 ctx.WriteString(` OFFSET `)
72 ctx.Write(fmt.Sprintf("%d", sel.Paging.Offset))
73 }
74}
75
76func (d *SQLiteDialect) RenderJSONRoot(ctx Context, sel *qcode.Select) {
77 ctx.WriteString(`SELECT json_object(`)

Callers

nothing calls this directly

Calls 3

WriteStringMethod · 0.65
AddParamMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected