@@ -77,6 +77,13 @@ func (db *DB) SelectRowid(table string, rowid int64, columns ...string) (Row, er
7777
7878// Select all rows from the given table via the index. The order will be the
7979// index order (every `DESC` field will iterate in descending order).
80+ //
81+ // `columns` are the name of the columns you want, their values always come
82+ // from the data table. Index columns can have expressions, but that doesn't do
83+ // anything (except maybe change the order).
84+ //
85+ // If the index has a WHERE expression only the rows matching that expression
86+ // will be matched.
8087func (db * DB ) IndexedSelect (table , index string , cb RowCB , columns ... string ) error {
8188 if err := db .db .RLock (); err != nil {
8289 return err
@@ -106,6 +113,21 @@ func (db *DB) IndexedSelect(table, index string, cb RowCB, columns ...string) er
106113//
107114// `key` is compared against the index columns. `key` can have fewer columns than
108115// the index, in which case only the given columns need to compare equal.
116+ // If the index column is an expression then `key` is compared against the
117+ // value stored in the index.
118+ //
119+ // For example, given a table:
120+ // 1: "aap", 1
121+ // 2: "aap", 13
122+ // 3: "noot", 12
123+ // matches:
124+ // Key{"aap", 1} will match rows 1
125+ // Key{"aap"} will match rows 1 and 2
126+ // Key{"noot", 1} will not match any row
127+ // Key{} will match every row
128+ //
129+ // If the index has a WHERE expression only the rows matching that expression
130+ // will be matched.
109131func (db * DB ) IndexedSelectEq (table , index string , key Key , cb RowCB , columns ... string ) error {
110132 if err := db .db .RLock (); err != nil {
111133 return err
@@ -138,7 +160,7 @@ func (db *DB) IndexedSelectEq(table, index string, key Key, cb RowCB, columns ..
138160//
139161// `key` is compared against the columns of the primary key. `key` can have fewer
140162// columns than the primary key has, in which case only the given columns need
141- // to compare equal.
163+ // to compare equal (see `IndexedSelectEq` for an example) .
142164// Any collate function defined in the schema will be applied automatically.
143165//
144166// PKSelect is especially efficient for non-rowid tables (`WITHOUT ROWID`), and
0 commit comments