@@ -51,8 +51,10 @@ type sqliteVTabCursor struct {
51
51
vTabCursor VTabCursor
52
52
}
53
53
54
+ // Op is type of operations.
54
55
type Op uint8
55
56
57
+ // Op mean identity of operations.
56
58
const (
57
59
OpEQ Op = 2
58
60
OpGT = 4
@@ -66,21 +68,22 @@ const (
66
68
OpScanUnique = 1 /* Scan visits at most 1 row */
67
69
)
68
70
71
+ // InfoConstraint give information of constraint.
69
72
type InfoConstraint struct {
70
73
Column int
71
74
Op Op
72
75
Usable bool
73
76
}
74
77
78
+ // InfoOrderBy give information of order-by.
75
79
type InfoOrderBy struct {
76
80
Column int
77
81
Desc bool
78
82
}
79
83
80
84
func constraints (info * C.sqlite3_index_info ) []InfoConstraint {
81
85
l := info .nConstraint
82
- var constraints * C.struct_sqlite3_index_constraint = info .aConstraint
83
- slice := (* [1 << 30 ]C.struct_sqlite3_index_constraint )(unsafe .Pointer (constraints ))[:l :l ]
86
+ slice := (* [1 << 30 ]C.struct_sqlite3_index_constraint )(unsafe .Pointer (info .aConstraint ))[:l :l ]
84
87
85
88
cst := make ([]InfoConstraint , 0 , l )
86
89
for _ , c := range slice {
@@ -99,8 +102,7 @@ func constraints(info *C.sqlite3_index_info) []InfoConstraint {
99
102
100
103
func orderBys (info * C.sqlite3_index_info ) []InfoOrderBy {
101
104
l := info .nOrderBy
102
- var obys * C.struct_sqlite3_index_orderby = info .aOrderBy
103
- slice := (* [1 << 30 ]C.struct_sqlite3_index_orderby )(unsafe .Pointer (obys ))[:l :l ]
105
+ slice := (* [1 << 30 ]C.struct_sqlite3_index_orderby )(unsafe .Pointer (info .aOrderBy ))[:l :l ]
104
106
105
107
ob := make ([]InfoOrderBy , 0 , l )
106
108
for _ , c := range slice {
@@ -211,8 +213,7 @@ func goVBestIndex(pVTab unsafe.Pointer, icp unsafe.Pointer) *C.char {
211
213
212
214
// Get a pointer to constraint_usage struct so we can update in place.
213
215
l := info .nConstraint
214
- var usg * C.struct_sqlite3_index_constraint_usage = info .aConstraintUsage
215
- s := (* [1 << 30 ]C.struct_sqlite3_index_constraint_usage )(unsafe .Pointer (usg ))[:l :l ]
216
+ s := (* [1 << 30 ]C.struct_sqlite3_index_constraint_usage )(unsafe .Pointer (info .aConstraintUsage ))[:l :l ]
216
217
index := 1
217
218
for i := C .int (0 ); i < info .nConstraint ; i ++ {
218
219
if res .Used [i ] {
0 commit comments