-
Notifications
You must be signed in to change notification settings - Fork 0
/
t_example_misc_test.go
827 lines (699 loc) · 16.4 KB
/
t_example_misc_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
package sqlb_test
import (
"encoding/json"
"fmt"
s "github.com/mitranim/sqlb"
)
// Copy of `ExampleStrQ_nested` for package-level docs.
func Example_composition() {
inner := s.StrQ{
`select * from some_table where col0 = :val`,
s.Dict{`val`: 10},
}
outer := s.StrQ{
`select * from (:inner) as _ where col1 = :val`,
s.Dict{`inner`: inner, `val`: 20},
}
fmt.Println(s.Reify(outer))
// Output:
// select * from (select * from some_table where col0 = $1) as _ where col1 = $2 [10 20]
}
func ExampleBui_CatchExprs() {
bui := s.MakeBui(1024, 16)
err := bui.CatchExprs(
s.Select{`some_table`, s.Ands{true, false}},
)
if err != nil {
panic(err)
}
text, args := bui.Reify()
fmt.Println(text)
fmt.Println(args)
// Output:
// select * from "some_table" where $1 and $2
// [true false]
}
func ExampleStr_stringInterpolation() {
fmt.Println(s.Reify(
s.StrQ{
`select :col from some_table where :col <> :val`,
s.Dict{
`col`: s.Str(`some_col`),
`val`: `some_val`,
},
},
))
// Output:
// select some_col from some_table where some_col <> $1 [some_val]
}
func ExampleIdent() {
fmt.Println(s.Ident(``))
fmt.Println(s.Ident(`one`))
// Output:
// ""
// "one"
}
func ExampleIdent_interpolation() {
fmt.Println(s.Reify(
s.StrQ{
`select :col from some_table where :col <> :val`,
s.Dict{
`col`: s.Ident(`some_col`),
`val`: `some_val`,
},
},
))
// Output:
// select "some_col" from some_table where "some_col" <> $1 [some_val]
}
func ExampleIdentifier() {
fmt.Println(s.Identifier{`one`})
fmt.Println(s.Identifier{`one`, `two`})
fmt.Println(s.Identifier{`one`, `two`, `three`})
// Output:
// "one"
// "one"."two"
// "one"."two"."three"
}
func ExamplePath() {
fmt.Println(s.Path{`one`})
fmt.Println(s.Path{`one`, `two`})
fmt.Println(s.Path{`one`, `two`, `three`})
// Output:
// "one"
// ("one")."two"
// ("one")."two"."three"
}
func ExamplePseudoPath() {
fmt.Println(s.PseudoPath{`one`})
fmt.Println(s.PseudoPath{`one`, `two`})
fmt.Println(s.PseudoPath{`one`, `two`, `three`})
// Output:
// "one"
// "one.two"
// "one.two.three"
}
func ExampleAliasedPath() {
fmt.Println(s.AliasedPath{`one`})
fmt.Println(s.AliasedPath{`one`, `two`})
fmt.Println(s.AliasedPath{`one`, `two`, `three`})
// Output:
// "one"
// ("one")."two" as "one.two"
// ("one")."two"."three" as "one.two.three"
}
func ExampleExprs() {
type Filter struct {
Slug string `db:"slug"`
}
fmt.Println(s.Reify(
s.Select{`some_table`, Filter{`some_slug`}},
))
// Output:
// select * from "some_table" where "slug" = $1 [some_slug]
}
func ExampleAny() {
fmt.Println(s.Reify(s.Any{}))
fmt.Println(s.Reify(s.Any{[]int{10, 20}}))
fmt.Println(s.Reify(s.Any{s.Table{`some_table`}}))
// Output:
// any ($1) [<nil>]
// any ($1) [[10 20]]
// any (table "some_table") []
}
func ExampleAssign() {
fmt.Println(s.Reify(s.Assign{
`some_col`,
`arbitrary_value`,
}))
fmt.Println(s.Reify(s.Assign{
`some_col`,
s.Path{`some_table`, `another_col`},
}))
// Output:
// "some_col" = $1 [arbitrary_value]
// "some_col" = (("some_table")."another_col") []
}
func ExampleEq() {
fmt.Println(s.Reify(s.Eq{10, 20}))
fmt.Println(s.Reify(s.Eq{
s.Ident(`some_col`),
nil,
}))
fmt.Println(s.Reify(s.Eq{
s.Ident(`some_col`),
s.Ident(`another_col`),
}))
fmt.Println(s.Reify(s.Eq{
s.Ident(`some_col`),
s.Path{`some_table`, `another_col`},
}))
// Output:
// $1 = $2 [10 20]
// ("some_col") is null []
// ("some_col") = ("another_col") []
// ("some_col") = (("some_table")."another_col") []
}
func ExampleNeq() {
fmt.Println(s.Reify(s.Neq{10, 20}))
fmt.Println(s.Reify(s.Neq{
s.Ident(`some_col`),
nil,
}))
fmt.Println(s.Reify(s.Neq{
s.Ident(`some_col`),
s.Ident(`another_col`),
}))
fmt.Println(s.Reify(s.Neq{
s.Ident(`some_col`),
s.Path{`some_table`, `another_col`},
}))
// Output:
// $1 <> $2 [10 20]
// ("some_col") is not null []
// ("some_col") <> ("another_col") []
// ("some_col") <> (("some_table")."another_col") []
}
func ExampleEqAny() {
fmt.Println(s.Reify(s.EqAny{
10,
[]int{20, 30},
}))
fmt.Println(s.Reify(s.EqAny{
s.Ident(`some_col`),
[]int{20, 30},
}))
fmt.Println(s.Reify(s.EqAny{
s.Ident(`some_col`),
s.Table{`some_table`},
}))
// Output:
// $1 = any ($2) [10 [20 30]]
// ("some_col") = any ($1) [[20 30]]
// ("some_col") = any (table "some_table") []
}
func ExampleNeqAny() {
fmt.Println(s.Reify(s.NeqAny{
10,
[]int{20, 30},
}))
fmt.Println(s.Reify(s.NeqAny{
s.Ident(`some_col`),
[]int{20, 30},
}))
fmt.Println(s.Reify(s.NeqAny{
s.Ident(`some_col`),
s.Table{`some_table`},
}))
// Output:
// $1 <> any ($2) [10 [20 30]]
// ("some_col") <> any ($1) [[20 30]]
// ("some_col") <> any (table "some_table") []
}
func ExampleNot() {
fmt.Println(s.Reify(s.Not{}))
fmt.Println(s.Reify(s.Not{true}))
fmt.Println(s.Reify(s.Not{s.Ident(`some_col`)}))
// Output:
// not $1 [<nil>]
// not $1 [true]
// not ("some_col") []
}
func ExampleAnd_struct() {
fmt.Println(s.Reify(s.And{struct{}{}}))
fmt.Println(s.Reify(s.And{struct {
Col0 bool `db:"col0"`
Col1 any `db:"col1"`
Col2 any `db:"col2"`
}{
true,
nil,
s.Call{`some_func`, []int{10}},
}}))
// Output:
// true []
// "col0" = $1 and "col1" is null and "col2" = (some_func ($2)) [true 10]
}
func ExampleAnd_slice() {
type list = []any
fmt.Println(s.Reify(s.And{nil}))
fmt.Println(s.Reify(s.And{list{}}))
fmt.Println(s.Reify(s.And{list{true, false, s.Ident(`some_col`)}}))
// Output:
// true []
// true []
// $1 and $2 and ("some_col") [true false]
}
func ExampleOr_struct() {
fmt.Println(s.Reify(s.Or{struct{}{}}))
fmt.Println(s.Reify(s.Or{struct {
Col0 bool `db:"col0"`
Col1 any `db:"col1"`
Col2 any `db:"col2"`
}{
true,
nil,
s.Call{`some_func`, []int{10}},
}}))
// Output:
// false []
// "col0" = $1 or "col1" is null or "col2" = (some_func ($2)) [true 10]
}
func ExampleOr_slice() {
type list = []any
fmt.Println(s.Reify(s.Or{nil}))
fmt.Println(s.Reify(s.Or{list{}}))
fmt.Println(s.Reify(s.Or{list{true, false, s.Ident(`some_col`)}}))
// Output:
// false []
// false []
// $1 or $2 or ("some_col") [true false]
}
func ExampleAnds() {
fmt.Println(s.Reify(s.Ands{}))
fmt.Println(s.Reify(s.Ands{true, false, s.Ident(`some_col`)}))
// Output:
// true []
// $1 and $2 and ("some_col") [true false]
}
func ExampleOrs() {
fmt.Println(s.Reify(s.Ors{}))
fmt.Println(s.Reify(s.Ors{true, false, s.Ident(`some_col`)}))
// Output:
// false []
// $1 or $2 or ("some_col") [true false]
}
func ExampleCols_nonStruct() {
fmt.Println(s.Cols{})
fmt.Println(s.Cols{(*int)(nil)})
fmt.Println(s.Cols{(*[]string)(nil)})
// Output:
// *
// *
// *
}
func ExampleCols_struct() {
type Internal struct {
Id string `db:"id"`
Name string `db:"name"`
}
type External struct {
Id string `db:"id"`
Name string `db:"name"`
Internal Internal `db:"internal"`
}
fmt.Println(s.Cols{(*External)(nil)})
// Output:
// "id", "name", "internal"
}
func ExampleColsDeep_nonStruct() {
fmt.Println(s.ColsDeep{})
fmt.Println(s.ColsDeep{(*int)(nil)})
fmt.Println(s.ColsDeep{(*[]string)(nil)})
// Output:
// *
// *
// *
}
func ExampleColsDeep_struct() {
type Internal struct {
Id string `db:"id"`
Name string `db:"name"`
}
type External struct {
Id string `db:"id"`
Name string `db:"name"`
Internal Internal `db:"internal"`
}
fmt.Println(s.ColsDeep{(*External)(nil)})
// Output:
// "id", "name", ("internal")."id" as "internal.id", ("internal")."name" as "internal.name"
}
func ExampleStructValues() {
fmt.Println(s.Reify(s.StructValues{struct {
Col0 bool `db:"col0"`
Col1 any `db:"col1"`
Col2 any `db:"col2"`
}{
true,
nil,
s.Call{`some_func`, []int{10}},
}}))
// Output:
// $1, $2, (some_func ($3)) [true <nil> 10]
}
func ExampleStructInsert_empty() {
fmt.Println(s.StructInsert{})
// Output:
// default values
}
func ExampleStructInsert_nonEmpty() {
fmt.Println(s.Reify(s.StructInsert{struct {
Col0 bool `db:"col0"`
Col1 any `db:"col1"`
Col2 any `db:"col2"`
}{
true,
nil,
s.Call{`some_func`, []int{10}},
}}))
// Output:
// ("col0", "col1", "col2") values ($1, $2, (some_func ($3))) [true <nil> 10]
}
func ExampleStructsInsert_empty() {
fmt.Println(s.StructsInsertOf[any]())
// Output:
}
func ExampleStructsInsert_nonEmpty() {
type Row struct {
Col0 bool `db:"col0"`
Col1 int64 `db:"col1"`
Col2 string `db:"col2"`
}
fmt.Println(s.Reify(s.StructsInsertOf(
Row{true, 10, `one`},
Row{false, 20, `two`},
)))
// Output:
// ("col0", "col1", "col2") values ($1, $2, $3), ($4, $5, $6) [true 10 one false 20 two]
}
func ExampleStructAssign() {
fmt.Println(s.Reify(s.StructAssign{struct {
Col0 bool `db:"col0"`
Col1 any `db:"col1"`
Col2 any `db:"col2"`
}{
true,
nil,
s.Call{`some_func`, []int{10}},
}}))
// Output:
// "col0" = $1, "col1" = $2, "col2" = (some_func ($3)) [true <nil> 10]
}
func ExampleSelectCols_asIs() {
fmt.Println(s.SelectCols{s.Table{`some_table`}, nil})
// Output:
// table "some_table"
}
func ExampleSelectCols_cols() {
type SomeStruct struct {
Col0 string `db:"col0"`
Col1 string `db:"col1"`
Col2 string `db:"-"`
}
fmt.Println(s.SelectCols{s.Table{`some_table`}, (*SomeStruct)(nil)})
// Output:
// with _ as (table "some_table") select "col0", "col1" from _
}
func ExampleSelectColsDeep_asIs() {
fmt.Println(s.SelectColsDeep{s.Table{`some_table`}, nil})
// Output:
// table "some_table"
}
func ExampleSelectColsDeep_cols() {
type SomeStruct struct {
Outer string `db:"outer"`
Inner struct {
Name string `db:"name"`
} `db:"inner"`
}
fmt.Println(s.SelectColsDeep{s.Table{`some_table`}, (*SomeStruct)(nil)})
// Output:
// with _ as (table "some_table") select "outer", ("inner")."name" as "inner.name" from _
}
func ExampleSelect_unfiltered() {
fmt.Println(s.Reify(s.Select{`some_table`, nil}))
// Output:
// select * from "some_table" []
}
func ExampleSelect_filtered() {
type Filter struct {
Col0 int64 `db:"col0"`
Col1 int64 `db:"col1"`
}
fmt.Println(s.Reify(s.Select{`some_table`, Filter{10, 20}}))
// Output:
// select * from "some_table" where "col0" = $1 and "col1" = $2 [10 20]
}
func ExampleInsert_empty() {
fmt.Println(s.Reify(s.Insert{`some_table`, nil}))
// Output:
// insert into "some_table" default values returning * []
}
func ExampleInsert_nonEmpty() {
type Fields struct {
Col0 int64 `db:"col0"`
Col1 int64 `db:"col1"`
}
fmt.Println(s.Reify(s.Insert{`some_table`, Fields{10, 20}}))
// Output:
// insert into "some_table" ("col0", "col1") values ($1, $2) returning * [10 20]
}
func ExampleUpdate() {
type Filter struct {
Col0 int64 `db:"col0"`
Col1 int64 `db:"col1"`
}
type Fields struct {
Col2 int64 `db:"col2"`
Col3 int64 `db:"col3"`
}
fmt.Println(s.Reify(
s.Update{`some_table`, Filter{10, 20}, Fields{30, 40}},
))
// Output:
// update "some_table" set "col2" = $1, "col3" = $2 where "col0" = $3 and "col1" = $4 returning * [30 40 10 20]
}
func ExampleDelete_unfiltered() {
fmt.Println(s.Reify(s.Delete{`some_table`, nil}))
// Output:
// delete from "some_table" where null returning * []
}
func ExampleDelete_filtered() {
type Filter struct {
Col0 int64 `db:"col0"`
Col1 int64 `db:"col1"`
}
fmt.Println(s.Reify(s.Delete{`some_table`, Filter{10, 20}}))
// Output:
// delete from "some_table" where "col0" = $1 and "col1" = $2 returning * [10 20]
}
func ExampleSelectCount() {
fmt.Println(
s.SelectCount{s.Table{`some_table`}},
)
// Output:
// with _ as (table "some_table") select count(*) from _
}
func ExampleCall_empty() {
fmt.Println(s.Call{`some_func`, nil})
// Output:
// some_func ()
}
func ExampleCall_arguments() {
fmt.Println(s.Reify(s.Call{`some_func`, []int{10, 20, 30}}))
// Output:
// some_func ($1, $2, $3) [10 20 30]
}
func ExampleCall_subExpression() {
fmt.Println(s.Call{`exists`, s.Table{`some_table`}})
// Output:
// exists (table "some_table")
}
func ExampleCall_subExpressions() {
fmt.Println(s.Call{`some_func`, []s.Ident{`one`, `two`}})
// Output:
// some_func (("one"), ("two"))
}
func ExampleRowNumberOver_empty() {
fmt.Println(s.RowNumberOver{})
// Output:
// 0
}
func ExampleRowNumberOver_nonEmpty() {
fmt.Println(s.RowNumberOver{s.Ords{s.OrdDesc{`some_col`}}})
// Output:
// row_number() over (order by "some_col" desc)
}
func ExampleListQ() {
fmt.Println(s.Reify(
s.ListQ(`
select * from some_table where col_one = $1 and col_two = $2
`, 10, 20),
))
// Output:
// select * from some_table where col_one = $1 and col_two = $2 [10 20]
}
func ExampleDictQ() {
fmt.Println(s.Reify(
s.DictQ(`
select * from some_table where col_one = :one and col_two = :two
`, map[string]any{
`one`: 10,
`two`: 20,
}),
))
// Output:
// select * from some_table where col_one = $1 and col_two = $2 [10 20]
}
func ExampleStrQ_empty() {
fmt.Println(s.Reify(s.StrQ{}))
// Output:
// []
}
func ExampleStrQ_simple() {
fmt.Println(s.Reify(
s.StrQ{
`select * from some_table where col_one = :one and col_two = :two`,
s.Dict{
`one`: 10,
`two`: 20,
},
},
))
// Output:
// select * from some_table where col_one = $1 and col_two = $2 [10 20]
}
func ExampleStrQ_structs() {
type Output struct {
Col0 string `db:"col0"`
Col1 string `db:"col1"`
}
type Filter struct {
Col2 int64 `db:"col2"`
Col3 int64 `db:"col3"`
}
fmt.Println(s.Reify(
s.StrQ{
`select :cols from some_table where :filter`,
s.Dict{
`cols`: s.Cols{(*Output)(nil)},
`filter`: s.And{Filter{10, 20}},
},
},
))
// Output:
// select "col0", "col1" from some_table where "col2" = $1 and "col3" = $2 [10 20]
}
func ExampleStrQ_structInput() {
type Output struct {
Col0 string `db:"col0"`
Col1 string `db:"col1"`
}
type Filter struct {
Col2 int64 `db:"col2"`
Col3 int64 `db:"col3"`
}
type Input struct {
Cols s.Cols
Filter s.And
}
fmt.Println(s.Reify(
s.StructQ(`
select :Cols from some_table where :Filter
`, Input{
s.Cols{(*Output)(nil)},
s.And{Filter{10, 20}},
}),
))
// Output:
// select "col0", "col1" from some_table where "col2" = $1 and "col3" = $2 [10 20]
}
func ExampleStrQ_nested() {
inner := s.StrQ{
`select * from some_table where col0 = :val`,
s.Dict{`val`: 10},
}
outer := s.StrQ{
`select * from (:inner) as _ where col1 = :val`,
s.Dict{`inner`: inner, `val`: 20},
}
fmt.Println(s.Reify(outer))
// Output:
// select * from (select * from some_table where col0 = $1) as _ where col1 = $2 [10 20]
}
func ExampleOrds_empty() {
fmt.Println(s.Ords{})
// Output:
}
func ExampleOrds_manual() {
fmt.Println(s.Ords{
s.OrdDesc{`col0`},
s.Str(`random() asc`),
})
// Output:
// order by "col0" desc, random() asc
}
func ExampleOrds_OrdsParser() {
type SomeStruct struct {
Col0 string `json:"jsonField0" db:"dbCol0"`
Col1 string `json:"jsonField1" db:"dbCol1"`
}
var ords s.Ords
err := ords.OrdsParser((*SomeStruct)(nil)).ParseSlice([]string{
`jsonField0 asc`,
`jsonField1 desc nulls last`,
})
if err != nil {
panic(err)
}
fmt.Printf("%#v\n\n", ords)
fmt.Println(ords)
// Output:
// sqlb.Ords{sqlb.OrdAsc{"dbCol0"}, sqlb.OrdDescNullsLast{"dbCol1"}}
//
// order by "dbCol0" asc, "dbCol1" desc nulls last
}
func ExampleParserOrds_ParseSlice() {
type SomeStruct struct {
Col0 string `json:"jsonField0" db:"dbCol0"`
Col1 string `json:"jsonField1" db:"dbCol1"`
}
var par s.ParserOrds
par.OrType((*SomeStruct)(nil))
err := par.ParseSlice([]string{`jsonField0 asc`, `jsonField1 desc nulls last`})
if err != nil {
panic(err)
}
fmt.Printf("%#v\n\n", par.Ords)
fmt.Println(par.Ords)
// Output:
// sqlb.Ords{sqlb.OrdAsc{"dbCol0"}, sqlb.OrdDescNullsLast{"dbCol1"}}
//
// order by "dbCol0" asc, "dbCol1" desc nulls last
}
func ExampleParserOrds_UnmarshalJSON() {
type SomeStruct struct {
Col0 string `json:"jsonField0" db:"dbCol0"`
Col1 string `json:"jsonField1" db:"dbCol1"`
}
var par s.ParserOrds
par.OrType((*SomeStruct)(nil))
err := json.Unmarshal(
[]byte(`["jsonField0 asc", "jsonField1 desc nulls last"]`),
&par,
)
if err != nil {
panic(err)
}
fmt.Printf("%#v\n\n", par.Ords)
fmt.Println(par.Ords)
// Output:
// sqlb.Ords{sqlb.OrdAsc{"dbCol0"}, sqlb.OrdDescNullsLast{"dbCol1"}}
//
// order by "dbCol0" asc, "dbCol1" desc nulls last
}
func ExampleLimitUint() {
fmt.Println(s.Reify(
s.Exprs{s.Select{`some_table`, nil}, s.LimitUint(10)},
))
// Output:
// select * from "some_table" limit 10 []
}
func ExampleOffsetUint() {
fmt.Println(s.Reify(
s.Exprs{s.Select{`some_table`, nil}, s.OffsetUint(10)},
))
// Output:
// select * from "some_table" offset 10 []
}